Automation will not accept MAC address

Hello. Wondering if somebody could assist, please?

I am attempting to integrate my TVs (LG) into Home Assistant. The bedroom TV integrated with no problems and I was able to create a remote control dashboard. I was also able to turn on the TV through “wake on lan: send magic packet” action.

I have integrated the lounge TV but cannot create a “wake on lan: send magic packet” action to turn on the TV. This does not work at all.

I noticed in YAML that the last 2 digits of the MAC address are in red colour. I have tried altering the MAC address, in YAML, by using capital letters, using single quotation marks, double quotation marks. It remains red.

Here is the YAML code:

I can stop the last 2 digits showing red colour, and turn it to white, if the digit ‘7’ is changed to a letter instead of a number. Any number keeps it red.

I have checked the log details in the assistant core and it shows this code:

Logger: homeassistant.components.automation.turn_on_miro_lounge_tv_with_wakeonlan
Source: helpers/script.py:524
integration: Automation (documentation, issues)
First occurred: 17:44:13 (3 occurrences)
Last logged: 17:46:25

Turn On Miro Lounge TV with WakeOnLan: Error executing script. Unexpected error for call_service at pos 1: Incorrect MAC address format
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 524, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1008, in _async_step_call_service
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<9 lines>...
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 624, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2794, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2837, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/wake_on_lan/__init__.py", line 54, in send_magic_packet
    await hass.async_add_executor_job(
        partial(wakeonlan.send_magic_packet, mac_address, **service_kwargs)
    )
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.13/site-packages/wakeonlan.py", line 56, in send_magic_packet
    packets = [create_magic_packet(mac) for mac in macs]
               ~~~~~~~~~~~~~~~~~~~^^^^^
  File "/usr/local/lib/python3.13/site-packages/wakeonlan.py", line 31, in create_magic_packet
    raise ValueError("Incorrect MAC address format")
ValueError: Incorrect MAC address format

Any thoughts would be much appreciated.

Thank you for your time reading this.

Miro

Wrap the address in single-quotes.

  - action: wake_on_lan.send_magic_packet
    data:
      mac: '00:a1:59:bd:26:72'
1 Like

Thank you, tried that but no fix.

In my case, wrapping it in quotes eliminated the display of the last two characters in red.

Did it not do the same for you?

Or do you mean the action itself continues to fail?


EDIT

Known issues with Wake On LAN integration

1 Like

Can you clarify, were you able to get wake_on_lan automation to work for one TV but not a second TV?

Also the YAML editor has a red vertical line, which usually indicates an indention error somewhere (but I don’t see where).

1 Like

When I do as you suggest, it wraps the MAC address in green and removes the red characters. However, the action itself still does not work. When I go back into the YAML the quotations have disappeared and the 2 last characters have returned to red.

Thanks for your suggestion, any other ideas?

Tested this and it works…


alias: m1
description: ""
triggers:
  - device_id: 0ff094014fa6ebcb7985ae23ba094c6a
    domain: webostv
    type: webostv.turn_on
    metadata: {}
    trigger: device
conditions: []
actions:
  - action: wake_on_lan.send_magic_packet
    metadata: {}
    data:
      mac: 7c:64:6c:c2:94:87
mode: single

The red is normal

1 Like

Thanks for the message. Yes, it works on the first TV. No problems with the MAC address being accepted for that TV, although I notice that the last 2 characters starts with a letter and not a number.

If I change the problematic MAC address last 2 characters to start with a letter then the red colour disappears. It seems to be not accepting the penultimate character being a number.

I checked the YAML for the working TV and it shows the same red vertical line but continues to work.

Thanks for your comments, any further thoughts?

Are you positive on the mac address?

Thanks for this. I initiated the “wake on LAN: send magic packet” in the actions tab of the developer tools. Put the MAC address in (ignored the 2 last red characters as you, helpfully, told me it was normal – thank you).

Performed the action and he came up with a tick but nothing happens on the TV.

Test using port 7 or 9

actions:
  - action: wake_on_lan.send_magic_packet
    metadata: {}
    data:
      mac: 00:a1:59:bd:26:72
      broadcast_port: 9
1 Like

Thank you for your support and patience. Please forgive me, it was a mistake on my end. I completely forgot to “wake on LAN” on the TV settings. I did this for the bedroom TV but completely forgot about the lounge TV.

I am very new to Home Assistant and that is the excuse I am sticking to!

I have turned on the “wake on LAN”. It works fine now. Out of interest, if anybody knows, what does the network IP control (on the TV) setting do? Should I keep it on?

Thanks again for your patience and support.

It allows control over an IP network, so yes…

1 Like

For future reference, what you observed was one of several quirks of the Automation Editor. It formats YAML according to its own rules and will sometimes undo things you did.

Even flagging the last two numeric characters in the address in red is a quirk (ostensibly identifying a problem where none actually exists).

When helping users with their problems, there are some questions that are so basic (Is it plugged in? Is there power? Is the feature enabled?) that they aren’t asked because it’s assumed they may cause the user to become frustrated or insulted. Perhaps that’s a risk we need to take and ask them anyways.

It allows you to control your TV by sending it commands via your LAN. There’s an integration for it called LG webOS TV.

Of particular interest to your situation, it mentions the following in its Troubleshooting section:

WAKEONLAN DOES NOT WORK

On newer models (2017+), WakeOnLan may need to be enabled in the TV settings by going to Settings > General > Mobile TV On > Turn On Via WiFi instructions.

I don’t know if the menu path described in the docs matches your specific model but the gist is that you must ensure the WakeOnLan feature is enabled.

Extremely helpful - thank you. I’ll never, personally, be frustrated with type or depth of question. Learning to progress individual or collective knowledge is paramount and I never see it as reflecting inadequacy.

1 Like