LG WebOS wake-on-lan

I put this in my config

switch:
  platform: wake_on_lan
  name: lg
  mac_address: hi-dd-en-ma-c0
    
media_player:
  - platform: webostv
    host: 192.168.1.102
    name: TV
    mac_address: hi-dd-en-ma-c0
    turn_on_action:
      service: switch.turn_on
      entity_id: switch.lg

But it will not turn on :frowning:

Could it be that the TV does not support WOL? It is 2015 year OLED, i think.

Edit: TV does not anwer to ping when in standby but don’t know if it even should.

I am able to turn on the TV with Chromecast. Could that be used as a switch to turn in on?

Does the LG app work (https://play.google.com/store/apps/details?id=com.lge.app1&hl=en_GB) ? If you can turn tv on with that then your TV probably does support WOL.

If I turn TV off from the app, it just says that connection lost to the TV and does not find it again until I turn TV on.

I was thinking on making a script that turns the TV on with chromecast since that is doable from the HA gui ATM. And then create an automation that changes the source to “Live TV” when TV is on.

According to LG, my TV does not support WOL. Turn on actually works like 2 minutes after turn off but most likely the TV turns off network stack soon after that :frowning:

So my best option is to use Chromecast and then change the source in automation or something like that.

Does anyone know how to call the service turn on of media player in HA in script?

This works for me, Thanks!

Followed official docs and didn’t work.
Turned on every feature I found on my TV, and didn’t work. And it seemed weird to me that my TV did not support WOL since it’s relatively new (2017) and a good model (4K w/ HDR+ etc)…

Followed your suggestion and it now works fine (both ON and OFF features) from HA:

# LG TV
media_player:
  - platform: webostv
    host: 192.168.xxx.yyy
    name: LG TV
    timeout: 5
    turn_on_action:
      service: switch.turn_on
      entity_id: switch.lg

switch:
  - platform: wake_on_lan
    name: lg
    mac_address: "aa:bb:cc:dd:ee:ff"

Remember to change your IP address and MAC to match your TV’s.

Also I read somewhere that, if running HA in Docker, then you need to start your container with --net=host. After some testing I can confirm this is correct. If network_mode is bridged WOL won’t work.

Hope this helps. It was driving me nuts for a while.

Cheers.

2 Likes

Thanks, this fixed the issue for me too (which had been bugging me for me ages).

Hi, I’ve been trying to run this config for my LG model (2016 4k one) but none of them seems to work (the switch configuration workaround).
Anyone there still with the same problem?

newbie here, so I assume that this is in addition to the webostv config piece that defines sources etc.

My challenge is how to configure for 2tvs?

This worked for me

wake_on_lan: # enables `wake_on_lan` domain

webostv:
  host: 192.168.0.10
  #other settings
  turn_on_action:
    service: wake_on_lan.send_magic_packet
    data:
      mac: AA-BB-CC-DD-EE-FF
      broadcast_address: 11.22.33.44

media_player:

notify:

Here’s the link for webostv integration

Am I missing something here? LG C9 and I can’t get it to turn on via HA. I have the ThinQ app downloaded and can turn it on from there no problems… I can only get HA to turn it off using the below…

wake_on_lan: # enables `wake_on_lan` domain
webostv:
  host: 192.168.0.10
  name: Living Room TV
  turn_on_action:
    service: wake_on_lan.send_magic_packet
    data:
      mac: AA-BB-CC-DD-EE-FF
      broadcast_address: 11.22.33.44
  customize:
    sources:
      - Plex
      - Netflix
      - YouTube
      - Live TV
media_player:
notify:

Executing a turn on function produces the following in the HA logs:

2020-09-24 22:50:13 INFO (MainThread) [homeassistant.helpers.script.living_room_tv] Living Room TV: Running webostv script
2020-09-24 22:50:13 INFO (MainThread) [homeassistant.helpers.script.living_room_tv] Living Room TV: Executing step call service
2020-09-24 22:50:13 INFO (MainThread) [homeassistant.components.wake_on_lan] Send magic packet to mac AA-BB-CC-DD-EE-FF (broadcast: 11.22.33.44, port: None)

And nothing happens :frowning: so obviously the MAC is my TV Mac Address, but what should the 11.22.33.44 address be? And do we need to define a port?

EDIT: After reading through some HA isues, I found Issue #36231 which suggest turning on HA while the TV is ON, which resolves the issue.

Possibly. I know that, at least the very first time, the TV has to authorize Home Assistant (you get a popup on the TV) to remote control it. Now, whether you need the TV on first or not…I do not know. Theoretically HA pulls constantly its components…so I dunno.

Then, remember that for WOL to work, you need to run HA directly on “bare metal” or if in docker, it must be using a “host” network container.

Hope this helps

0.115.3 fixed this issue.

I know this is old but I just finished setting mine up and trouble with this… then I got it and went through the SAME troubles with my other TV… I figured I would post here in case anyone has issues and finds this thread.

TV1: LG 43UJ63 43" 4K WebOS from September 2017
"About This TV" Menu Software Version: 06.00.03

TV2: LG 55UM69 55" 4K WebOS from  September 2019
"About This TV" Menu Software Version: 05.10.05

NOTE: Both TVs are updated as of today. (June 30, 2021) Strange thing is the older TV updated to a higher firmware version, but both say no updates available now.

NOTE 2: I have no idea if it is relevant or not, but the OS looks the same on both TVs (colors, menu structure, images, etc) and has since Day 1, except a few little differences:

  1. When you push the settings button on the remote, a little “basic menu” pops up with circle icons. On TV1 that appears on the right. On TV2 it appears on the left. Both have the same items listed, and clicking “All Settings” opens the real menu on the left on both.

  2. In the TV1 Network menu there is “LG Connect Apps” with a toggle for On/Off and nothing else. In the TV2 Network menu there is no “LG Connect Apps” menu, but there is a “Mobile TV On” menu and it has a toggle for “Turn On Via WiFi”. These are turned on on mine.

CODE:
Placed in configuration.yaml:

switch:
  - platform: wake_on_lan
    name: living_room_main_turnon
    host: 10.0.0.130
    "mac": "xx:xx:xx:xx:xx:xx"
    broadcast_address: 10.0.0.255

webostv:
  - name: Living Room Main
    host: 10.0.0.130
    turn_on_action:
      service: switch.turn_on
      entity_id: switch.living_room_main_turnon
    customize:
      sources: []
  - name: Bedroom Main
    host: 10.0.0.110
    turn_on_action:
      service: wake_on_lan.send_magic_packet
      data:
        "mac": "xx:xx:xx:xx:xx:xx"
        "broadcast_address": "10.0.0.255"
    customize:
      sources: []

Notice that TV2 (Living Room) required the technique of creating a switch with platform: wake_on_lan and the field for MAC Address has the key AND the value in quotes. It did not work without the quotes. Mine also did not work without the broadcast address. For MOST home networks you have a subnet of 255.255.255.0 and if yours is then your broadcast address will be just like your IP address except the last octet will be 255. (For example: if your IP is 10.0.0.xx, your broadcast address for the network is 10.0.0.255. If your IP Address is 192.168.1.xx, broadcast is 192.168.1.255, etc) Mine did not work without the broadcast address. This did NOT work at all on TV1.
Notice TV1 uses the technique where you can just add a turn_on_action calling service wake_on_lan.send_magic_packet (Note that it now has .send_magic_packet appended to the end where for the switch it only needed to call the ‘wake_on_lan’ object) and then attach a data object with the fields for "mac" and broadcast_address following the same guidelines as shown for TV2. This did NOT work for TV2.

Looking around there were so many different answers from so many different years. It is not as relevant which version of HA as it is which TV and firmware it is. Don’t judge based on post date, try both ways and if you have multiple TVs and one just wont work try making that one the other way and that just might do it!!

5 Likes

Thank you, working like a charm <3

2 Likes

Just wanted to reply to say thank you,

Watch 5 youtube videos and couldnt get my newer LG to work, the Switch method seemed to work when written into config.yaml

# TV
switch:
  - platform: wake_on_lan
    name: Bedroom_LG_TV_turnon
    host: 00.00.00.191
    "mac": "XX:XX:XX:XX:XX:XX"
    broadcast_address: 00.00.0.255

webostv:
    host: 00.00.00.191
    name: Bedroom LG TV
    turn_on_action:
      service: switch.turn_on
      entity_id: switch.Bedroom_LG_TV_turnon
    customize:
      sources:
        - AV
        - All 4
        - Amazon Prime Video
        - BBC iPlayer
        - Component
        - DuplexPlay
        - HDMI 1
        - HDMI 2
        - HDMI 3
        - ITV Hub
        - LG Content Store
        - Live TV
        - Music
        - My5
        - NOW
        - Netflix
        - Photo & Video
        - Rakuten TV
        - Sky Store
        - Web Browser
2 Likes

Glad it worked for you!

Guyz,
just out of curiosity. I know that its different thread but when i open netflix it is asking for profile to choose. So basicaly i cant control it from the home assistant. just change the sources. Do you have solution how to control it? Or must use their app?

You’ll need to write a script and execute it from a button on the dashboard

Can be done through GUI or scripts.yaml

rumpus_tv_enter:
  alias: Rumpus TV Enter
  sequence:
  - service: webostv.button
    data:
      entity_id: media_player.rumpus_room_tv
      button: ENTER
  mode: single

Known possible values are LEFT, RIGHT, DOWN, UP, HOME, MENU, BACK, ENTER, DASH, INFO, ASTERISK, CC, EXIT, MUTE, RED, GREEN, BLUE, VOLUMEUP, VOLUMEDOWN, CHANNELUP, CHANNELDOWN, PLAY, PAUSE, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

2 Likes

I wasn’t able to get my TV to turn on. I didn’t add one line from the full example to my configuration.yaml file and even though it doesn’t sound like it has anything to do with WOL it is what made mine work in the end.

media_player: