Show a conditional card based on the condition of another card?

I would like a conditional card. That will be shown only when a different card is not show.
This means if the conditions of the first card are not met.
Sounds simple but there are to many conditions to use them.

So i would like to Display my second card based on the condition of the first card.

So i have a card, that shows my bins when they need to be empty.
This is a horizontal stack card, full of conditional cards that only show the bins that need to be at the street today or tomorrow.

This card has a tapaction that i build in there, so then when i tap it. the card disappears for 48 hours.(switched by a timer helper)
By that time the state of the bin has changed and it will also not display anymore because of today/tomorrow basis.
Once the bin is due next month. my timer will be reset. and the today/tomorrow state will make it so that it will display the card again.

So when i tap the bins i know they are emptied.

Once this card does not display any bins that need to be emptied. Its an empty space that i would like to fill with a different card.

But because there are so many different configurations of when some bins are empty en when not. its hard to use this as a condition.
I tried the And If way. but i have so many diffrent settings.

1 day it will be 2 bins showing. the other it will be 1.
Also considering that it only needs to display the replacement card at the moment the Timer helper is started. (when i pressed the bin and it has dissapeard)

See the full card:


type: horizontal-stack
cards:
  - type: conditional
    conditions:
      - condition: state
        entity: sensor.afvalbeheer_gft
        state: Vandaag
      - condition: state
        entity: timer.timer_gft
        state: idle
    card:
      show_state: true
      show_name: false
      camera_view: auto
      type: picture-entity
      entity: sensor.afvalbeheer_gft
      image: /local/afbeeldingen/GFT1.png
      tap_action:
        action: perform-action
        perform_action: timer.start
        target:
          entity_id: timer.timer_gft
      card_mod:
        style: |
          ha-card
            {background: transparent;
            border-style: none;
            color: red;
  - type: conditional
    conditions:
      - condition: state
        entity: sensor.afvalbeheer_gft
        state: Morgen
      - condition: state
        entity: timer.timer_gft
        state: idle
    card:
      show_state: true
      show_name: false
      camera_view: auto
      type: picture-entity
      entity: sensor.afvalbeheer_gft
      image: /local/afbeeldingen/GFT1.png
      tap_action:
        action: perform-action
        perform_action: timer.start
        target:
          entity_id: timer.timer_gft
      card_mod:
        style: |
          ha-card
            {background: transparent;
            border-style: none;
            color: red;
  - type: conditional
    conditions:
      - condition: state
        entity: sensor.afvalbeheer_restafval
        state: Vandaag
      - condition: state
        entity: timer.timer_restafval
        state: idle
    card:
      show_state: true
      show_name: false
      camera_view: auto
      type: picture-entity
      entity: sensor.afvalbeheer_restafval
      image: /local/afbeeldingen/REST1.png
      tap_action:
        action: perform-action
        perform_action: timer.start
        target:
          entity_id: timer.timer_restafval
      card_mod:
        style: |
          ha-card
            {background: transparent;
            border-style: none;
            color: red;
  - type: conditional
    conditions:
      - condition: state
        entity: sensor.afvalbeheer_restafval
        state: Morgen
      - condition: state
        entity: timer.timer_restafval
        state: idle
    card:
      show_state: true
      show_name: false
      camera_view: auto
      type: picture-entity
      entity: sensor.afvalbeheer_restafval
      image: /local/afbeeldingen/REST1.png
      tap_action:
        action: perform-action
        perform_action: timer.start
        target:
          entity_id: timer.timer_restafval
      card_mod:
        style: |
          ha-card
            {background: transparent;
            border-style: none;
            color: red;
  - type: conditional
    conditions:
      - condition: state
        entity: sensor.afvalbeheer_pmd
        state: Vandaag
      - condition: state
        entity: timer.timer_plastic
        state: idle
    card:
      show_state: true
      show_name: false
      camera_view: auto
      type: picture-entity
      entity: sensor.afvalbeheer_pmd
      image: /local/afbeeldingen/PLASTIC1.png
      tap_action:
        action: perform-action
        perform_action: timer.start
        target:
          entity_id: timer.timer_plastic
      card_mod:
        style: |
          ha-card
            {background: transparent;
            border-style: none;
            color: red;
  - type: conditional
    conditions:
      - condition: state
        entity: sensor.afvalbeheer_pmd
        state: Morgen
      - condition: state
        entity: timer.timer_plastic
        state: idle
    card:
      show_state: true
      show_name: false
      camera_view: auto
      type: picture-entity
      entity: sensor.afvalbeheer_pmd
      image: /local/afbeeldingen/PLASTIC1.png
      tap_action:
        action: perform-action
        perform_action: timer.start
        target:
          entity_id: timer.timer_plastic
      card_mod:
        style: |
          ha-card
            {background: transparent;
            border-style: none;
            color: red;
  - type: conditional
    conditions:
      - condition: state
        entity: sensor.afvalbeheer_papier
        state: Vandaag
      - condition: state
        entity: timer.timer_papier
        state: idle
    card:
      show_state: true
      show_name: false
      camera_view: auto
      type: picture-entity
      entity: sensor.afvalbeheer_papier
      image: /local/afbeeldingen/PAPIER1.png
      tap_action:
        action: perform-action
        perform_action: timer.start
        target:
          entity_id: timer.timer_papier
      card_mod:
        style: |
          ha-card
            {background: transparent;
            border-style: none;
            color: red;
  - type: conditional
    conditions:
      - condition: state
        entity: sensor.afvalbeheer_papier
        state: Morgen
      - condition: state
        entity: timer.timer_papier
        state: idle
    card:
      show_state: true
      show_name: false
      camera_view: auto
      type: picture-entity
      entity: sensor.afvalbeheer_papier
      image: /local/afbeeldingen/PAPIER1.png
      tap_action:
        action: perform-action
        perform_action: timer.start
        target:
          entity_id: timer.timer_papier
      card_mod:
        style: |
          ha-card
            {background: transparent;
            border-style: none;
            color: red;

I would like to just display 1 card when the conditions to display the other card are not met.

Hope this makes sense.

I can’t think of any way you can query whether any of a certain set of conditional cards are showing, so I don’t think there’s anyway around the fact that you’ll have to calculate the complete set of conditions. I would do this in a template binary sensor so you can manage it a little easier though. The template would be something like this (assuming I’ve understood the logic correctly)

{{ 
  not(
    (
      ( (states('sensor.afvalbeheer_gft') == 'Vandaag') or states('sensor.afvalbeheer_gft') == 'Morgen'))
        and states('timer.timer_gft') == 'idle'))
      or ( (states('sensor.afvalbeheer_restafval') == 'Vandaag') or states('sensor.afvalbeheer_restafval') == 'Morgen'))
        and states('timer.timer_restafval') == 'idle'))
      or ( (states('sensor.afvalbeheer_pmd') == 'Vandaag') or states('sensor.afvalbeheer_pmd') == 'Morgen'))
        and states('timer.timer_plastic') == 'idle'))
      or ( (states('sensor.afvalbeheer_papier') == 'Vandaag') or states('sensor.afvalbeheer_papier') == 'Morgen'))
        and states('timer.timer_papier') == 'idle'))
      )
  )
}}

Thanks for the reply, its what i was afraid of.
I tried to do what you are describing a bit already.

Made a condition card with for example for each bin a condition of it being not today. not tomorrow. and yes the timer is pressed. so now the bin is gone.
But sometimes another bin will be there.

I will have to litteraly discribe every scenario.

Still a possibility but maybe a bit excessive.

So it wil become something like

When paper is not today. not tomorrow or timer pressed Show card
When paper is not today, not tomorrow or timer pressed. AND pmd is not tomorrow , and not today or timer is pressed.
and this for every combination of bins that might be available.

Still a possibilty but it seems like there could be an easyer way

Maybe a bit of change in your helper usage could help.
Instead of having the helper indicate if it is hidden then have it indicate if it should be shown.

Make automations that will trigger the helper to show two days before and then have tapaction clear it.
It might be a little change, but then the helper can be used for the conditional cards.

1 Like