This is my first post here, I’ve been lurking these forums for about two months now. I’m pretty new to home automation/programming, starting to understand it more and more everyday. I was hoping to get some suggestions/solutions for this issue I’m facing.
Hardware:
Raspberry Pi 3: Located in the garage (controls my garage door via gpio pins and python, also hosts motioneye)
Raspberry Pi 3: Located in the living room (runs the hassbian OS)
I’ve made 2 shell scripts that SSH to my garage pi and one runs “opengaragedoor.py” and the other “closegaragedoor.py”. They work fine when I run these through terminal on my homeassistant pi, however, when I tried to test them through the services tab in homeassistant, they would both come up on the list under shell scripts, but they wouldn’t work. I couldn’t figure out how to get them to show up on the GUI as an activate button. I read that I had to make a script for it. Anytime I’d follow an example of a script, I’d restart HA and it wouldn’t launch until I went into the config and removed that script. As far as my configuration goes now, I haven’t saved or made a backup of when I had gotten that far, I’m basically back to square one because I got frustrated and deleted that section of my config file. I’d really appreciate some input!
I was having trouble as well, but solved my issue with changing permissions of the file you are trying to access. Try this:
sudo chmod 777 /dir_of_script/script.py
Thanks everyone for your suggestions. VDRainer, I followed your link to the tips about command line problems. It seems when I’m trying to run the script I wrote in the virtual environment, it gives me an error saying that the directory or file doesn’t exist as if it’s searching for it on it’s system instead of SSHing. When I run it on the pi outside of the virtual environment, it in fact SSH’s into the other pi in the garage and runs the command.