Turn on Diskstation with Wake On Lan
We can use Wake on Lan to turn of the diskstation by a network message.
Diskstation configuration
First we need to enable Wake on Lan on our diskstation:
- Login into your Diskstation
- Go to Control Panel > Hardware & Power > General
- Under
Power Recovery
activateEnable WOL on Lan
After that you are able to start your Diskstation over the network. e.g. on a Mac you could run following command in the terminal:
# Install wakeonlan command via brew brew install wakeonlan # Wake up diskstation by using its MAC Address wakeonlan XX:XX:XX:XX:XX:XX
Note: For sending a magic package via wakeonlan you can specify an ip:
-i ip_address set the destination IP address default: 255.255.255.255 (the limited broadcast address)
This is NOT the ip-address of your device, this is the broadcast address. Your device is identified by the mac address.
Home Assistant Configuration
Now we need to send this magic package from Home Assistant. This can be done with the Wake on LAN integration. It allows to add a switch which sends the packages when it is turned on. We just need to supply the mac address of our diskstation in the configuration. My configuration looks like this:
switch: - platform: wake_on_lan mac: XX:XX:XX:XX:XX:XX host: "192.168.179.30" name: "Diskstation" turn_off: service: button.press target: entity_id: button.diskstation_shutdown
The host
parameter contains the ip of the diskstation, so it can check if the diskstation is online or not. For more details see the integration documentation.
Turning off Diskstation
Edit the Entities Card Configuration.
entities: - entity: switch.dh_nas02_2 - entity: sensor.shelly_shplg_s_dbf519_current_consumption - entity: switch.dh_nas01 - entity: sensor.shelly_shplg_s_2021da_current_consumption - entity: sensor.shelly_shplg_s_dc4440_current_consumption show_header_toggle: false title: Wake On Lan type: entities
Now you can power on and off your Diskstation with Home Assistant.
