Remove faulty readings from energy dashboard history

For whatever reason, the python script that reads the cumulative power consumption readings from my electricitymeter using an IR cable, send a bunch of faulty readings to HASS OS. It somehow mixed up the day and night/weekend numbers and somehow mixed in the total (day + night/weekend) numbers as well.

That strange behavior of the python script aside, just now I removed the faulty readings from the database with the help of the SQLite Web addon, but the energydashboard seems to remember those readings and still claims I used up almost 140000kWh yesterday.

How can I remove faulty readings from the energy dashboard?

edit: I managed to remove the faulty readings with

DELETE FROM "statistics" WHERE metadata_id = 6 AND sum > 40000
and

DELETE FROM "statistics" WHERE metadata_id = 7 AND sum > 0

Now to prevent faulty readings from being send.

1 Like

I had something similar with my statistics. A sensor was giving wrong values, api request from server was 0 instead of total. I think there was some server maintenance. The next values where correct and the sum was just adding the value difference from 0 to the new correct lifetime energy. This was a huge amount. The problem is that the statistics should not have negative delta’s allowed from lifetime energy solar panels. It will never be negative. So I am not sure where the fix needs to be made. But the best place is to make the statistics a bit more smarter.

1 Like

solution in my case whas

UPDATE "statistics"
SET sum = sum - (18493.302 - 824.4379999999983)
WHERE metadata_id = 43 AND sum > 850
2 Likes

DELETE FROM "statistics" WHERE metadata_id = 6 AND sum > 40000

Where do you find that info?