Summarizing energy cost (not using energy dashboard)


I have come across a problem with the utility meter, or maybe not a problem but I need help and maybe someone else knows the answer.

I have one sensor that shows the current consumed energy every hour.

It goes both up and down beaus I have solar panels and a battery and all the modbus registers from the inverter are not updated exactly the same time.

I also have a sensor showing the energy price. I have combined the two to show the total cost every hour.

This works great but now comes the tricky part. I want a sensor summarizing the cost per day and month but it looks like the built in utility meter is unusable for this.
If I use a meter set up with all options set to false it works as long the input sensor never decreases, mine dose a little bit, and when energy prices are negative it dose as well. If I tick in “Net consumption” this solves the problem until a new hour is coming up, then the input sensor goes to 0 and the meter gets messed up. Ticking “Periodically resetting” dose not solves the problem as I was hoping at first.

Dose anyone her have a solution to this?

Picture of hourly energy cost sensor: