If i use Putty on my Windows computer to access my Raspi (hassio system), and then, from within the terminal on hassio execute these two commands:
ssh [email protected]
sudo poweroff
Then my HTPC turns off.
But when I try to use the switch I’ve set up, nothing happens.
What am I doing wrong?
It took me some time to get this to work. Since the instructions page above is not working anymore I hope these instructions will help the next person that tries to get this to work What I want to get out of this is the option to shutdown or restart a remote pi using a HA automation.
- On your HA open the terminal and give this command: ssh-keygen -t rsa -C "[email protected]" When it asks for the file path you want the key to be saved to use: /config/ssh_key
- Open the ssh_key.pub with a text editor and copy its content. - On the remote system edit the authorised keys file: sudo visudo ~/.ssh/authorized_keys - Insert the key from the ssh_key.pub and save the authorized_keys. - restart the ssh service on the remote machine sudo service sshd restart
- To test if this works go to the HA file editor, click the gear icon in the top right of the screen and select “execute shell command”. Try this command (with the correct IP address ofcourse): ssh -i /config/ssh_key [email protected] "hostname" This should return the hostname of your remote system.
In your config file you can now create a service for your shell command that can be used by your automations: </s></s> <s><s>shell_command:</s></s> <s><s> hyperion_shutdown: 'ssh -i /config/ssh_key [email protected] "sudo shutdown"'</s></s> <s><s> that part doesn’t work… yet