Hi All,
I’m looking for some help please on how to achieve something. On my new dashboard I’m wanting to have conditional tiles pop up only when needed to provide a counter / overview. This is working great for everything but I can’t think of a way to set the media card conditional.
I have all my media players grouped into a group called all media players, the problem is some media players report different state, off, standby / on, playing. I’d like to show the below media card only if any media player is playing or on.
I think the correct way to do this is probably to create a new sensor and use that sensor for the conditional card but I’m struggling to understand the yaml to do this and only have it pick up state playing or on.
- type: conditional
conditions:
- entity: media_player.all_media_players
state: 'on'
card:
type: custom:stack-in-card
cards:
- type: custom:mushroom-template-card
primary: >-
Media: {{ expand(states.media_player.all_media_players) |
selectattr('state','in',['on','playing']) | list | count }}
secondary: ''
icon: mdi:cast
entity: media_player.all_media_players
hold_action:
action: toggle
tap_action:
action: navigate
navigation_path: /home-v2/media
icon_color: grey
fill_container: false
layout: vertical
multiline_secondary: false
card_mod:
style:
mushroom-state-info$: |
.primary {
#text-shadow: 1px 1px 1px black;
--card-primary-font-weight: 450;
--primary-text-color: black;
--card-primary-font-size: 13px;
#align-items: center;
margin-left: -auto;
margin-top: -10px;
}
card_mod:
style: |
ha-card {
border-radius: none;
background-color: white;
border: none;
box-shadow: none;
align-left: auto;
align-right: auto;
}