Lovelace - Media control as entity filter, possible?

Is there a way to have the media control cards only show when it’s playing (so hidden when unavailable or idle)?
Basically like “entity filter” cards.

That’s how it is setup now…

>       - type: vertical-stack
>         cards:
>         - type: media-control
>           entity: media_player.plex_sfroku_3__salon
>         - type: media-control
>           entity: media_player.plex_sfroku_3__chambre
>         - type: media-control          
>           entity: media_player.plex_sfroku_3__bur_syl
>         - type: media-control          
>           entity: media_player.plex_sfroku_3__soussol

make a conditional card with a the media control inside it:

2 Likes

I saw this but not entirely sure how to apply this specifically to my setup, keeping the vertical stack as it it now…
Would you help me with an example?

Here’s a link to what I do with the conditional card and volume sliders and my configuration:

1 Like

oh nice, I think I got it:

  - type: vertical-stack
    cards:
    - type: conditional
      conditions:
        - entity: media_player.plex_sfroku_3__bur_syl
          state: "playing"
      card:
        type: media-control
        entity: media_player.plex_sfroku_3__bur_syl
    - type: conditional
      conditions:
        - entity: media_player.plex_sfroku_3__salon
          state: "playing"
      card:
        type: media-control
        entity: media_player.plex_sfroku_3__salon       
    - type: conditional
      conditions:
        - entity: media_player.plex_sfroku_3__chambrel
          state: "playing"
      card:
        type: media-control
        entity: media_player.plex_sfroku_3__chambre
    - type: conditional
      conditions:
        - entity: media_player.plex_sfroku_3__soussol
          state: "playing"
      card:
        type: media-control
        entity: media_player.plex_sfroku_3__soussol

Man, Lovelace is awesome once you get used to it :slight_smile:

Ya, that looks like it should work. Nice

Last question, to make this perfect for me, I would like to do the same but not have to manually add each Plex player entitiy…
Is there a way to do this so it just adds in there any media player that starts with “media_player.plex” (with same conditions)?
All my plex player entities starts with

media_player.plex

I figured there must be a way…

I don’t know. I think at some point in the future, globbing will be available for items. Right now I think you have to go one by one.

ok, thank you

trying to do the same thing right now

So I am trying this, but nothing is working for me, at least first go any way. I would like a card for my living room that only shows any media players that are actually running. I opened a conditional card and copied the yaml file above and pasted in my media players. It’s just a big error.

Why? I don’t understand any of this.

You can’t just copy and paste code, you have to make sure it links to your devices, has the correct indentation, and verify that the syntax hasn’t changed since this post was made.

1 Like