Problem with energy monitor total consumption

Hello,
I have Energy monitor in use, with “total_increasing” state_class sensor producing kWh readings.
This worked fine, until I noticed huge spike in metered consumption shown in graph.

Checking SQLite database, it showed lines like this (these are after the “fix” I did, will explain it after pictures):
Before spike:


Reading after spike:

Point being: state increases consistently, but sum jumps over 9000 points.

To fix this, I ran query like this (ID being correct one from june).

UPDATE "statistics"
SET sum = sum - 9545
WHERE metadata_id = 60 AND id > 599998

This fixed it modifying approximately 1400 lines, and I was satisfied.

Until hour changed, and the error was moved to this moment. Now it looks like this for today:


The question is: why sum increases, even when state changes with way lower rate? And even more importantly: how to fix this?
I have this issue with another kWh sensor, with same kind of behaviour.

Don’t edit the database.

Go to Developer Tools → Statistics. Find the sensor you need to change. Click on the little ramp icon to the right. Find the time the erroneous reading was added and set it to something in between the previous and next.

You can get a reasonable time range to check by hovering your mouse over the bar in the energy graph you posted above.

You should then investigate why your sensor caused this. Most times it is because the sensor reports 0 instead of unavailable. If it is a template sensor this can be fixed. If it is an integration an issue needs to be raised.

Hello, thank you for the answer!
I have totally missed that statistic page. I was able to fix readings via it, luckily I have daily backups and was able to restore unmeddled version, for once I had done changes to SQLite db, statistics page did not show problematic values. Due to my meddling I lost yestrerdays values, but thats nonissue.

Here are original values before I did adjustments:



First one is bit tight, but point being: sensor reported approximately constantly rising values for state, as expected, but sum jumped over 9000 points. What could be reason for that?

Yes, but isn’t statistics -tables state the value which sensor sends? If, then sensor did not send a zero. Or have I misunderstood that? If so, its propably zero value issue, and I’ll do template sensor.

Show your template sensor.

This is not template sensor (at least yet), I have OpenEnergyMonitor, using emoncms platform:

sensor:
  platform: emoncms
  api_key: xxx
  url: http://192.168.0.19/emoncms
  id: 1

This creates sensors for all the feeds OpenEnergyMonitor has, and one of the feeds is cumulative kWh count.

Looks exactly the same as this issue which went stale and was never fixed:

I suggest you open a new one.

Will do.
I do suspect that this is not EmonCMS issue, for the other sensor with similar issue is Z-Wave plug, using Z-Wave JS integration.

Have an exact problem using AEON Labs energy monitor. It would seemingly at random record non-existent data, sometimes in the tens of thousands of kWh range. The total kWh is correct on the sensor summary page, but energy monitor sometimes shows over 100 K + kWh spent in one hour? I did try adjusting values in statistics, but I am tired of having to do it multiple times a day especially as I am imputing an arbitrary values since I don’t know how much energy was exactly spent. Doing this completelly invaditaes validity of recorded data which in turn becomes useless so why have it at all? This is very disappointing especially as my whole venture in to setting up HA was its ability to integrate variety on energy monitors for display and analysis. Is there anything to be done about this issue?