Record daily power useage

I have a power monitor for the house, and I want to collect the daily power usage, but at midnight the daily usage resets to 0 on the power monitor.

How would I get the power usage just before the reset?
Is there a way to trigger when it resets to 0, but be able to read the previous value?
I know I can just query the DB and get the last reading for the previous day say if I was to run it at 00:01, but just not sure of the most efficient way to get the value.

I want to be able to capture this so that I can run daily/7 day/30 day stats. Maybe there’s a way to do it with the history stats, but not sure how to do that given the value is constantly changing vs. a daily value (which is what I’m trying to capture above)

I’m already doing something similar for my rainfall, but the difference there is it doesn’t reset daily and gives an over all running total. So that capture is current value - yesterdays value.

create utility meters for this :slight_smile:
They do exactly this - creating daily, weekly, monthly, quarterly, yearly information and reset to 0 when their cycle has reached.

so
a daily utility meter will reset every day at 23:59:59
a weekly utility meter will reset every sunday 23:59:59
a monthly utility meter will reset every… and so on.

Without a reset option, the utility meter should continue counting and never reset.

I already thought of a way to “collect” those previous readings…
But this could be a bit more complex to acheive… an option that could think of is NodeRed… NodeRed does read the value - and for example - is wringting the new value into a Database … so it always updates the old value with the new one - until the new value is lower than the old one.
In this case, a new row would be inserted.

I also want to get some long term statistics and knwo how much energy I’ve used / exported for each single month of the year.
Unfortunately, I don’t think that this is possible within HA itself.

That pretty much just duplicates what I have already built into the Emporia sensors for total daily consumption. Ultimately I want to track the last 1/7/30 days totals summed up in a rolling window, not have the sensor start at 0 and start over.
So on Monday the reading is the total power used from Tuesday to Monday, then on Tuesday it’s Wed to Mon, and so on.

oh okey - sorry - then I misunderstood your first description :frowning:

Well I probably said it horribly. Thanks though, the meters will come into play for other things now that I know they exist.