Showing average curve in history card

Hello everyone,
I need some assistantce on how to integrate statistics the right way.

I want to show the average curve for one day.

For exaple I have a sensor for the battery capacity. I showcase this sensor on my dashboard using the histoy card like this:
grafik

To get a better feeling on how fast my battery gets discharged on the current day, I want to also include the average curve on the graph. Lets say the average over all datapoints for 3 o clock is 60%, this average curve should go through this point somewhat like this:

grafik

So the actual date should get ignored, only the time of the day is important.

How would i implement this in Homeassistant?
Thank you for any help

Have you found a solution? I want to implement this for multiple sensors (temperatures, co2-leves, internet usage).

Create a statistics helper for whatever flavour of average you want (mean, median, step etc) and make sure you add that new statistics sensor to your recorder then restart. Then you can now add the new average sensor to your history graph.

image

If the sensor in question is collecting long term statistics, your other option is to use a statistics graph which will show you the mean average automatically.

I know the thread talks to AVERAGE, but I find it usefull to compare to the previous 2 days, using plotly graph. So the yellow line is representing the value 24H before the red line, and the orange line is -48H.

image