I have set up Home Assistant in Docker on Ubuntu Linux and everything is working well. I have added a command line switch.
switch:
platform: command_line
switches:
wifi:
command_on: ssh [email protected] '(echo "enable" ; echo "configure" ; echo "interface '0/7'" ; echo "poe opmode auto" ; echo "exit" ; echo "exit" ; echo "exit") | telnet localhost 23 ; exit;'
command_off: ssh [email protected] '(echo "enable" ; echo "configure" ; echo "interface '0/7'" ; echo "poe opmode shutdown" ; echo "exit" ; echo "exit" ; echo "exit") | telnet localhost 23 ; exit;'
friendly_name: Wifi PoE Switch
The ssh commands work perfectly when excited from the Ubuntu user account since I have set up authorization keys. But when I trigger from HA they fail which I suspect is because the ssh authorization key is tied to the Ubunutu user not the HA docker container user. I assume I need to get a public key for the HA container so it can ssh into my server but I am not sure how to do that. I am new to docker and HA so any help would be appreciated.