Hi
If I have a .py file script. Is there anyway in hassio to input a command like you would in terminal such as ‘control pause’.
Thanks in advance
Before I begin, in all honestly, I don’t know if this suggestion would work. I’m quite new to home assistant, but this is where I would begin trying to tackle this.
I would create a switch in the config along the lines of the below…
- platform: command_line
switches:
tv_power:
command_on: ssh [email protected] '/pythonscripts/tv_on.py'
command_off: ssh [email protected] '/pythonscripts/tv_off.py'
Obviously having each command stored as a seperate Python file.
Like I say I don’t know if this is a silly answer or something that will set you on the right path.
I got this idea from the below suggestion posted in another thread.
platform: command_line
switches:
arest_pin_four:
command_on: “/usr/bin/curl -X GET http://192.168.1.10/digital/4/1”
This works for me. Runs a pyhton program to turn on or off a remote controlled socket via a 433MHz transmitter. This socket is not supported by the standard rpi_rf platform
- platform: command_line
switches:
scs_a:
friendly_name: Silvercrest A
command_on: python3 /home/pi/SilverPiV4.py A1
command_off: python3 /home/pi/SilverPiV4.py A0
So could I have command_on: Control pause /share/skyRemote.py
You can put the .py command wherever you like so long as you specify the correct path when you run it. You must run it under Python3. You will have to write the python code of course for your requirements. So yours would look like:
python3 /share/skyRemote.py pause
Assuming ‘pause’ is coded as an argument in the python program. In my case a single python program turns on and off four Silvercrest sockets
A0 - socket A off
A1 - socket A on
B0 - Socket B off
etc.
I should mention that I am not familiar with hassio so it might be different in that environment.