Automation based on tv show

A wonder if I could get a quick pointer please.

I’m trying to write some automation based on a Plex TV show.

If I view the state of ‘media_player.plex_plex_for_apple_tv_bedroom’, I can see the following entry

media_series_title: Robot Chicken

I can’t quit work out the syntax to do something based on the current TV show.

My automation currently has the condition of the below, however that doesn’t seem to be triggering.

Trigger = idle to playing (this works)

condition:

  • condition: state
    entity_id: media_player.plex_plex_for_apple_tv_bedroom
    state: ‘media_series_title: Robot Chicken’

Action - Call script (this works)

Having a quick look around the forum, there’s the state attribute function…but I couldn’t work that out.

Do I need to look at templating, or am I missing something easy?

Thanks in advance
Darren

Probably.
But not sure I understand what you are asking.
Can you give us a screenshot of the entity and what exactly you want to trigger on?

Thanks Hellis81.

This is the state of Plex on the AppleTV

This is the automation I’m attempting.


In the current automation, I’m attempting to get it to notify my phone when it recognises the TV show = Robot Chicken.

I’ll replace the notification with a working script once it works.

When you use state like that in the condition it literally means the state.
What you want is the attribute.

{{ states.media_player.plex_for_apple_tv_bedroom.attributes.media_series_title == 'chicken robot' }}

That media player name is a mouthful.

Try that as a template.
You can also try it “live” in developer tools -> templates.
That white box of text, delete all and add that template and see what the result is.

Perfect!

I’d seen the templates screen, but not done anything with it (I’m still fairly new to Home Assistant)
Sorry about the media player name, they’re auto generated from Plex. As I’ve got other media players in that room, I left it as it was…but agreed, it’s a bit of a mouthful.

Your script didn’t initially work, however I’ve fixed the typo and I now get ‘True’

{{ states.media_player.plex_plex_for_apple_tv_bedroom.attributes.media_series_title == "Robot Chicken" }}

Many thanks for your help :slight_smile:

Great!
I was kind of expecting a typo since I was typing it on my phone from memory since I can’t fit the thread, comment box and keyboard on the screen.

:smile: :+1: