Help with removing 'outlier' energy consumption from statistics/history

I hit a temporary issue with my gas energy consumption sensor last month, and I’m trying to remove it from my consumption history.

I’ve removed it a few times, but it continues to come back somehow after the current hour ends, pushing the latest hour up by the value I subtracted (~376kw).

I’ve done this by subtracting 376 from the sum for all of the statistics and state tables I could find for that metadata_id. (states, statistics, statistics_short_term).

At this point, restoring from a backup would do more damage, as I want to keep the last few weeks of data in general.

Anyone know the ins-and-outs? Much appreciated.

Go to Developer Tools, select the Statistics tab and locate your entity there. On the right you will find an icon described as “Adjust sum”.
Use it to find the hour/date of the peak and adjust the value there (or set it to 0).

2 Likes

Oh my god, there’s been a gui for this all along :man_facepalming:

Instant fix, thank you so much for noting that!

I tried this method but for some reason it does not work. So, I just messed up playing with PowerCalc sensors and I created artificial HUUUGE value for returning energy to the grid. Here is how it looks.
Normal day:


Messed up one (please note that here the result is negative and regular consumption next to it is so negligible that is not even visible):

As you can see the failure occured some time around the noon. Now, when I go to Dev Tools, energy entities and I select specific date and time, everything seems to look OK. Here is sample for one 10 minutes interval, but all looks similar for 12 hour:


Only reasonable values, far from being similar to wrong data I have on the chart.

One thig that bothers me, is that now I see additional entity created, that I think should not be there:


I did not noticed this one previosly… was it created automatically for Shelly 3EM or was created by HA when negative consuption happened? The problem is that it cannot be fixed, as it is not being recorded :flushed:
So how can I get rid of this messed up 1 hour data? Any hint?