How to store e.g. a sum of values for a day as as new entity?

Hello, I’m using Home Assistant 2022.2.9.

I have already a lot of devices and automation (e.g. put on light when push a button) works.
But I also have values like kWh (consumtion of the house), which I want to save for a long time.
I know the recorder-integration, but I didn’t find something in docs how to save historic values in a new value for longtime-saving.

Example:
Power-Consumtion of the house will get hourly.
I want to sum the hourly values as one value for a day, when the day is over and only this value should saved for a long time.

Is there a function or possibillity to do this in ha?
I think when the new value is saved, I will get the rest for setting up the recorder-integration for this new value.

Many thankx for ideas or suggestions, maybe there is a complete other way to do such a thing?

Tom.

It sounds like you’d be interested in the energy feature of HA, it uses the long term statistics integration.

Thank you, @Tinkerer. I will have a look at the statistics integration. I will report the next days, if this is a solution for me.

I found a solution for my case, I will use the template .
So I can make new entities and can purge the old values via recorder.