Is it possible programmatically to list a entity as offline as opposed to unavailable? Checking under Developer Tools for one on my radar I don’t see any option other than unavailable. I am just trying to determine can you change a default state setting (on entities card for reporting) to something more custom on entities card.
It is not possible to change the “default” state of an entity. What you can do though is create a template sensor that does what you want.
The following would give you a binary sensor that is only “on” when the device tracker’s entity state is “home”. In all other cases, including “unavailable”, the state will be “off”.
This sensor’s state will show as “Detected” or “Clear” in the front end because I have set occupancy as the device class. If you want a more custom state output you can create a template sensor (instead of binary sensor) and set the state in the template.
Understood and not sure if you caught my revised post. I just want to change how its reported, not alter the states the integration author used when coding it. I have a fairly bare bones HA setup so I don’t yet have an occupancy sensor like the one you illustrated above. I would need to do this for several sensors for a NAS that is periodically on at times.
So I want to list a couple sensors within the entity, but I want the customization come into play when the device is offline, not online. Problem is when this device turns off I get the ugly device unavailable which I’d be fine with except it looks like this on the dashboard.
Ah, I see what you’re up to. The template I gave was just an example. Your YAML was way off though. Have a close look at the template docs I linked to.
Anyway, probably easiest solution if you only care about UI would be to use a conditional row to hide the sensor when your NAS is offline.
I am not too good with Yaml, but you got where I was going. Since my dashboard has many entity cards will it be present and empty or is there a way to hide the sensor and entity card? Also went back and forth seeing if your second suggestion would be workable for what I am after?
The ugly eyesore that shows up when an entity is not available and I am at the latest release of HA and I cleared my browser cache and went it to HA fresh. Which is good. Any idea why your sample code presents this message?
Life happens so I fell of the map for a bit. You last asked for me to post the code generating No type provided. Admittedly I was trying make your code work with what ChatGPT suggested and bad idea. By its own admission its not even up to date with HA.
If I take the first 7 lines of your code above which I assume was formatted correctly I get this.