I’ve had some devices that, after various upgrades, have stopped using/providing certain entities. But I’ve noticed that some (if not all?) are still there, just as “unavailable” with a note:
This entity is no longer being provided by the XXX integration. If the entity is no longer in use, delete it in settings
Meaning manually deleting each. And if these are some that are not commonly used (I can certainly count on zero hands how many times I’ve used the sensor.lumi_lumi_plug_electrical_measurement_rms_current or sensor.lumi_lumi_plug_analog_input, two of the ones for a ZHA integrated switch), they can accumulate over time so removing manually would be quite a nuisance.
At the moment, I see entities from Z-wave, ZHA, as well as entities from a few HACS integrations (I guess for these, it wouldn’t be a “core” issue, so if this is possible, I’ll open issues with each of the custom components).
Some of the unavailable are just devices downstream of a smart plug that’s off, some might be out of battery, some might be light bulbs where the kids (or guests) have accidentally flipped the switch, etc.
So it’s only 30 seconds if you are sure everything unavailable should be deleted. I know for a fact that it shouldn’t, but for most entities, I have to open each, and look at related (or track in some other way) to be somewhat sure about which are which.
With the >10 pages of unavailable I have atm, that’s… more than 30 seconds. significantly more.
I’m not saying I won’t do it, I’m just saying it would be nice if integrations “cleaned up after themselves” when they kill off entities they created.
I’m fairly certain that they don’t clean up after themselves is because they don’t have the ability to see what they created in the past after that section of code is removed. I’m sure a mechanism could be created to handle that. Just not sure how accurate it would be. You might end up losing actual entities.
It’d have to keep a rolling list of entity registries it created (or accessed) “this session” and remove the ones that weren’t used. Not sure if it’s even possible with how entities are generated.
It looks like it knows which integration created them, the devices they belong to are up and running (HA is aware of them and their integrations), they just (apparently) don’t use/provide those entities anymore.
Yes, I already explained above what the limitations are. The entity_registry stores that integration information. However that doesn’t mean that the integration knows or is using that entity, and it wouldn’t know until the next onboarding process (startup). That’s why you can’t delete entities that just go unavailable during your current session. The integration doesn’t know they are gone until the next restart. So whatever would get implemented for this WTH, would have to be done during the startup process.
Also, you get into the odd circumstances with yaml and the unique_id. What if you didn’t want the integration to delete it because you accidentally changed the unique_id in your yaml? Now if you change it back, all those settings are lost. So there’s a trade off here.
Or if it’s a bug in the system, just for a single patch version of home assistant. Now instead of having unusable entities, the entities are just missing. The entity_registry is now deleted so when the bug is eventually fixed, you now have to reconfigure it all.
I’ll just sit and hope this can/will be possible at some point
EDIT: Am I correct to assume that if I do accidentally delete one that was just temporarily unavailable, it will just re-appear once the device comes online? Will there be any effects of this (e.g. will the unique_id change, and will that matter?)
I have the same message on my zha coordinator. I sure don’t wan to delete my conbee II device. All my Zigbee devices are inactive, and there is nothing I can do. Conbee just stopped with no reason. No restarts, no updates, no messing with Yml files. The Virtual box (on win 10) simply refused detecting Conbee. I could see the stick in Deconz but not when Virtual box was running. Updated VB, now Conbee is detected but I get the darn “no longer being provided” message. NIce. I’m thinking, is it actually so bad to get rid of the whole HA games and just deal with Alexa? It looks like a midget compared to HA but at least I don’t need to stay up all night to fix issues every couple of weeks! (2:00am in Melbourne now!)