[SOLVED] How to avoid "missing entity message / error" in lovelace UI?

We have some devices that are manually shut off and therefore appear in the UI like this

image

How can I avoid that or change the behaviour to a less intrusive one ?

Thx

There is a feature that is called “hide_if_unavailable: true”,
but that one does not really work or only under very specific circumstances.

Here is a different way that works, but only for just 1 entity at a time.

So in case of such lights it will need a horizontal / vertical stack I have had already before.
One caveat in case of such lights: the single symbol of such row will be scaled up and therefore the whole becomes a higher. Here is the solution before and after in 1 picture

image

There is a kind of workaround or improvement in case you have 2 rows of 3 switches above each other cause the upscale factor and the height gain will be much less if you simply put not 2 in 1 row but 1 in each cause then 2 icons will be increased each by 50% instead of 1 over 200%.

That being said it is time for the code, right ?

not yet cause first you need to know that I had put the horizontal stack with the 3 bulbs in a vertical one cause these three are just a part of a bigger set of switches of each room.

type: vertical-stack
cards:
  - type: horizontal-stack
    cards:
      - type: light
        entity: light.xiaomi_gateway_light
        icon: 'mdi:lightbulb-on-outline'
        name: BÜRO
      - type: conditional
        conditions:
          - entity: light.wandleuchte_buro
            state_not: 'unavailable'
        card:
          type: light
          entity: light.wandleuchte_buro
          name: WAND BÜRO
      - type: conditional
        conditions:
          - entity: light.wandleuchte_buro
            state_not: 'unavailable'
        card:
          type: light
          entity: light.wandleuchte_couch
          name: WAND COUCH

Key is this line: state_not: ‘unavailable’

If an entity is in any other state than ‘unavailable’ the icon / entity will be shown, otherwise it will be hidden. If all 3 are unavailable there will be nothing.
Here you find additional infos worth to read.

I hope this will help all those that will search the same way I had in my mind "how to get rid of the these ugly “missing entity messages” … which had been solveable a lot easier by a search for how to hide an entity that is not yet available, but maybe soon.

The update till a bulb or light becomes available again in the screen takes about 20 seconds and also 20 seconds if you pull the plug. It is not an instant update, just takes a few seconds longer - at least here runing HA core on a Pi-4 2GB in docker