Webostv: support for states other than on/off

The webostv integration only reports its state as being on or off. If it could report playing/paused/etc. it could be better controlled through e.g. the Google Assistant integration thanks to recent improvements in the way HA implements GA’s media traits.

Hi @bendavid, if i’m correct you’re the main code holder of the webostv integration. Would this be difficult to implement? I have no idea if these people still want it but you’d make my WebOS integration complete with it :smile:

1 Like

I would love to use this feature to for example turn on some lights when media is paused, or to only start my movies automation as soon as media is actually played, and not while browsing the app.

1 Like

I would still appreciate it :slight_smile:

If I can find some time, I’ll try to look into contributing a patch that makes this come true.

3 Likes

+1

I’m currently not running any automations based on what I’m using my LG TV for, but I’d love to see this functionality added so I could. I do have a Chromecast connected to my TV, but I much prefer using the native webOS apps such as Netflix, Disney+ and YouTube.

1 Like

That would be great. I’m beginning to understand a lot of Home Assistant but contributing to integrations with zero level of experience would be unwise haha.

If you need someone to test the code let me know, happy to help!

Can we pleeeeease get this feature? Im willing to help out if need be

+1
Would love this as well. My automation to dim the lights when the TV playing something and then brighten them again when its paused can not work ever since I’ve changed to LG

1 Like

+2
Knowing the state your media is in is key to useful automations.

But this could be an API limitation?

Hi There.
I understand that the play paused state is important and helpful. I use it to turn off/on lights all the way to my galley when we watch a movie. Although it is not the same I created a generic binary sensor with the volume mute state attribute. So when We pause the movie we mute it as well.

Can you share your code for that?

I hope this helps.

I also made a sensor to understand when the Tv is in Netflix source. So the Automation I builded controls the lights when the created binary sensor LG TV Muted changes state. I added as a condition to be able to control the lights only when LG TV Netflix is on. When I watch normal TV mute does not affects the lights.
You can make binary sensors for all your sources and trigger different automations - scripts.

binary_sensor:
    - platform: template
      sensors:
        lg_tv_mute:
          friendly_name: "LG TV Muted"
          value_template: "{{ state_attr('media_player.living_room_tv', 'is_volume_muted') }}"
    - platform: template
      sensors:
        lg_tv_netflix:
          friendly_name: "LG TV Netflix"
          value_template: "{{ is_state_attr('media_player.living_room_tv', 'source', 'Netflix') }}"
2 Likes

The TV does not provide information on whether it is in a playing or paused state. Most of the known available information is already exposed to home assistant through the state, current app, etc.

(There is some lower level information which could be exposed, whether the TV is really off, or in standby performing OLED pixel refresh cycles etc, but this is probably not so useful for typical automation use cases.)

Ah okay, that is sad…

Thanks for your reply!

The biggest reason I need this is to reliably play/pause. Sometimes I have to send the command 2 or 3 times until it works. When the TV is paused in youtube and in screensaver mode, first play command wakes it, second does nothing and the third one plays the video.

Has anyone found a workaround for this?

I only had a quick look, but I get the impression that this endpoint does what we want?

1 Like

These docs are for apps running on the TV. Only some services are exposed over the network and I haven’t been able to find any documentation on that.
Looks like someone reverse engineered a few commands a long time ago and every webos library just copies them from the others.

So is this dead in the water then? Kind of sucks that you can’t automate anything based around your TV.

I recently found that you can install custom apps on the TV without rooting. And these can have background services.

I plan to write a simple app to publish state info to mqtt or directly to HA but am on vacation now and don’t know when I will have time after I get back.

Tried to contribute to the library currently used but couldn’t find a reliable way of getting the info from outside the TV.

So not totally dead.

It’s kind of a bummer that we have to side load apps just to automate around a state that the APIs should ostensibly provide. LG needs to step up their game! It’s kind of weird that I can get a notification instantly if the mute button is pressed, but I can’t find out if my TV is playing or not :frowning:

In any case, let me know if you need any beta testers!