From 38f367b47a1ddf6b37980a9efbcee4a4030ea438 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sun, 12 Jun 2022 18:26:05 -0700 Subject: [PATCH] Documentation updates. --- README.md | 25 ++++++++++++++++++++++--- run.sh | 2 +- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 56fd41c..306c28c 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,8 @@ send a wake-on-lan packet to. It expects plain TCP requests, not HTTP. ## Environment variables - * `PORT`: The TCP port to listen on for wake-on-lan requests, defaults to 18888. + * `PORT`: The TCP port to listen on for wake-on-lan requests, defaults to + 18888. Don't forget to open this port in your firewall. ## Example @@ -60,7 +61,7 @@ From within another container running on a Docker bridge network (so, no need to run on the host network), execute: ```bash -echo "00:00:0A:BB:28:FC" | nc -N host.docker.internal 18888 +echo 00:00:0a:bb:28:fc | nc -N host.docker.internal 18888 ``` This example uses the OpenBSD netcat variant to send a TCP packet containing @@ -73,12 +74,30 @@ host.docker.internal:host-gateway ...`. Or, with Docker Compose: ```yaml extra_hosts: - - "host.docker.internal:host-gateway" + - "host.docker.internal:host-gateway" ``` Alternatively, on Linux, you can try using the IP `172.17.0.1`. +### Home Assistant + +If you happen to be using Home Assistant, here's how you might request +wake-on-lan of a remote server via wake-on-lan-service. This example is of an +automation action in your Home Assistant configuration: + +``` +automation: + - alias: my automation + trigger: ... + action: + - service: shell_command.wake_my_server + +shell_command: + wake_my_server: "echo 00:00:0a:bb:28:fc | nc -N host.docker.internal 18888" +``` + + ## Security Note that no authorization is performed on the service request, so be aware diff --git a/run.sh b/run.sh index 7733c4e..eacd1c6 100755 --- a/run.sh +++ b/run.sh @@ -3,6 +3,6 @@ set -u while true; do - mac=$(nc -l -p "$PORT" | sed 's/[^a-f0-9:]//g') + mac=$(nc -l -p "$PORT" | sed 's/[^a-fA-F0-9:]//g') awake "$mac" done