Hello everyone
I have hass.io installed on a rpi3
I´m trying to run a python script with a shell command from this git https://github.com/Schamper/xbox-remote-power. When I tested the python script from my python in windows it works fine, but I don´t know how can I called this command from hass and turn this on a switch, i´ve tried with shell command so I made a automation and input boolean with the following:
configuration.yaml:
input_boolean:
turn_on_xbox:
name: Turn on XBOX
initial: off
icon: mdi:xbox
shell_command:
start_xbox: ‘/home/pi/xbox-remote-power.py -a -i’
automation.yaml
id: automa1
alias: Xbox turn on automation
initial_state: ‘off’
trigger:
platform: state
entity_id: input_boolean.turn_on_xbox
to: ‘on’
action:
and you may have to put the full path to the python exe and you will need the path to the scripts. You do’t appear to have a shell command called turn_on_xbox which should look something like this…
magicbluebulb_pclamp_set_color: '/bin/bash /home/homeassistant/.homeassistant/scripts/mb_colour.sh F2:F1:09:E6:DE:78 {{ col }}'
or
hello and tks for the reply
sorry but didn´t understand do I need to put “load_input_settings: ‘sudo python /home/homeassistant/.homeassistant/hass_saved_settings.py -act update_hass’” anyway or it´s just an example?
the other three bellow is also an example?
I´ve put the s file and python script in a directory called python_scripts and I´ve changed to this but still didn´t work:
python_script:
input_boolean:
turn_on_xbox:
name: Turn on XBOX
initial: off
icon: mdi:xbox
Yep all four are valid examples of the way to call shell scripts, the only thing I can see wrong with your turn_on_xbox is that there are no single quotes round the whole of the command, see my examples above. You need to first check that the call can be made on the command line, then in the virtual env (if you use), most likely it won’t work in the venv because homeassistant won’t have permissions to run the file as root which is usually needed.
tks again I tried the single quotes but it gaves me error when I took out it didn´t give nothing wrong but didn´t work as well. Nothing show on my logs only that the automation was triggered. I think running hassio I can´t run the script directly on the shell right? When I run on my computer with python 2.7 it worked fine.
Well hassio is runing resinOS I think so I don’t believe it will run anything that runs on Linux (however I could be wrong), also doesn’t it run from a docker? Don’t you have to run addons to do other stuff - I have no idea i don’t use it, you would be better off asking hassio related questions in the hassio forum.