Skip to content

feat: allow aiming the Wake-on-LAN packet at another subnet - #185

Open
josedper wants to merge 1 commit into
madmicio:masterfrom
josedper:feat/wol-broadcast-address
Open

feat: allow aiming the Wake-on-LAN packet at another subnet#185
josedper wants to merge 1 commit into
madmicio:masterfrom
josedper:feat/wol-broadcast-address

Conversation

@josedper

@josedper josedper commented Sep 3, 2026

Copy link
Copy Markdown

The problem

A Wake-on-LAN magic packet is a broadcast, so it never leaves the subnet it was sent from. When Home Assistant and the TV live on different VLANs, the router drops the packet and the TV never wakes up.

What makes this confusing to diagnose is that turning the TV off keeps working, because that travels over the webOS socket as ordinary unicast. The power button looks half broken, and nothing in the logs explains why.

This is what #174 asks for.

The change

Two optional settings, passed straight through to wake_on_lan.send_magic_packet:

type: custom:lg-remote-control
entity: media_player.lg_webos_smart_tv
mac: 'xx:xx:xx:xx:xx:xx'
broadcast_address: 192.168.20.30   # the TV's own address

Leaving them unset builds the exact same service call as before, so existing single-subnet setups are unaffected.

Why unicast to the TV works

Aiming the packet at the TV's own address turned out to be the most reliable option: unicast is routed between VLANs, and the TV keeps its ARP entry while asleep, so the packet is delivered and wakes it.

The subnet broadcast address (192.168.20.255) also works, but only where the router forwards directed broadcasts, which is uncommon. Both are possible with this change; the README documents the trade-off.

Testing

Tested on a real two-VLAN setup — Home Assistant on one, an LG 65UM7050PLA on another:

  • Before: the TV would not wake from the card at all. Sending the same packet from a machine already inside the TV's VLAN woke it instantly, which is what pinned the fault on the routing rather than on the TV or its WoL settings.
  • After: wakes reliably from the card, with no scripts or automations, using only broadcast_address.
  • Power-off, and the rest of the buttons, unchanged.

Built with npm run build; no TypeScript errors.

Note for anyone hitting this before the change lands

Without it, setting mac makes the card call WoL directly and skip the keys override (#146), so remapping POWER to a custom script only works if mac is left unset.

A magic packet is a broadcast, so it never leaves the subnet it was sent
from. When Home Assistant and the TV sit on different VLANs the router drops
it and the TV never wakes, while turning the TV off keeps working because
that goes over the webOS socket as ordinary unicast. The power button looks
half broken and nothing in the logs explains why.

Adds optional broadcast_address and broadcast_port, passed straight through
to wake_on_lan.send_magic_packet. Leaving them unset produces the exact same
service call as before, so existing single-subnet configs are untouched.

Sending the packet unicast to the TV's own address turned out to be the most
reliable option: unicast is routed between VLANs and the TV keeps its ARP
entry while asleep, so it is delivered. A subnet broadcast address works too,
but only where the router forwards directed broadcasts, which is uncommon.

Tested on a real two-VLAN setup (HA on one, a 65UM7050PLA on another): the
TV would not wake before the change and wakes reliably after it, with no
extra scripts or automations.

Refs madmicio#174
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant