Correcting statistics but no result

I am trying to repair some statistics. Where I managed to do this a successfully in the past, I am lost now. Likely I am missing something as it only updates the SUM and not the STATE

  1. My stats in a graph

  2. The statistics-adjust screen for sensor.solar_generated_daily show my corrected values

  3. the db also still has the old ones (in line with 1.)

“Statistics” refers to the long term statistics. There is no method via the UI to change what is saved by the recorder integration into the states database.

As you can see from the query, I am referring to the state in LTS, not that one in states. LTS for this sensor is incorrect now as state and sum misalign from row 42/41. I opened a case as this did work before

Sorry I should have read through this more closely. Is this sensor’s state_class set to total_increasing?

I am not sure what that has to do with the not-able-to-correct issue but yes…it is a utility meter, total increasing with reset daily.
As I could correct the values (they now show good for attr. SUM)… I would also expect the STATE to be in line

One thing is still confusing me now that I look at it. The corrections are done on a 5 min interval but the actual LTS are on a hourly interval (as they should) so I do not know how the 5-min data corrects the LTS, they are not stored in short-term statistics anylonger…curious

For LTS look at the statistics table.

Did you look at the query?

Ok, I see. The difference between sum in rows 41 and 42 does not match the difference between state. As far as I know this can by fixed by correcting all subsequent sum records, but the HA container needs to be shut down. Otherwise it will write bad records again at the next hour. I’ve fixed this doing that with HA running (HAOS) but also had to adjust using the stats repairs in the UI. Messy. Happy to know if there’s a better method.

Yeah. . I do know how to fix this but I was wondering if this is a bug in the statistics correction thing or expected behavior. I assume a bug right now as they donot map.
All in all this correction thing is not user friendly at all and one can argue that this is ‘exception’ based… I have quite a few of those ‘exceptions’ :slight_smile:

It is the second time I hear thaat editing LTS from the gui seems to fail. One more and it no longer a coincidence?

I’ve had many instances when correcting from the GUI does not seem to have any effect, that if it even shows stats entries that appear to map to the incorrect entries in the db. I ended going through the cumbersome process of editing db data and then playing with the GUI fixing tool.