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.
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
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
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.