WebOS Smart TV - Unable to power on via HA [solved], and volume level is incorrect [pending]

So I’ve just set up the LG webOS Smart TV integration and it is mostly working. There are three things not right for me here:

  • I can’t power on the TV when it is powered off
  • The volume level in HA starts off at 0, even though the TV has it at 30 (which HA would see as 0.30)
  • When I increase or decrease the volume by HA, HA shows the change being by +/-0.01, (or 1 on the TV), but the TV changes by +/-0.02 (or 2 on the TV)

My configuration.yaml currently has:

wake_on_lan:

#switch:
#  - platform: wake_on_lan
#    name: LG
#    mac: "HI:DD:EN:MA:CA:DR"
#    turn_off:
#       service: media_player.turn_off
#       entity_id: media_player.living_room_tv

webostv:
  host: 192.168.1.NN
  name: Living Room TV
  turn_on_action:
    service: wake_on_lan.send_magic_packet
    data:
      "mac": "HI:DD:EN:MA:CA:DR"
#     service: switch.turn_on
#     entity_id: switch.lg
  customize:
    sources:
      - Apple TV
      - PlayStation 4
      - Xbox One
      - Switch/PS3
      
media_player:

The big one for me is not being able to turn the TV on, so all my troubleshooting has been for it.

I’ve looked through a myriad of posts over the last 3 years where people have had the same drama and:

  • I’ve tried using a switch instead of the wake_on_lan service, as you can see commented out in the yaml.
  • QuickStart+ and Wake over Wifi is turned on on the TV
  • I’ve tried the Mac Address with and without quotes
  • I’ve tried both mac and "mac" for the data field
  • I can ping the TV from the Hassio Docker when the TV is on, and response time is less than 5 ms consistently
  • I can ping the network broadcast address from the Hassio Docker sucessfully
  • When I connect my phone to the same wifi, I can power it on using the app

I get no errors in the system log when I try to turn the TV on from HA sadly, so I don’t really know where to go from here…

My setup:
Raspberry Pi 4, running Hassio using Docker
LG OLED65C9PTA (2019 model), which is on the 04.70.05 firmware
The LG is connected to my Raspberry Pi via a Wifi Network broadcast by the Pi, which does not bridge it to the rest of the home network which is connected via Ethernet to the Pi. I keep a few devices on this little wifi such as a Daikin and a Wemo, and they all work fine.

Like I said, everything else seems to work. I receive the custom input names that I set on the TV through HA, and I can change between them with no issue. I can also power the TV off via HA.

The volume level issue I’ve only looked at briefly. I can use the developer tools to “set” the volume level to, say 0.25, but the TV doesn’t register that change, just HA’s state. I can change the volume with volume_up and _down, but the TV goes up and down by twice the amount HA shows it going up and down by.

So any ideas are welcome. I don’t know how to change the logging levels so if anyone wants to walk me through that I am happy to redo my troubleshooting again with more thorough logging going on.

Ah, after all that, I figured it out with some random tinkering of my own.

Turned out that I needed to specify the network Broadcast address as well as the MAC address.

I’m thinking that this is because my HomeAssistant computer has two separate networks connected, and so the magic packet might have been being sent to the main network (192.168.x) when the TV was on the secondary network (192.168.y). The Wake On Lan integration was probably just inferring where it thought it should broadcast should happen, since we never tell it what the IP Address of the device we’re trying to wake up is.

I might jump into Github and open a couple issues:

  1. Add this this to the how to for webOS Smart TV integration as a troubleshooting step for when wake on lan doesn’t work
  2. Consider having webOS Smart TV include the Wake On Lan integration’s source code as a dependancy so that it can pass make an inference about what broadcast address would be suitable and pass it on to the Wake On Lan functions so no one every has to try work this out. This would kinda simplify the integration’s set up since you wouldn’t need to add additional integrations in your YAML, and open up the possibility of the integration just gathering the MAC address from the TV automatically during setup for this to be even more seamless.
  3. Suggest the Wake On Lan integration add a troubleshooting note about specifying the broadcast address when Wake on Lan doesn’t work for anyone who faces that trouble later.

Commentary on the above is welcome, it’ll probably be a few days before I bother create a Github account and pop this over there (I only use GitHub at work, and don’t think I should use my work account for this :wink😊

While I was looking for answers on this, I saw there were a few people who hit this issue over the years, and not all ended up with solutions, so for anyone who finds this in the future having the same trouble RE: Wake on Lan, here is what my YAML looks like for the webOS TV:

wake_on_lan:

webostv:
  host: 192.168.1.xx
  name: Living Room TV
  turn_on_action:
    service: wake_on_lan.send_magic_packet
    data:
      "mac": "AA:BB:CC:DD:EE:FF"
      "broadcast_address": "192.168.1.255"
  customize:
    sources:
      - Apple TV
      - PlayStation 4
      - Xbox One
      - Switch/PS3
      
media_player:

I got the broadcast address by ssh’ing into the Pi hosting HomeAssistant, and running ip addr, which gives output like the below:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether BB:CC:DD:EE:FF:GG brd ff:ff:ff:ff:ff:ff
    inet 192.168.y.yy/yy brd 192.168.y.255 scope global dynamic noprefixroute eth0
       valid_lft 78201sec preferred_lft 67401sec
    inet6 aa11::bb22:cc33:dd44:ee55/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether CC:DD:EE:FF:GG:HH brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.x/xx brd 192.168.1.255 scope global noprefixroute wlan0
       valid_lft forever preferred_lft forever
    inet6 bb22::cc33:dd44:ee55:ff66/64 scope link 
       valid_lft forever preferred_lft forever
4: hassio: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether DD:EE:FF:GG:HH:II brd ff:ff:ff:ff:ff:ff
    inet xxx.xxx.xxx.xxx/xx brd xxx.xxx.xxx.255 scope global hassio
       valid_lft forever preferred_lft forever
    inet6 cc33::dd44:ee55:ff66:gg77/64 scope link 
       valid_lft forever preferred_lft forever
etc

Find the interface that your tv is talking to the HomeAssistant system via (in my case wlan0, since it’s inet address starts with the same network segment as the TV’s IP Address (192.168.1). Most of the time you’ve just have 1 active network connection + the lo, which is the loopback address :slight_smile:
Your broadcast address will be the IP address listed after brd

Hopefully this will help someone somewhere :slight_smile:

As for my volume issue, if you have any suggestions, hit me up. I’m going to be connecting this to HomeKit, so my workaround will be to have it run a “get volume level” after each volume adjustment via HomeKit, which should cover me for now :stuck_out_tongue:

1 Like

Audio Levels:

Ok, more info. I have a Soundbar that is the TV’s sound output device via HDMI ARC
If I disable it, the volume level in Hassio changes to be the same as the TV exactly, and changing the volume works normally, going up and down in Hassio by the same increments as on the TV itself.
When I re-enable ARC on the TV, the TV sets it’s own volume level to 0. Volume control still works but the increment is off again, going up 0.01 on Hassio but by 0.02 on the soundbar and TV’s interface.

So I’m thinking there might be a different service call to base the volume level on when using an external sound device, or I might have to expose the LG TV through a Universal Media Player component and connect up the soundbar to HomeAssistant, and then have the univeral MP switch where it gets the volume level from and where it sends the volume up/down commands based on the TV’s “sound_output” state, to keep everything consistent

The soundbar is a Sony HT-RT5, if anyone has experience with IP control of them, I’d love to hear from you :slight_smile:

Interesting!
I have kind of the opposite problem. The wake on lan works fine…but after a while HA fails to detect the LG and I cannot control it in lovelace.
If I reboot HA the LG shows up fine again in lovelace.
I.e. the wake on lan works…but after the LG has been shut down it sometimes does not show up again (as active) in lovelace when it is powered on.
Any input here is welcome!
Btw. my code is identical to yours exempt the broadcast address.

This has solved this issue of powering on for me thanks, I always assumed the broadcast address should be the IP of the TV but once I set it to 192.168.1.255 as shown with ip addr it works great.

Glad this helped someone :blush:

I’m running HA through Virtualbox on Windows 10. Do you know how to run the ip addr command in this environment? I tried ipconfig and netstat.

I’m not so sure on Windows, but what you are looking for is the broadcast address of the network your TV is connected to.

If your TV’s IP address starts with 192.168.1.[0-255], then it will just be that with .255 as the 4th octet. Hope that helps!

1 Like

I am still struggling, and hoping one of you bright folks will help me out!

I followed all the documentation and the multiple topics on the issue, but once again it doesn’t work. Here is my code (in the automations.yaml file). I am running on Raspberry Pi, Docker container:

- id: '*************'
  alias: Turn On Living Room TV with WakeOnLan
  description: ''
  trigger:
  - platform: webostv.turn_on
    entity_id: media_player.lg_webos_smart_tv
  action:
  - service: wake_on_lan.send_magic_packet
    data:
      mac: "AA:BB:CC:DD:EE:FF" #redacted 
      broadcast_address: "192.168.4.255"

I can see the button to turn on the TV from the Off state, but it won’t actually turn it on. What am I doing wrong?

  • container is set up to work on the same network as the host

  • The TV is running LG WebOS 4.1.5

  • Connected on ethernet, confirmed broadcast address

  • LG Connect Apps enabled in Network Menu

  • Option for “Mobile On” does not exist in General Settings on the TV

Assume you have installed the LG integration and the media player entity matches that in the automation?

EDIT: as someone else has replied to your same post in another thread, you have to add you TV’s mac address

I have done both already

Is this what you are looking for?