added to that, if the system restarts and no media_player is available at all, (and it isnt unavailable either then) this results in the yellow card in the frontend.
seems we can’t use a list for the state condition, but can’t use multiple conditions for the same entity either, which is a bit silly especially with media_players.
would be very nice it these native cards would use the same logic/syntax…
this explains it I fear:
Note: Conditions with more than one entity are treated as an ‘and’ condition. This means that for the card to show, all entities must meet the state requirements set.
thanks, nice idea indeed.
It is what I find myself doing all the time these days… using backend logic, specifically made, to use in the Lovelace frontend cards that offer but limited possibilities, or unexpected behavior
still to get back to my first post, that would seem a bug. state was clearly showing ‘unavailable’ so it shouldn’t have been displayed in the frontend.
it only shows up as unavailable if it’s unavailable in the states page (i.e. unavailable, but in the state machine). If the device doesn’t show up at all in the states page, then nothing will work.
Thank you. I can confirm this works correctly. However, it’s a bit of a hassle to do this for every single Plex media player. I have 10 of them… and, regularly add new plex players.
It’s significantly less hassle to just make cards without having to also create respective binary sensors in the configuration and restart Home Assistant for the binary sensor templates to take in effect. Is there a way to at least not restart Home Assistant after adding binary sensors in the configuration file?
- type: custom:auto-entities
show_empty: false
card:
type: entities
title: Plex Playing template
filter:
include:
- entity_id: 'media_player.plex*'
state: /playing|paused|'on'/
options:
type: custom:template-entity-row
state: >
{% set player = config.entity %}
{%- for attr in states[player].attributes %}
{%- if not attr in ['media_content_id','icon','entity_picture',
'hide_attributes','media_position_updated_at',
'is_volume_muted','username','friendly_name',
'supported_features'] %}
{{states[player].attributes[attr]}}
{%- endif %}
{% endfor %}
secondary: >
{{state_attr(config.entity,'username')}}
sort:
method: name
or play with the template some more:
state: >
{% set player = config.entity %}
{%- for attr in states[player].attributes %}
{%- if not attr in ['media_content_id','icon','entity_picture',
'hide_attributes','media_position_updated_at',
'media_duration','media_position','player_source',
'media_content_rating',
'is_volume_muted','username','friendly_name',
'volume_level','supported_features'] %}
{{attr|title|replace('_',' ')}}: {{states[player].attributes[attr]|title}}
{%- endif %}
{% endfor %}