Over time I’ve retired entities and there are configuration changes end users can make that mean I need to not populate ‘control’ entities when the device no longer allows external control. When I don’t create the entities home assistant has the ‘This entity is no longer being provided by the bambu_lab integration. If the entity is no longer in use, delete it in settings.’ banner in the entity popup. Is there an easy way I can enumerate entities associated with my config entry that are in that state so I can automate removing them? I dumped what’s available from the entity registry and it doesn’t look like there’s anything tracking that state. Other than adding book keeping to populate a list of every entity I added this integration load, is there an easier way to find those dead entities automatically?
Take a look at Spook, see if that’s a good fit. I don’t think you can automatically remove entities, but it will inform you if you have non-existent entities in automations for example.
That or
I meant to post this to development not configuration. I’m not trying to run a separate integration to tell me about orphaned entities. I want my own integration to self-police and delete entities that are no longer being created - either due to changes over time in how the integration presents things or because permanent changed state of the device means some entities aren’t applicable now that were previously and so got created and now are orphaned.
I got hopeful seeing the ‘missing’ possibility you had for state in watchman but I’m not seeing that - the non-existant entities just have a state of unavailable. And unfortunately I have some entities that do that when they aren’t usable for the instantaneous state of the device so that’s not enough.
Apologies. That was not clear to me from your initial post.
I suddenly thought to check the frontend code that adds that banner. Apparently the magic is state.attributes[‘Restored’] == true