Turn on/off UnRaid Server from Hassio & Voice Assistant

Thanks for the great writeup. Does anyone know how to keep the switch in sync with the actual Unraid state?
For example, if I have switched Unraid on/off manually, how will the switch be updated?

Hi, Have you found a solution? I’m having same issue with the command fail. Running docker HA supervised on Rpi

You could add a command_state to the switch that can tell HA what state the switch (or UnRAID) is in.
Some command that you could run to show if the server is on or off. (Ping maybe?)

command_state string (optional)
If given, this command will be run. Returning a result code 0 will indicate that the switch is on

Thanks for the suggestion here is my updated code that works with Unraid 6.9.2

I created the unraid public and private keys directly in the /root/.ssh/ directory unlike the beginning of the tutorial.

# Unraid On/Off Switch
switch:
  - platform: wake_on_lan
    mac: "XX:XX:XX:XX:XX:XX"
    name: unraid
    host: 192.168.X.XX
    broadcast_address: 255.255.255.255
    turn_off:
        service: switch.turn_off
        entity_id: switch.server_off

  - platform: command_line
    switches:
      server_off:
        command_on: switch.unraid
        command_off: "ssh -i /root/.ssh/unraid -o StrictHostKeyChecking=no [email protected] '/usr/local/sbin/powerdown'"
        command_state: ping -c 1 192.168.X.XX
1 Like