Running a shell command from Home Assistant to remote linux PC

You’ve got some extra quotes there - don’t put quotes around [email protected] sudo /sbin/shutdown -h now:

switch:
  - platform: command_line
    switches:
      octoprint_switch:
        command_on: "ssh -i /config/ssh_keys/NewPrivateKey2.ppk -o StrictHostKeyChecking=no [email protected] sudo /sbin/shutdown -h now"
1 Like