Template syntax help with referencing

I’m trying to obtain the value of media_series_title attribute of the media_player.sky_q entity in a template but I haven’t got a clue how to write this in a template.

I want to use the template to trigger a script if the value contains a specific string.

I got as far as the below but I don’t know the correct syntax to include the media_series_title attribute so would welcome any advice.

{% if ‘xxxxxx’ in media_player.sky_q %}

state_attr('media_player.sky_q', 'media_series_title')
or
{% if is_state_attr('media_player.sky_q', 'media_series_title', 'xxxxxx') %}

See:

1 Like

Thanks for the reply.

That works if I enter the complete value string but I want to look for just one word within that.

For example I want it to look in media_series_title the word “football” and return true if the value is something like “Friday night football”.

I’ve looked at the jinja documentation but can’t find the answer.

{{ 'football' in state_attr('media_player.sky_q', 'media_series_title') }}
1 Like

Thank you.

1 Like