How to fix an anomaly in energy statistic?

In the past I leveraged the statistic adjustment in dev tools to fix an erroneous value for an existing statistic.
This time seems different as I do not have a statistic to fix.
0623batterycharge-energy
So I have the statistic sensor.qcells_cloud_battery_charge_kh presenting a jump in value, once I go to dev tools/statistics I find no values in the corresponding timeframe.


If I check the entity I notice this odd gap → FWIW the QCell API and app I am leveraging do not present the same gap in data.

I tried to look into the db, finding the statistic metadata_id, I see the gap reflected in the state and sum values


What should be the resolution approach in this case?

I have observed a similar behavior and raised a bug, see Cannot fix invalid energy dashboard data · Issue #17010 · home-assistant/frontend · GitHub

This looks like the sensor on the device has been reset?
I don’t know what integration you’re using, but maybe this page gives some more insight into what is going on: Developer docs sensor - Long term statistics

I suspect it’s a bug in the integration, where it uses the total state class without a last reset parameter, but it does reset.

As for fixing it, i think manually adjusting the sum values in the databases to line up with actual usage should do the trick, although that one hour of usage is going to be inaccurate either way.
I believe that on update it only looks at the previous state for calculations, so it should be fine until next reset.