Content Type as Condition (prior state)

Hello Community!

I’m trying to write an automation that will turn on the lights when media playback is stopped ONLY if the content type is TVSHOW or MOVIE. I have it working perfectly for Pause and Play, but when I try to use Stop, it fails the condition, presumably because after the media playback stops, it is no longer a TVSHOW or MOVIE content type. Is there a way to fire the condition before the event or somehow capture what the content type was when the trigger was fired?

You can use the trigger variable to see the values of the previous state…

condition: template
value_template: "{{ trigger.from_state.attributes.media_content_type | lower in ['tvshow', 'movie']}}"

Thank you so much! This worked perfectly.

1 Like