Need help with attribute

Hi there,

I am trying (apart from receiving last_update from media_players), also receiving an attribute called media_title. It’s possible? I’ve been mulling over the code all afternoon and can’t find the result.

The following code correctly receives the last_update and shows the result. Any help would be greatly appreciated

{% set x =  [ states.media_player.tv_living,
              states.media_player.tv_dormitor ]
      | selectattr('state', 'eq', 'on')
      | sort(reverse=true, attribute='last_updated')
      | list %}
{% if x | count > 0 %}
{{ x[0].name }}
{{ x[0].entity_id }},
{{ x[0].last_updated.timestamp() | timestamp_custom('%T', true) }}
{% endif %}

{{ x[0].attributes.media_title }}

1 Like

Many thanks!!!