Animation when media player source = x

I have an Onkyo receiver working under HASS 0.79.3. (media_player.txnr676)

I’d like to fire off an animation when the receiver’s source is set to a specific value. For example, if the source is changed to ‘Video 1’, have an automation turn on some auxiliary devices, run a script, etc.

What I can’t figure is how to detect the source and trigger the automation, eg:

media_player.txnr676.source = 'Video 1'

Underscoring this problem is my limited understanding of states, platforms, templates, etc. I’ve searched the forums (and overall Internet) for solutions and have tried a few different things (like templates) without success.

A few words pointing me in the right direction would be appreciated!

Many thanks in advance.

Stumbled upon is_state_attr template extension which led to a solution:

trigger:
platform: template
value_template: “{{ is_state_attr(‘media_player.txnr609_0009b0495239’, ‘source’, ‘Video 2’) }}”
action:

FWIW.

1 Like