Turn On LG TV Via Wifi

Is anyone able to turn on their LG TV that is connected via WFI from HA? There isn’t even a power button on my Lovelace card. I looked at this and found

webostv:
  host: 192.168.0.10
  name: Living Room TV
  turn_on_action:
    service: persistent_notification.create
    data:
      message: "Turn on action"

Seemed strange to use that service but I added it to my config and it gave me a power button.Pressing the power button gave me a notification as expected. In Services I found the webostv.button and chose my TV entity but in the list of known possible values (LEFT, RIGHT, DOWN, UP, HOME, BACK, ENTER, DASH, INFO, ASTERISK, CC, EXIT, MUTE, RED, GREEN, BLUE, VOLUMEUP, VOLUMEDOWN, CHANNELUP, CHANNELDOWN, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, LEFT), there is no power button. Tried using the POWER command but it didn’t do anything. I don’t have the option of using Ethernet on this TV so was hoping I could find a way to make this work. FWIW I can turn off the TV from the Lovelace card.

You could try the wake on lan approach detailed here. It’s worth checking that the TV can be switched on using LG’s own app first.

Scroll down a bit on that page and there’s an example to turn on the TV with WOL

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

I will give this a go. I thought wake_on_lan only worked if connected via an Ethernet cable. In fact right above the config you posted it says:

Common for webOS 3.0 and higher would be to use WakeOnLan feature. To use this feature your TV should be connected to your network via Ethernet rather than Wireless.

Any idea how to find the broadcast_address?

Just tried the app and the TV needs to be on before the app can connect to it which makes it useless for what I need it for. Once the TV is on and the app is connected everything else works great.

When I was last looking at this I fiddled with the config for a while and failed to get it working. I then tried the LG app, which just shows ‘TV Disconnect’ when the TV is off, so assumed at that stage that my TV did not support WOL and gave up. However, on a whim I tried again this morning and it works. I’m not sure what’s changed in the meantime, and this is despite the LG app still showing ‘Disconnect’.

I’m running HA Core 0.110.3 in Docker, connected via a macvlan network.

My working config:

wake_on_lan:

webostv:
  host: !secret tv_ip_address
  name: Sitting Room TV
  turn_on_action:
    service: wake_on_lan.send_magic_packet
    data:
      mac: !secret tv_mac_address

Mine only works with the broadcast address added. I found it from a post in here. I assumed it was the IP of the TV but it wasn’t.

I also have a Samsung and could not get it working reliably. I ended up adding an ir eye running off an nodemcu and using a power plug to detect it’s power state. Just an option if it won’t work off WiFi.

Just added new LG to my setup couple days ago.
Everything working as expected.
In configuration.yaml file “wake_on_lan:” must be included before you include LG configuration.
“broadcast_address:” must be used in order to “wake on lan” to work.
Broadcast address is not TV IP Address, a broadcast address is an IP address that is used to target all systems on a specific subnet network instead of single hosts. In other words broadcast address allows information to be sent to all machines on a given subnet rather than to a specific machine.

This is the post that shows how to find your broadcast address:

I saw that post and ran ip addr in the terminal of Home Assistant but it doesn’t have a wlan0 which doesn’t surprise me because I’m not running HA on a pi but rather through VirtualBox on Windows 10. Do you know how to access the broadcast address in this arrangement?. I asked the poster (FreelancerJ) this question too but haven’t heard back yet. I tried ipconfig and netstat via the cmd. For grins I tried 192.168.1.255 as my host is the same as his but it didn’t work.

You need broadcast IP address on network where your TV is.
If your TV IP is 192.168.1.xxx then broadcast is 192.168.1.255

1 Like

I tried that but it didn’t work for me. I’ll try again. My TV ip is 192.168.1.xxx.

Make sure in configuration.yaml file “wake_on_lan:” included before you include LG configuration.
Like:
wake_on_lan: !include include/wake_on_lan.yaml
webostv: !include include/webostv.yaml

My config is in alphabetical order so that is correct by default. My webostv config is

- host: 192.168.1.73
  name: Exercise Room TV
  turn_on_action:
    service: wake_on_lan.send_magic_packet
    data:
      mac: 08:12:A5:B0:41:7C
      broadcast_address: 192.168.1.255
- host: 192.168.1.40
  name: Office TV
  turn_on_action:
    service: wake_on_lan.send_magic_packet
    data:
      mac: 48:8D:36:C4:7D:C6
      broadcast_address: 192.168.1.255

The ip’s and mac addresses are correct but still not working on 2 different TV’s

Did you turn ON “Mobile TV On” on TV setting.
My TV hard wired not WIFI connected. “Mobile TV On” on TV setting.
Also “LG Connect Apps” must be ON, on TV setting

Yes. I can connect to the TV via the LG app on my phone so those must be enabled.

Did you accept the pairing request from HA on your TV?

Yes. I can turn the TV of through HA just can’t turn it on.

This is my working configuration via wifi

- platform: webostv
  host: 192.168.1.xxx
  name: LG_TV
  filename: webostv.conf
  timeout: 5
  turn_on_action:
    service: wake_on_lan.send_magic_packet
    data:
      mac: XX:XX:XX:XX:XX:XX
  customize:
    sources:
      - 'Amazon Prime Video'
      - M8
      - 'Canali TV'
      - Netflix
      - Chromecast
1 Like

Do you have webostv.conf file in config folder?