WOL and SOL in Home Assistant
Introduction
Using Sleep-On-Lan allows you to very easily expand upon Home Assistant’s built in Wake-On-Lan functionality. Once integrated properly, you can fully put a computer to sleep, wake it, and monitor its status.
Installation
To begin, confirm your computer has WOL enabled— either in the BIOS or by adjusting your network adapter settings. After you’ve installed SOL on your target machine, and you’re familiar with Home Assistants Wake On LAN functionality, create a new entry in your configuration.yaml
:
wake_on_lan:
switch:
- platform: wake_on_lan
name: Desktop PC
mac: "33:33:33:33:33:33"
broadcast_address: "10.0.0.000"
host: "10.0.0.000:8009"
turn_off:
service: wake_on_lan.send_magic_packet
data:
mac: "33:33:33:33:33:33"
broadcast_address: "10.0.0.000"
Fill out the top half of the wake_on_lan switch as usual, giving it the name
you prefer, the IP address of the device under broadcast_address
and the magic packet in the mac
field.
You can find all of this information on the page generated by the SOL installation as well as the reverse mac address for the sleep functionality.
Under the turn_off
section, we set our service: wake_on_lan.send_magic_packet
. After it, we put the reverse magic packet in the mac
field, as well as the IP address of the device under broadcast_address
.
To enable the switch to check the status of the device, set its IP address again in the host
field. Otherwise, the switch will assume the state depending on the switches last action.
Update
I recently had some issues with the reverse mac address solution. I still can’t fully figure it out, truthfully. In the meantime, I’m using this as a solution:
# WOL/SOL
wake_on_lan:
switch:
# WOL/SOL
- platform: wake_on_lan
name: "desktop pc"
mac: "ac:1f:6b:7e:e9:df"
broadcast_address: "10.0.0.186"
host: "10.0.0.186:8009"
turn_off:
service: shell_command.sol
Elsewhere, I have “sol” defined like this:
shell_command:
sol: "curl http://10.0.0.186:8009/sleep"
Comments