UniFi Wake-on-LAN: Wake PCs on Other VLANs From Your UniFi Gateway

UniFi Wake-on-LAN: Wake PCs on Other VLANs From Your UniFi Gateway. AutoMatter

What happened

A community member has released a custom Home Assistant integration called UniFi Wake-on-LAN. It targets a familiar problem on split networks: Home Assistant’s built-in Wake-on-LAN only reaches its own broadcast domain, so a PC in a gaming or office VLAN never sees the magic packet. The author notes that directed broadcasts are fiddly and, in their words, UniFi gateways usually don’t forward them.

Instead of sending from Home Assistant, this integration asks the gateway to send the packet directly on the interface of the network where the client was last seen. The gateway is already in every VLAN, so no network changes are needed.

How it works

  • It reads clients (active and history) and networks from the UniFi Network API, read only.
  • The UniFi API has no Wake-on-LAN command, so on a button press it connects to the gateway over SSH, finds the right interface (the author’s example is br20) and sends the packet.
  • It uses the first tool the gateway offers: etherwake, ether-wake, busybox ether-wake, a raw Ethernet frame via python3, or as a last resort a temporary static ARP entry plus a UDP packet.
  • Each chosen client gets a Wake button and an Online sensor, which refreshes at 30, 60 and 120 seconds after a wake so you can see whether the PC came up.
  • An action, unifi_wol.wake, works with any MAC address and can optionally wait until the client is online, handy for automations that should only continue once the PC is reachable.

Setup is in the UI with no YAML. For now it installs as a custom repository in HACS; the author says it is waiting for review to be listed by default. The code is on GitHub and announced on the Home Assistant community forum.

What to check before you install

  • It needs root SSH on your gateway. The README says the SSH password grants root access and is stored in Home Assistant’s config entries storage. That is a real trade-off. The author pins the SSH host key and the gateway’s TLS certificate on first connect, and only runs a fixed address-listing command plus the wake script. Still, decide whether you are comfortable with it.
  • Tested on one gateway only. The author has only tried a UniFi Cloud Gateway Fiber. It is meant for other UniFi OS gateways (UCG Ultra/Max, UDM, UDM Pro/SE, UXG), but that is untested. The author is asking for testers.
  • Account requirements. You need a local UniFi OS account without 2FA (View Only is enough) and SSH enabled in the console settings, with a password.
  • SSH keys are not supported, on purpose, because the README says UniFi OS removes authorized_keys on firmware updates. Expect to re-check after gateway updates. If the host key or certificate changes, for example after a gateway reset, Home Assistant raises a repair showing the old and new fingerprints and only trusts the new ones once you confirm.
  • The PC still has to cooperate. Wake-on-LAN must be enabled in the BIOS/UEFI and the network adapter, and on Windows Fast Startup should be off. Over Wi-Fi it almost never works, so the integration marks Wi-Fi clients.

How it differs from other options

The built-in integration and the wake buttons in UniFi Insights both send from Home Assistant, so Home Assistant has to share a VLAN with the client. Giving Home Assistant an extra interface in every VLAN works but makes it part of every network. This one avoids both.

If you already run UniFi Insights, note that its page lists disabled-by-default Wake-on-LAN buttons for wired clients, so the two overlap on the same-VLAN case.

Our take

This is a neat fix for a real VLAN annoyance, and it is a young project: five commits and no stars at the time of the pages we read. If you segment your network and want to wake a workstation or media server from an automation, it is worth a trial on a gateway you can easily recover. If handing root SSH credentials to a community integration is a dealbreaker, the extra-interface approach remains the slower, more conventional route. We have not run it ourselves.

Sources