Dynamically change lovelace card

Hey everyone I have a video feed that is only enabled when I’m not home. I want to use the entity card when I’m there and the picture glance when I’m not. Is there a way to dynamically switch? I’ll ultimately base it off if a service is running.

Thanks for any help!

You might be best to create two cards, one with the feed and one with the picture glance—then use an automation trigger to display one when you’re home, and the other when you’re not.

1 Like

Thanks for the suggestion I essential did this with the condition cards here:

      - type: conditional
    conditions:
      - entity: input_boolean.motion_service
        state: "on"
    card:
      type: picture-glance
      title: Living Room
      entities:
        - switch.candles
        - switch.living_room_fan
        - group.living_room_lamp_lights
        - group.living_room_fan_lights
        - camera.living_room
      camera_image: camera.living_room
  - type: conditional
    conditions:
      - entity: input_boolean.motion_service
        state: "off"
    card:
      type:  entities
      title: Living Room
      entities:
        - switch.candles
        - switch.living_room_fan
        - group.living_room_lamp_lights
        - group.living_room_fan_lights

but I’m open for suggestions if there are better solutions. Thanks for the reply!

3 Likes

nice, where did you find the conditional card? i havent seen that

1 Like

@Darbos https://www.home-assistant.io/lovelace/conditional/

I used a conditional card to show 3 different cards that were all similar. I have 2 zones on my receiver with separate volume levels. If zone 1 is on, I only want to see zone 1’s volume. If zone 2 is on, i only want to see zone 2’s slider. If both are on, I want to see both. This is the config I used:

      - type: vertical-stack
        cards: 
          - type: picture-glance
            title: Yamaha Receiver
            entities:
              - switch.zone_1
              - switch.audio_1
              - switch.zone_2
              - switch.audio_2
            image: /local/images/rxv677.png
          - type: conditional
            conditions:
              - entity: switch.zone_1
                state: 'on'
              - entity: switch.zone_2
                state: 'off'
            card:
              - type: entities
                entities:
                  - entity: input_number.yamaha_receiver
                    name: Volume
          - type: conditional
            conditions:
              - entity: switch.zone_1
                state: 'off'
              - entity: switch.zone_2
                state: 'on'
            card:
              - type: entities
                entities:
                  - entity: input_number.yamaha_receiver_zone_2
                    name: Volume
          - type: conditional
            conditions:
              - entity: switch.zone_1
                state: 'on'
              - entity: switch.zone_2
                state: 'on'
            card:
              - type: entities
                entities:
                  - entity: input_number.yamaha_receiver
                    name: Zone 1 Volume
                  - entity: input_number.yamaha_receiver_zone_2
                    name: Zone 2 Volume

this is what it looks like:

all off:

image

zone 1 on:

image

zone 2 on:

image

zone 1 and 2 on:

image

4 Likes

Okay cool yeah so it seems like the conditional cards are the way to go to dynamically show something. Thanks everyone for the suggestions!

I suggest looking into the custom card vertical stack in card to also get the card with sliders to “belong” to the other card. Haven’t got a link right now, but Google it and otherwise hit me up later

hey I’m trying to do this but with my 2 Roombas and my 1 bravva jet and was wondering how to make the cards all stay in one place when i use it the cards have a mind of their own and can be told to be in the same place

Maybe because of the size of the cards changing that much?
Easiest option: try to fixate the card in a stack or grid…

thank you that helped me and now i dont need to make another lovelace