Sign inSign up

seanauff/wol-proxy

By seanauff

•Updated over 2 years ago

Proxy that sends Wake On LAN magic packets to local network after receiving specific MQTT message

Image
0

10K+

seanauff/wol-proxy repository overview

⁠WOL-proxy

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.

⁠Usage

  1. Have a MQTT broker you can connect to. I use Mosquitto⁠.

  2. Run the container or script using instructions below.

  3. 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. The WOL-proxy prefix can be changed by setting the MQTT_TOPIC_PREFIX environment variable. WOL-proxy will then listen for messages on [MQTT_TOPIC_PREFIX]/command. Note that adding a trailing / to MQTT_TOPIC_PREFIX will create an empty level.

    Value of MQTT_TOPIC_PREFIXmqtt command topic
    WOL-proxyWOL-proxy/command
    switches/remoteLANswitches/remoteLAN/command
    switches/remoteLAN/switches/remoteLAN//command
⁠Status Messages

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.

⁠Running via Docker

Pull the image. If using raspberry pi or similar use arm in place of [tag]. The latest tag will pull the amd64 image:

docker pull seanauff/wol-proxy:[tag]

Start the container with all default environment variables:

docker run -d --net=host --name=WOL-proxy seanauff/wol-proxy:[tag]

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:[tag]

Note: Container needs to run with host networking in order to send the broadcast packets correctly!

⁠Environment Variables
VariableDefault ValueNotes
MQTT_BROKER_HOST127.0.0.1IP or hostname of MQTT broker
MQTT_BROKER_PORT1883Port of MQTT broker
MQTT_CLIENT_IDWOL-proxyChange this if the default is already in use by another client
MQTT_USERNAMEUsername for connecting to MQTT broker when using auth. TLS not currently supported
MQTT_PASSWORDPassword for connecting to MQTT broker when using auth. TLS not currently supported
MQTT_TOPIC_PREFIXWOL-proxyThe first level(s) of the topic for the proxy to subscribe ([prefix]/command) and provide status ([prefix]/status)
MQTT_QOS1QOS⁠ level to use to subscribe to command topic
WOL_BROADCAST_ADDR255.255.255.255Change to the local broadcast IP for best results
⁠Build the image yourself

Clone the repository and build the image:

git clone https://github.com/seanauff/WOL-proxy.git
docker build -t seanauff/wol-proxy WOL-proxy

⁠Other Install Methods

⁠Dependencies

This project uses the following libraries:

Install them with:

pip install paho-mqtt wakeonlan

Tag summary

Content type

Image

Digest

sha256:c22e4aa22…

Size

42 MB

Last updated

over 2 years ago

docker pull seanauff/wol-proxy