Trying to remote reboot raspberry pi with rasbian trough HA

My configuration:

  • platform: command_line
    switches:
    rpi3_spalnica:
    command_on: “ssh -i /root/.ssh/id_rsa [email protected] ‘reboot’”
    command_off: “ssh -i /root/.ssh/id_rsa [email protected] ‘reboot’”

I get error:
Command failed: ssh -i /root/.ssh/id_rsa [email protected] ‘reboot’

1 Like

Have you tried changing it to ‘sudo reboot’?

Here is an example from my config that works.

‘ssh -o StrictHostKeyChecking=no -i /config/shellcommands/id_rsa [email protected] sudo reboot’

Hi

Thanks for answers but I already try that both, always the same error.

I tray ssh to HA and executed the command form my configuration and it works great. I think problem is HA.

I using HA image from that link:
https://github.com/home-assistant/hassio-build/releases/download/1.1/resinos-hassio-1.1-raspberrypi3.img.bz2

My version is 0.62.0

I upgraded HA to 0.64.3. Error is still the same?

I get the same error:

Command failed: ssh -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa [email protected] sudo reboot

I figured out. I must copy id_rsa key from /root/.ssh/id_rsa to /config/.ssh/id_rsa.

Now both command working:

command_on: ‘ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [email protected] sudo reboot’
command_off: “ssh -i /config/.ssh/id_rsa [email protected] sudo reboot”

I found complete instruction on this link:
https://community.home-assistant.io/t/hass-io-shell-command-error/36312/16

2 Likes