I have this shell script below, that I can successfully run when I ssh into my hassos; it will work as intended, in this case, toggling audio playback on a remote linux machine.
However, when I run it through shell_command, I only get Error running command: /config/packages/cli_helper.sh "toggle_playback", return code: 255 , What do I need to change in order to make this work?
EDIT: I also had it like this unten_arbeitszimmer_drehknopf_toggle_playback: '/config/packages/cli_helper.sh "toggle_playback"', no difference.
Again, I positively can ssh into my machine and run this; so both the identity file and the code itself must be correct. I ssh into hassos, run this code, and audio playback will toggle on my desktop PC.
I try running this through Home Assistant itself, and I get the error above. I have this in my configuration.yaml
allowlist_external_dirs:
- "/config/security"
This directory seems to work fine as well; Home Assistant can write to it (via camera.snapshot) and access the files there (via notify.telegram).
These are the contents of that directory; it’s permission seem to be correct as well.
What am I missing? Thank you in advance for your help
Thank you. I had to add -o UserKnownHostsFile=... to my bash script. Now it works fine, after copying the known_hosts file to my packages directory and pointing to it.
Swinging through two years later to say you’re my hero.
I was at this for a hilarious amount of time. Tragically, I had EVERYTHING handled just fine (keys, ssh, proper config path, ssh, .ssh, etc) and I was certain the container was the issue, but at no point did anyone in any forum - nor did anyone include in any official documentation that I combed through - either of
the “protection mode” setting, or
the docker exec -it homeassistant bash command
Home Assistant container did indeed just need the ol’ fingerprint/yes/green light/high five/karate chop.
As a serious shell script and workflow junkie who automates even the silliest things, thank you very much!