Turn On LG TV Via Wifi

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?

When I add this I get an invalid config error.

Yes. I can view the state of the TV and turn it off via HA. Just can’t turn it on.

This is the old media_player config:

This is my working config, works on wifi and LAN:

webostv:
  host: 192.168.1.26
  name: Monitor
  turn_on_action:
    service: wake_on_lan.send_magic_packet
    data:
      mac: A8:23:xx:xx:xx:xx
      broadcast_address: 192.168.1.255
  customize:
    sources:
      - PC
      - Emby
      - Netflix
      - BBC iPlayer
      - ITV Hub
      - All 4
      - My5