Cleanup HA database?

Is there some way to find and remove old unused entities and other such debris from the HA database

Developer Tools - Statistics will show you any issues, including entities that aren’t provided anymore but still have DB data as well as let you choose what to do with them.

And it pretty much does it itself for most things. Specially what are you looking for.

So I can just FIX aka delete all those marked as fix?

Not being able to see what you’re seeing maybe. Fix usually is either deleting stuff or changing fields (maybe unit of measurement) depending on what’s being fixed. And how you answer depends on if you need the data to stay.

I mean if it’s an orphaned entry sure it’ll whack it and next cleaning process will get rid of the artifacts. By default you get live stats for anything for 10 days then it’s reduced to history stats. Energy dash runs once an hour. I think there’s a daily process that runs sometime around the backup. So if you ‘fix’ an orphaned entry. It’ll probably be a delete action. At which point any artifacts are now doomed within 10 days. This is all a gross oversimplification but yeah basically.

I had 30 or 40 orphaned entities and I zapped 'em. They also showed up under the entities list marked with a :no_entry_sign:

1 Like

If you’re looking for cleanup tools, also look at Spook (in HACS) and watchtower they can help you ID entities and things that got left in scripts and dashboards. I find when I have orphans they tend to travel in packs :wink:

Perfect, that’s what I was looking for how to find garbage. I’ve got about two years of learner debris I’m trying to clean up and my system although not the most complicated is non-trivial: 50+ integrations, 18 add ons, 50+ HACS, 164 devices, 1500 entities, and 110+ automations and scripts. So there’s a lot of garbage
Thanks

1 Like

You can delete those as well. In bulk if you use the entity selector.

2 Likes