Thanks for sharing, Henrik! I’m trying to do something similar by recording a rolling 7 day sum of the rainfall in my area based on a sensor I have that tells me yesterday’s rainfall.
I set up the template sensor that updates once per day, and the statistics sensor that does a sum of the previous 7 days’ data. However, I found that the template sensor updates every time I restart HA or reload the configuration, artificially inflating the statistics sensor.
I was wondering if you ran into this problem and had a fix? I’m guessing it’s less obvious in an average of max values, but presumably you’re also getting multiple entries due to restarts.
@solstyce9 i have just installed a rain meter and I stumbled upon using Utility Meter integration. I have it set up to produce hourly, daily weekly and monthly sum of rain events. Still testing but it looks good. I guess you can then run statistics from there?
Edit: ddoooohhhh and to your answer the original problem my numbers survive HA reboot.
Interesting, thanks for the pointer! I took a look and it looks like it will do fixed period sums. Unfortunately, I’m looking for a rolling 7 day window - if there hasn’t been enough rain the last 7 days it’s time to water - so that won’t work for my use case.
But a very cool integration. That’s the best part about Home Assistant - it’s constantly evolving and improving so there’s always more to learn!
@solstyce9 Can you run a statistic on each proceeding day. The data is there but it needs to be calculated. So much easier in Excel! At some point, for me, this would be goood to solve