Lovelace - conditional

Here is one of my conditional setup:

- type: conditional
  conditions:
    - entity: media_player.plex_sfroku_stick
      state: "playing"

Is it possible to add “paused” in the state as “or” (not “and”).
Basically I want it to show only if state is playing OR paused.

Not sure about format for this…
Thanks!

I would like to know this too

Easiest way to do this is to duplicate the entry. The state can’t be both playing and paused. Anyways your config would look something like this:

- type: conditional
  conditions:
    - entity: media_player.plex_sfroku_stick
      state: "playing"
  card:
    type: entities
    entities:
      - device_tracker.demo_paulus
      - cover.kitchen_window
      - group.kitchen
      - lock.kitchen_door
      - light.bed_light
- type: conditional
  conditions:
    - entity: media_player.plex_sfroku_stick
      state: "paused"
  card:
    type: entities
    entities:
      - device_tracker.demo_paulus
      - cover.kitchen_window
      - group.kitchen
      - lock.kitchen_door
      - light.bed_light

This is what I do with complex conditions to display different cards (or similar cards):

yes, that works, thanks!

- 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__salon
      state: "paused"
  card:
    type: media-control
    entity: media_player.plex_sfroku_3__salon

Thanks. It makes the authoring page a bit messy. Already I find that one of the draw back of lovelace is that it all sits on 1 massive page…
so that’s 3 “duplications” because you have 2 conditions. if I had 3 conditions, it would make 8 duplications, 4 conditions would make it 16 “duplications”. Maybe I’ll create lovelace UI specific template sensors that will do the conditions and use this as a single entity filter…

Yeah, it’s a pita currently. I believe they will continually update how the configurations work in the long run. Right now we are in the beginning stages.

1 Like

Just want to share that conditional doesn’t work on gauge cards (0.83.3)

Is there no way to make a single entity conditional?

This is how you make a single entity conditional… Unless you are referring to an entity inside some other card.

The interesting part is that the state_not is actually or.

So you can make your condition to be state_not all the other than playing and paused. This conditional card shows if media_player.kokkenet_hojtaler is playing or paused.

- type: conditional
    conditions:
      - entity: media_player.kokkenet_hojtaler
        state_not: "idle"
      - entity: media_player.kokkenet_hojtaler
        state_not: "stopped"
      - entity: media_player.kokkenet_hojtaler
        state_not: "on"
      - entity: media_player.kokkenet_hojtaler
        state_not: "off"
5 Likes