Node Red: Detect TV source?

Very new to NR and not sure how to check this data.

My TV entity ID is simply “media_player.lg_tv” and I want to check this property “source: Streaming Box”.

What kind of node do I use for this and how do I call to check the source property?

Hello smugleafdev,
I do not have a “Smart TV” and I’m not a pro, but maybe I can help you anyway …
I have integrated a Xiaomi Button in HA, in “Developer Tools / Events” can be called by … “Start Listening” the events, the whole looks in my case like this …
(In your case, I would leave the “Events to subscribe” field blank and press the source button “streaming box” on the remote control …)


Here is “event_type”, “entity_id” and “click_type” important. In Node RED, I can now trigger with the node “fire event” the key press by node RED, the whole looks like in my case like that :
In the field “Event” I entered the following:

xiaomi_aqara.click


Click here on “Data” on the three points and then I have entered:

{
  "click": "single",
  "entity_id": "binary_sensor.switch_158d0001e802f9"
}

The whole thing looks like this …


Then another “inject” node as a trigger, connect both nodes and complete with “Deploy” …

The whole thing would have to be adapted to your circumstances …
Maybe that works …
Good luck and keep having fun with Home Assistant

I eventually figured out the simple solution. I just used a “switch” node with the property set to msg.data.attributes.source == Streaming Box. I used a debug node that spit out the entirety of the data attached to the TV’s current state node, and that’s what tipped me off. A switch node might not be the best, but it works.