Noob here, seeking assistance with shell scripts!

Hi Everyone,

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.

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 “” and the other “”. 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! :slight_smile:

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/

Hi @patatesboy, i think you could use a Command line cover for this.
Here are some tips about command line problems.
Hope that helps.

I suggest you use a command_line cover or a command_line switch, and put the full path to your scripts as the command_on and command_off parameters.

As 333ryan18 says, do make sure that the user running HA has permission to run the scripts.

If HA doesn’t start up, it meas that there is an error in the configuration file. Doing

hass --script check_config

as the HA user in the virtual environment will check the script and tell you what is wrong.

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.

Finally got it working! Thank you VDRainer!!!