WOL-proxy is a dockerized Wake-On-LAN tool that received commands to send Wake-On-LAN magic packets over MQTT. This allows a computer to be woken on a network where a WOL packet would not normally reach (remote site, etc.)
The script can be run using docker (takes care of all dependencies) or standalone. It is design to run on Raspberry Pi or equivalent.
-
Have a MQTT broker you can connect to. I use Mosquitto.
-
Run the container or script using instructions below.
-
Publish to the mqtt topic,
WOL-proxy/command
, with the MAC address of the computer you wish to wake. The following formats are acceptable:ab-cd-ef-01-23-45
,ab:cd:ef:01:23:45
,ab.cd.ef.01.23.45
,abcdef012345
. An example Home Assistant config is provided.By default, WOL-proxy accepts messages on the
WOL-proxy/command
mqtt topic. TheWOL-proxy
prefix can be changed by setting theMQTT_TOPIC_PREFIX
environment variable. WOL-proxy will then listen for messages on[MQTT_TOPIC_PREFIX]/command
. Note that adding a trailing/
toMQTT_TOPIC_PREFIX
will create an empty level.Value of MQTT_TOPIC_PREFIX mqtt command topic WOL-proxy
WOL-proxy/command
switches/remoteLAN
switches/remoteLAN/command
switches/remoteLAN/
switches/remoteLAN//command
WOL-proxy will report its status on the [MQTT_TOPIC_PREFIX]/status
topic via retained messages. WOL-Proxy reports Online
once it connects to the broker. Upon disconnect, the broker will report Offline
.
Pull the image. The latest
tag has multiarch support, so it should pull the correct image for your system.
docker pull seanauff/wol-proxy
Start the container with all default environment variables:
docker run -d --net=host --name=WOL-proxy seanauff/wol-proxy
Start the container with modified environment variables:
docker run -d --net=host --name=WOL-proxy -e MQTT_BROKER_HOST=<host> -e WOL_BROADCAST_ADDR=<broadcast> seanauff/wol-proxy
Note: Container needs to run with host networking in order to send the broadcast packets correctly!
Variable | Default Value | Notes |
---|---|---|
MQTT_BROKER_HOST | 127.0.0.1 | IP or hostname of MQTT broker |
MQTT_BROKER_PORT | 1883 | Port of MQTT broker |
MQTT_CLIENT_ID | WOL-proxy | Change this if the default is already in use by another client |
MQTT_USERNAME | Username for connecting to MQTT broker when using auth. TLS not currently supported | |
MQTT_PASSWORD | Password for connecting to MQTT broker when using auth. TLS not currently supported | |
MQTT_TOPIC_PREFIX | WOL-proxy | The first level(s) of the topic for the proxy to subscribe ([prefix]/command) and provide status ([prefix]/status) |
MQTT_QOS | 1 | QOS level to use to subscribe to command topic |
WOL_BROADCAST_ADDR | 255.255.255.255 | Change to the local broadcast IP for best results |
Clone the repository and build the image:
git clone https://github.com/seanauff/WOL-proxy.git
docker build -t seanauff/wol-proxy WOL-proxy
This project uses the following libraries:
Install them with:
pip install paho-mqtt wakeonlan