Help with Conditional card

Hey guys,
i’ve been fighting with this a little bit now and i can’t seem to find a solution yet. I’m trying to setup this > conditional card in lovelace:

          - type: conditional
            conditions:
              - entity: switch.zone_1
                state: on
              - entity: switch.zone_2
                state: off
            card:
              type: entities
              entities:
                - entity: input_number.onkyo_receiver
                  name: Zone 1 Volume
                - entity: input_number.onkyo_receiver_zone_2
                  name: Zone 2 Volume

And for some reason i kept getting this error:
conditional-one

I also tried to setup a conditional with multiple cards like this:

Multiple
      - type: horizontal-stack
        cards:
          - type: conditional
            conditions:
              - entity: switch.zone_1
                state: on
              - entity: switch.zone_2
                state: off
            cards:
              - type: entities
                entities:
                  - entity: input_number.onkyo_receiver
                    name: Zone 1 Volume
                  - entity: input_number.onkyo_receiver_zone_2
                    name: Zone 2 Volume
              - type: entities
                entities:
                  - entity: input_number.onkyo_receiver
                    name: Volume
              - type: entities
                entities:
                  - entity: input_number.onkyo_receiver_zone_2
                    name: Volume

that did not work for me either;

Could you guys be so kind and help me out please.

Always put ‘on’ and ‘off’ in quotes.
As you can see in the error box, HA converts it to true/false.

thank you for taking the time to reply; but that still did not work for me. I tried single and double quotation( ’ and " )

Both of your errors show ‘cards’, the conditional can only handle one ‘card’.
Your first example should work.

Hey my man thank you for that. It’s working

I’m trying to setup conditional card in lovelace in yaml mode, but can´t working.

37

  - badges: []
    cards:
      - entity: sensor.real_time_consumption_xxxxxx
        max: 6000
        min: 0
        severity:
          green: 700
          red: 4500
          yellow: 2500
        theme: default
        type: gauge
      - entity: sensor.electricity_price_xxxxxxx
        max: 1
        min: 0
        severity:
          green: 0.2
          red: 1
          yellow: 0.6
        theme: default
        type: gauge
      - cards:
          - cards:
              - entities:
                  - entity: sensor.tibber_minpower
                    name: Min
                    secondary_info: last-changed
                  - type: section
                  - entity: sensor.tibber_averagepower
                    name: Snitt
                  - type: section
                  - entity: sensor.tibber_maxpower
                    name: Max
                    secondary_info: last-changed
                  - type: section
                  - entity: sensor.tibber_accumulatedconsumption
                    name: Forbruk
                type: entities
              - entities:
                  - entity: sensor.tibber_min
                    name: Min
                  - type: section
                  - entity: sensor.tibber_avg
                    name: Snitt
                  - type: section
                  - entity: sensor.tibber_max
                    name: Max
                  - type: section
                  - entity: sensor.tibber_accumulatedcost
                    name: Kostnad
                type: entities
            type: horizontal-stack
          - entities:
              - sensor.tibber_volt
              - sensor.tibber_amp
            type: glance
          - entities:
              - entity: sensor.tibber_nett
                icon: 'mdi:fuse'
              - entity: sensor.tibber_estimert
              - entity: sensor.tibber_time
            type: entities
        type: vertical-stack
    path: ams
    title: AMS
  - badges: []
    cards:
      - type: conditional
        conditions:
          - entity: light.livingroom
            state: "off"
          - entity: light.livingroom
            state: "on"
        card: 
          type: entities
          entities:
            - entity: light.livingroom    
    path: test
    title: test

So if i need to use more than one conditional card may i put more than one in series?
And more, to show again the hidden cards i must put another conditional with ‘on’ as state or it will be automatical?

Is it possible to use conditional card with some sort of timer? Like after 60sec when media_player stops playing it will hide the Card?

No but you can set state with this script

Works fine and I use it to hide some media player

What I’m looking for now is to hide a media player based on the source or a specific attribute. I’m stuck :sweat_smile:

Friends,

Upgrading from HA 9.93 to current version 1.06.5, I see that the “Group.All_…” is no longer valid. I use this in my conditional card as below:

      - type: conditional
        conditions:
          - entity: group.all_lights
            state: "on"
        card:
          type: horizontal-stack
          ...

I just want a card to show when any light is switch on.
How do I accomplish this, please ?

Take a look here:

Thx. I’ll look into this.
Looks like there is no easy replacement…

@VDRainer,

I am really sorry. It must be my lack of understanding automations/templates/… but I do not understand how I can fit any of the suggested methods in you post proposed.

The “Conditional” card type takes only “entity” in its “conditions” section.
So how do I create an entity (of the Lights domain) that this card can test to see if any light is on ?

Hoping you can help a novice in this matter.

Well, if you read the first post in the topic to the end, there are three easy steps to get your group.all_lights back.

Python Script Startup Solution

The Python script worked !
Many thanks for your kind advice !!!

Hello everyone, since yesterday I’m getting this error:
“Custom element doesn’t exist: hui-conditional-card.”

Home Assistant 0.107.1

python_version 3.7.6

I think is a consequence of the new version of Home Assistant, is anyone having the same issue?

Here’s a workaround for this issue:

did you ever figure this out?

No.

I still need it.

Workaround involves many duplicate code and is hard to read if you have multiples sources for each media player displayed on the same lovelace tab.

With Tidal & iTunes streaming to 4 Chromecast + 3 CC groups I need 14 lovelace conditional card per state. It’s huge and hard to maintain especially when you also need to include volume or some playlists.

I saw 2 features request that you should vote for.
Both would help me decrease amount of code. Maybe it’s what you have been looking for?

I voted for both of those, hopefully it will get added soon.

In the meantime, I’ve found a workaround to work for my application. I’m using the custom state-switch card in LL to dynamically display the right mini media player card based on what the receiver source is set to. Note that the vertical-stack isn’t necessary but I plan on expanding each one with additional cards so I’ve added it already.

            - type: custom:state-switch
              entity: template
              template: "{% if is_state_attr('media_player.rx_v675', 'source', 'ChromeCast') %} ChromeCast {%elif XBOX %} XBOX {%elif HDMI5 %} HDMI5 {%endif%}"
              states:
                "ChromeCast":
                  type: vertical-stack
                  cards:
                    - type: custom:mini-media-player
                      entity: media_player.ultra
                      icon: mdi:google-chrome
                      hide:
                        source: true
                        power: true
                "XBOX":
                  type: vertical-stack
                  cards:
                    - type: custom:mini-media-player
                      entity: media_player.xbox
                      icon: mdi:xbox
                      hide:
                        source: true
                "HDMI5":
                  type: vertical-stack
                  cards:
                    - type: custom:mini-media-player
                      entity: media_player.mibox4
                      icon: mdi:android-head
                      hide:
                        source: true
1 Like