Hi. I searched for a simulair topic with my problem but no luck.
When I’m away from home I use HA to switch on my media server computer to watch some content. When im finished watching I like to switch my media server computer off via the Wake on Lan Switch.
This is my code in the configuration.yaml
# Wake on Lan Server
switch:
- platform: wake_on_lan
mac: xx:xx:xx:xx:xx:xx
turn_off:
service: shell_command.turn_off
shell_command:
turn_off: ssh -p 2022 [email protected] sudo shutdown -h now
The command itself works when I do it via the terminal, the remote computer shuts down.
When I change the last command like this below, no changes.
Solved. Found this on this forum. Did what it said.
Not sure of docker exec -it homeassistant bash the main solution was, but putting the
path for the known_hosts and the key in the command did the trick.
So this is my command now ssh -o UserKnownHostsFile=/config/.ssh/known_hosts -p 2022 [email protected] -i /config/.ssh/id_ed25519 sudo shutdown -h now
where user is my username and the xxx.xxx.xxx.xxx is my ip address of my HA server.