Handle "entity not found: ..." warning

Hi, I am setting up my first dashboard and everything seems to work well. However, one of my lights is a bulb connected into an old electrical circuit with an actual switch in the wall. Whenever the bulb is turned off, I get an “entity not found” warning instead of the name in the dashboard. This is the correct default behavior AFAIK.

However, I would like for this bulb to not change it’s name in the dashboard and just become “disabled” or similar. Is there a way to handle this correctly? Can I somehow define a “state” or something similar, to set how the dashboard should show this entity if it is unavailable?

Thank you for your help and feel free to link me to the appropriate topic if this question has already been asked and answered, since I failed to find it myself.

Yes, use a template sensor https://www.home-assistant.io/integrations/template/ . You then use the template sensor in your UI as opposed to the light entity. Through the template sensor you will be able to redefine state so that when the light entity is unavailable you can make the state say whatever you want.

Does this have to be handled in HA directly, or is there a way to handle it on the HADashboard side?

You could do it in the UI if you had a display item that allowed you to template the state like the custom template-entity-row. But in either case you’re using Jinja and I prefer doing it in a template sensor because the work is done in the backend while the display is done in the front end. What I see on my system when doing front end display manipulation is momentary flashes of the Jinja code before it is resolved. That won’t happen with a template sensor. The work is the same and likely the code is no different.