Template Condition for Media Player Source

I’d like to include a condition within an automation that checks if a media player is set to an incorrect input.

If I test the following template it returns the value of the input ie. HDMI1
{{ states.media_player.soundbarq950t.attributes["source"] }}

I’d like my condition to test whether the source is NOT HDMI and then trigger a corrective action.

I’m struggling with the template syntax, hoping someone can provide a solution.

{{ not is_state_attr('media_player.soundbarq950t','source','HDMI') }}

1 Like