LG TV entity_picture

I’m trying to set up a sensor for my LG TV (C9) so that I can create an automation that responds to the state of the entity_picture attribute.

I’ve set up a sensor like this:

- platform: template
  sensors:
    lg_display:                                                                                 
      value_template: "{% if 
  state_attr('media_player.lg55c9','entity_picture') == None %}Off{% else %}On{% endif %}"

But the state of the sensor never changes to ‘on’ when I turn on the tv. I’m probably missing something. Does anyone have an idea?

Thanks in advance for the help.

The code is correct. Maybe the template sensor implementation is not monitoring if an entity attribute is disappearing? I suggest to give it a try in reverse. Maybe…

"{% if 
  state_attr('media_player.lg55c9','entity_picture') != None %}On{% else %}Off{% endif %}"

I tried your code but that didn’t work either. Maybe the C9 doesn’t use the entity_picture attribute.

I got the code from another thread. Is there any easy way to figure out which attributes an entity has?

Thanks for the help btw.

Sure. Go to Developer tools > States and look for your entity in the list (media_player.lg55c9). The TV has to be turned on. Some attributes like entity_picture only exist if the TV is on. I think all WebOS TV has the entity_picture attribute.

Thanks for the tip. I turned on the tv but it only showed me the playing state.

I’ll have a look at the implementation of an attribute card:

Thanks again for the help.

I am using the notification feature of my LG TV to notify about members of the family arriving, washer / dryer done etc, and would love to add custom icons using the setting the entity_picture to some custom icon, but no message is shown when I attempt this…
Anyone had any success adding custom icons to LG TV messages?