For some automations it is necessary to use scripting. For ease of use I usually rely on sshpass. Unfortunately this is not part of the base package of most docker containers. E.g. I use sshpass for switching on my TV with a remote CEC command send to my RPi with Kodi via a script from HA:
The script is activated by a button in HA, issuing the command remotely on the Kodi device. Same for switching off the TV or checking the status: ‘(echo pow 0 | cec-client -s -d 1) | grep "power status: "’
For this, I need sshpass in a HA docker container / supervised install. Currently I connect to the container and use:
apk add --update --no-cache sshpass
to install sshpass after every update. Would be great if it would be “on board” as standard. Helpful bash_scripts are TV status/switching, activating PoE on ports of a Unifi switch (e.g. ‘(echo “enable” ; echo “configure” ; echo “interface 0/15” ; echo “poe opmode auto” ; echo “exit” ; echo “exit” ; echo “exit”) | telnet localhost ; exit;’ - currently just working on Unifi Gen1 switches) and many more. Would be appreciate if sshpass could be integrated in the standard docker container for HA.
The exact same thing happens to me. I have a bash script to connect via ssh to my firewall and restart it, all automatically from HA. The problem is that everything was working fine until last week I updated the HA core. every time I upgrade the HA core I have to go through these steps again.
Go to Settings → plugins → Advanced SSH & Web Terminal → Uncheck protection mode → reboot
Go to Terminal →
docker ps -a
(look for the CONTAINER ID of the Docker container which is called homeassistant and its IMAGE is [Package qemux86-64-homeassistant · GitHub](http ://ghcr.io/home-assistant/qemux86-64-homeassistant:2024.5.4))
I have created a custom homeassistant image that includes sshpass.
This is the image: matssa/homeassistant-custom
If you ever need it updated to a new homeassistant version just send me a email since i don’t regulary look at forums. My email: [email protected]