Statistics: fix ONE occurence of wrong data

Here is a statistics graph for some sensor:

The problem is that a glitch occurred at some moment of time - a “99999” value for a humidity was reported by integration.
Is it possible to remove only THIS particular occurrence from DB?

Have you tried Dev tools>statistics?

I see no tools in “Dev tools → Statistics” to edit ONE occurrence.

If you find the entity and click the symbol on the far right you can edit the statistics

Repeat: no tools.

So, using SQL is the only way?
Unfortunately, do not know SQL at all…

OK, with the ref to statistics in your OP I assumed the entity had statistics

The entity HAS statistics.
The list in Dev tools → Statistics only contains entities with statistics.
But HA does not think that this entity has issues - that is why there is no tools to fix statistics for this entity.

I have lots with no issue with the edit statistics button

According to my observations, this button only occurs if some conditions are met.
In my setup I only see this button if “state_class: total_increasing” is set…

Managed to fix my DB for wrong values for temperature & humidity (see 1st post).

  1. Stop HA container.
  2. Move db-file to some shared folder.
  3. Move db-file from this shared folder on some Windows-machine.
  4. Open db-file in SQLite Expert.
  5. Open a table with long-term staistics.
  6. Filter a “max” column with “99999” value (found 2 records - probably for a temperature & humidity).
  7. Manually edit “max” & “mean” values (set them equal to “min”).
  8. Move db-file back to it’s place.
  9. Start HA.

After a fix - spikes removed:

P.S. I do not know SQL, so my solution is not the best…

1 Like