Tons of statistics repairs required

I installed the latest Spook update after updating HA to 2026.8 and now Spook is showing me this repair:

image

Opening the repair I’m met with a WALL of statistics to repair (notice that this only around a fifth of the repairs listed as indicated by the scroll bar):

This brings up two things…

First how is it that all of these entities have statistics that are messed up somehow and needing fixed? How to prevent this from happening in the future so I don’t have hundreds of statistics entries that need fixed?

I don’t understand why it seems that every time we delete an device/entity we need to go in and manually delete the associated statistics entries instead of the system removing them automatically? I’m finding statistics entries from entities that have been gone for months or years in the list.

and that brings me to the second question (yes probably a FR and yes I know we aren’t supposed to post these here) but why can’t we have a “fix all” button?

We are forced to go thru all of these one by one to fix the issues. It takes forever to click on each entry, click “fix issue”, click delete (which is the only option), wait for the spinner to spin for 10 seconds (on each and every entry) to tell me that it’s taking to long and click OK to continue in the background, then do exactly the same for all hundred(s) entries.

Is there an easier way to do this that won’t take me an hour or more of continuous clicking and waiting to fix all of these?

You can select them all and fix them all at once.

Can you provide more details on one of the problematic entities?

I’ve fixed them all by now (too bad I didn’t see the post by Tom above first to try that instead of one at a time). Not all of them made me wait the full 10 seconds of spinning so it was a bit faster than an hour.

But I’m pretty sure that all of the entities that needed fixing were from entities that had been deleted.

From memory the issue said something along the lines of “the entity no longer has a state”. And from memory the entity_ids were ones that had been deleted. One I definitely know hasn’t been in my system for almost two years.

@anon11644107

that is certainly a very small and obscure select box. I never even saw it until you pointed it out.

But thanks for letting me know.

Just for additional info…

I removed three entities from my system yesterday and I immediately got the spook repair telling me that the statistics for the three entities needed fixing.

so that tells me that something is broken somewhere:

  • either HA should be removing orphaned statistics from the long term storage automatically
  • or HA should natively be raising a repair that the stats need to be fixed. That shouldn’t be something that needs a third party integration (that literally just started doing that as well) to tell me there’s an issue.

Like I said many of those entities have been gone for years but I had no reason at all to go to the dev tools stats page to notice I had hundreds of repairs to perform.

On the bright side I got the chance to test the multiple selection fix that tom pointed me to and it worked ok. it was a bit clunky tho.

I clicked on the select button and selected the three entities that needed fixed and then clicked the “delete these” button at the right…and then nothing happened…at all…

so I navigated away for a bit to see if they would go away on their own at some point. but when I came back 15 minutes or so later they were still listed.

So I went thru the same exact steps as above and that time they immediately went away.

So yeah it worked but clunky.

Spook is frenk’s test platform for things that might make it into core. So the repair may eventually be implemented.

The stats definitely can’t be deleted automatically as that would stuff up data continuity when replacing a device.