Show different enitity when unavailable

I have a few entities in my lovelace glance card.
some of them are lightbulbs, but when the bulb is unavailable becuase the switch is in the wrong state I would like to show the switch entity as alternative so I am able to turn on the switch so the light will become available again.

Is this possible and how would I approach.

I normal circumstances the situation would not apply, but if wifi goes down, my switch starts using the relay instead of addressing the light. therefor it wifi comes up again it is possible the relay is still off.

You can use the special conditional row of the entities card

  - type: conditional
    conditions:
      - entity: light.lightbulb
        state: unavailable
    row:
      entity: switch.switch
  - type: conditional
    conditions:
      - entity: light.lightbulb
        state: on
      - entity: light.lightbulb
        state: off
    row:
      entity: light.lightbulb

In glance, there is nothing like that unfortunately.
EDIT: You can still use the conditional card as well but then it will show/hide the whole glance card

I know but it’s not really what I want,
I found that in an entities card I can use something like this

  - entity: sensor.pi_hole_core_installed_version
  - type: conditional
    conditions:
      - entity: light.plafond_slaapkamer_light
        state_not: unavailable
    row:
      entity: light.plafond_slaapkamer_light
  - type: conditional
    conditions:
      - entity: light.plafond_slaapkamer_light
        state: unavailable
    row:
      entity: switch.lamp_slaapkamer_real_left

but when I try this in a glace card I get an error:

Configuration errors detected:

    Required key 'entities.1.entity' is missing.
    Required key 'entities.2.entity' is missing.

Indeed, in glance there is nothing like “special rows” as in entities card.
As a workaround, I’d do a stack-in-card, horizontal and condition each glance cards.
Something like I did (partial code):

type: custom:stack-in-card
direction: horizontal
cards:
  - type: conditional
    - condition: state
      entity: light.chambre_enfants
      state: off
    card:
      - type: glance
        entities:
          - entity: script.turn_on_lights
            icon: mdi:toggle-switch
            name: Allumer tout
  - type: conditional
    - condition: state
      entity: light.chambre_enfants
      state: on
    card:
      - type: glance
        entities:
          - entity: script.turn_off_lights
            icon: mdi:toggle-switch
            name: Eteindre tout

that’s a nice solution, but unfortunately doesn’t do it for me.
So I think what I want is just not possible at the moment.

It is. If the card does not allow conditions, the put the whole card in a conditional card and create two versions. A bit more work and maybe some duplication, but it can be done. Other option is to create a template light that either calls the switch or the light depending on the state of the light.
Or, last but not least, you’ll proably also be able to get it working using:

I actually thought about all 3 of those solutions.

I have a glance card with 20 entities where I have this situation for 3 of them, meaning I have to create 8 glance cards for every scenario.

possible, but then I can use the more-info-card but that would mean I loose the history and device buttons. and I use those. so not an option at the moment.

I tried that one, and the unavailable filter works, but I couldn’t get an alternative one the work. the switches shown instead are always available.

for now, in my maintenance view I already had created I added the switches,
so if my bulb goes offline I need to go to another view to fix it. for me this is ok. however my wife probably disagrees, but the scenario is really seldom.