I am a new user of home assistant, and I’m loving it so far. I have also recently discovered how to use irsend and lirc to transmit IR to devices. I have one r.Pi3 running HA, and another r.Pi3 on the network setup for lirc. I have written a .sh script on the HA Pi that connects to the remote Pi and executes the infrared trasmit command. This works perfectly running it from the command line directly “/home/pi/sewing_ac_on.sh”. I tried placing a shell command and a script to call it in HA, but that doesn’t work properly. Here’s the piece of my configuration.yaml file.
Thanks for your help! I tried adding a period before the command - didn’t change anything. I also added /home/pi in the PATH variable, which also didn’t change anything. I also tried copying the script to /home/hass (as I used the rPi AiO installer), and adding that to the PATH variable for the hass user, but that didn’t do it either. I also tried making a file without .sh and with just the command but that didn’t work. Any other thoughts as to what I could do to get this working?
@VladTepz - the local irsend commands are not what I’m having issue with - they work perfectly fine. Only the execution of the .sh file to issue commands remotely is what is not running correctly via HA.
The only other thing I can think of is to check to make sure its executable “sudo chmod +x /home/pi/sewing_ac_on.sh” and the user Hass is running as has permission to execute.
@martinhjelmare I tried adding sh to the beginning of the shell command like you suggested - no luck. I also tried calling the service from the dev tools, which produced no results and no log entries.
@VladTepz I did make the file executable as well as I checked the permissions and it is set so anyone can read and execute the file.
You should always see something in the logs after calling a service. Otherwise you’re logging isn’t set up or the log level is not verbose enough.
Do you have an entry in your config for the logger component? You can change the log level with that component. During troubleshooting I like to set default to INFO.
I know it has been a while but did this end up getting solved.
I have the same problem - .sh files are executable and functioning from putty and appear to be executing from home assistant but are not actually functioning.
I installed HA with All in one installer on a raspberry pi 3. I also had no luck with executing any shell command.
After hour of finding a solution, I changed the home-assistant.service from user hass to user pi and give the .homeassistant folder 777 rights.
Now I can execute any script or command also with sudo etc…
I dont know if this is the perfect solution, but it works for me.
Thanks for the tip, that gave me the idea to add the hass user to all of the groups that the pi user is in - but it doesn’t look like its working either.
Its strange that the error doesn’t show up in the log file, that would sure make it a lot easier to diagnose.
The script is in the hass user home folder with 777 rights so hass shouldn’t have any issue running it. I’ve tried it with and without sudo without any luck.
I also need some help with executing a .sh file. This .sh file should start when my doorbell rings. I have tried the shell_command but it still doesn’t execute.