Wake on LAN

The wake_on_lan integration enables the ability to send magic packets to Wake on LAN capable devices to turn them on.

There is currently support for the following device types within Home Assistant:


To use this integration in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry

Integration services

Available services: send_magic_packet.

Service wake_on_lan.send_magic_packet

Send a magic packet to wake up a device with ‘Wake-On-LAN’ capabilities.

Service data attribute Optional Description
mac no MAC address of the device to wake up.
broadcast_address yes Optional broadcast IP where to send the magic packet.
broadcast_port yes Optional port where to send the magic packet.

Sample service data:

This usually only works if the Target Device is connected to the same network. Routing the WakeOnLan packet to a different subnet requires a special configuration on your router or may not be possible. The Service to Route the packet is most likely named "IP Helper" which may support WakeOnLan, but not all Routers support this.


The wake_on_lan (WOL) switch platform allows you to turn on a WOL enabled computer.

Switch configuration

The WOL switch can only turn on your computer and monitor the state. There is no universal way to turn off a computer remotely. The turn_off variable is there to help you call a script when you have figured out how to remotely turn off your computer. See below for suggestions on how to do this.

It’s required that the binary ping is in your $PATH.

To enable this switch in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
  - platform: wake_on_lan
    mac: MAC_ADDRESS

Configuration Variables

mac string Required

The MAC address to send the wake up command to, e.g, 00:01:02:03:04:05.

name string (Optional, default: Wake on LAN)

The name of the switch.

host string (Optional)

The IP address or hostname to check the state of the device (on/off). If this is not provided, the state of the switch will be assumed based on the last action that was taken.

turn_off string (Optional)

Defines an action to run when the switch is turned off.

broadcast_address string (Optional, default:

The IP address of the host to send the magic packet to.

broadcast_port integer (Optional)

The port to send the magic packet to.


Here are some real-life examples of how to use the turn_off variable.

Suspending Linux

Suggested recipe for letting the turn_off script suspend a Linux computer (the target) from Home Assistant running on another Linux computer (the server).

  1. On the server, log in as the user account Home Assistant is running under. In this example it’s hass.
  2. On the server, create SSH keys by running ssh-keygen. Just press enter on all questions.
  3. On the target, create a new account that Home Assistant can ssh into: sudo adduser hass. Just press enter on all questions except password. It’s recommended using the same user name as on the server. If you do, you can leave out hass@ in the SSH commands below.
  4. On the server, transfer your public SSH key by ssh-copy-id hass@TARGET where TARGET is your target machine’s name or IP address. Enter the password you created in step 3.
  5. On the server, verify that you can reach your target machine without password by ssh TARGET.
  6. On the target, we need to let the hass user execute the program needed to suspend/shut down the target computer. Here is it pm-suspend, use poweroff to turn off the computer. First, get the full path: which pm-suspend. On my system, this is /usr/sbin/pm-suspend.
  7. On the target, using an account with sudo access (typically your main account), sudo visudo. Add this line last in the file: hass ALL=NOPASSWD:/usr/sbin/pm-suspend, where you replace hass with the name of your user on the target, if different, and /usr/sbin/pm-suspend with the command of your choice, if different.
  8. On the server, add the following to your configuration, replacing TARGET with the target’s name:
  - platform: wake_on_lan
    name: "TARGET"
      service: shell_command.turn_off_TARGET

  turn_off_TARGET: "ssh hass@TARGET sudo pm-suspend"