HA on 2 Raspberry Pi. How to reboot each other?

I have installed HA on 2 Raspberry Pis.

The reasons is I want to improve the reliability by separating out certain tasks and let them monitor each other so that when one HA is not functioning properly, the other HA will reboot it.

Now the separation part is working well except the rebooting part.

Any experts here know what is the right shell command to issue to reboot another Pi?

In 192.168.1.AAA, I’ve tried…

shell_command:
  reboot_hass: ssh [email protected] 'echo [password] | sudo shutdown -r now'

…and then called the service shell_command.reboot_hass but it doesn’t work.

When I login to 192.168.1.AAA via SSH and execute the same command, it asked for password.

Please advice. Thanks.

I would try doing a passwordless ssh login using the root user. Generate ssh keys for root using ssh-keygen. A google search should get you going.

1 Like