LG WebOs: How to use "current_app_id" in automation?

Hi
I have an automation running, that uses the Source attribute of my LG Entity to change the ambient light. However the source is not reliable, since it does not consider the Home Screen. It always lists the last active source even when the TV is on the Home Screen (example: after the power on).

I noticed that the Media Player Icon does change and reflect the current state better than the source attribute.
So I compared the diagnostic log of different states and found that client.current_app_id does show the correct state of the TV already:

So my question is:
How can I access this Information and react on changes?

Make a template sensor.

Thanks, but I’m still lost. I watched a few YouTube Tutorials about this, but my main issue is that I don’t know how to access this “current_app_id” state in the first place.

When I look for the possible states I don’t see it:

I only found about this internal (?) state in the diagnostic log, after I noticed that the Icon in the Media Player is representing the actual state unlike the source.

YouTube App is active:
HA_YouTube

Home Screen is active:
HA_Home

So my hope was that if the Media Player can use it, I might be able to access it as well. But if the Media Player is not generic, but specific to the WebOs Implementation, then this might not be the case.

So, I’m still completely lost, on how to access this “current_app_id” state.

Ahh, that is probably something the maintainer of the integration should add then.
If it is a core integration, then make a feature request.
If it is not a core integration, then make an issue on the integration’s GitHub page.

1 Like

Do you have other entities with LG in the name? The media player entity must be getting the current id from somewhere, right?

It is not displayed as an entity.
The source entity is the one that is not updating correctly.
The current_app_id is only visible in diagnostic logs.

2 Likes

Thanks for all the suggestions. I tried to get the information from the webos.command feature of this integration with a script:
https://www.home-assistant.io/integrations/webostv#action-webostvcommand

But while I was able to get a reaction from the TV for commands like Screen Off, I couldn’t get a return value for any of the commands I tried that should deliver one.
Not sure, if I did something wrong or not, since I have not much experience with scripts, but I have seen an unsolved issue tracker and a similar post in this forum.
Forum post
Service webostv.command does not return a response

Will try to solve it with Node Red now.

How do I find out if it’s a Core Integration or not?

It’s listed under HA integrations in your link, so it’s a core integration.

1 Like