Daily Average Energy Cost


I want to create a sensor for daily average cost of energy.
I was looking into GitHub - Limych/ha-average: Average Sensor for Home Assistant but probably first I need to create a sensor that getting the total daily cost each day.

I’ve energy integration running very well and have the sensor:
- sensor.energy_daily_consumption_cost
that increases and resets an the midnight:

Any idea how to achieve it?

You got this to work ?