I’m trying to get a command line switch working, it seems that I’m missing something critical, possibly permissions. I’m a windows guy so HA is my way or learning linux.
the command i want to execute, which works in the terminal (also works when running it as the user homassistant in the active virtual environment) onkyo system-power=on which turns my onkyo receiver on
installed outside of the virtual env with “easy_install onkyo-eiscp”
I couldn’t install it inside the virtual env because it required sudo to modify some folders, could that be the reason? If so, how can I install it withing the virtal env?
If it works when you’re inside your venv as hass user, it should work also in HA
Does this work in terminal? sh /home/homeassistant/.homeassistant/shell_commands/onkyo_on.sh
Done, but I’m getting the same error in the HA log, tried restarting HA as well without any luck =/
And I tried the .sh script from the terminal to make sure that it worked when i added /usr/local…
You can try using the absolute path in your sh script.
What I originally was asking was which OS are you using? Is this on hassbian? Can you please post your systemd service file for home assistant?
VDrainer: The test commands worked fine! So I’m guessing the problem is getting the HA user to use the onkyo files, should I change any permissions on /usr/local/bin/onkyo to make sure that the user homeassistant can execute them? Or should I add the HA user to any specific group? I dont have a big issue with giving HA higher privileges, I’m running HA within my local network anyways (with VPN for accessing it from my phone)
Keithh666: They were owned by root, and executable, i changed it to homeassistant and tried it again without luck.
Hmm, just tried it in my DEV environment instead, got it to work by skipping the use of .sh files and just letting the command line switch execute the command, sorry VDrainer if this was what you meant earlier, I just updated the onkyo_on.sh with the absolut path at that point…
But I’ll still need to solve how to execute .sh scripts from HA, I’ll continue to try different things.
Hey @martikainen
I was blind. I think the problem ist the “shebang” in your scripts.
Please change #!bin/sh
to #!/bin/sh
or #!/bin/bash
in your script and call it with command_on: "/home/homeassistant/.homeassistant/shell_commands/onkyo_on.sh"