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:
#!/bin/bash
sshpass -p ‘your_password’ ssh -o StrictHostKeyChecking=no root@ip_of_your_kodi ‘(echo “standby 0” | cec-client -s -d 1)’
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.