Calculate value's for today while sensor data always increase

Hi,

I have a sensor from DSMR that gives me the total energy consumption. The value of this goes up all the time (as you consume more over time)
I want to be able to calculate how much energy i have consumed today.
I thought maybe it is possible to select the latest data point just before midnight and subtract this from the current value, as such i would get the delta from today, but i have no idea how to accomplish this.
Any suggestions?

create an input_text or input_number (as appropriate) to hold the prior day value.

Then create an automation that updates that entity only once at midnight.

Then you can use that value to compare for the next 24 hours until it gets updated again at midnight.

Or just use the utility meter with a daily cycle:

2 Likes