The ‘datetime’ works and matches the point in time when the high value was recorded.
My ‘issue’ is I’d like it to be within the 24 hour timeframe, but seems to be more in the line of midnight the following day that it updates. In fact ideally I’d like it to be for the current day, but that is nigh on impossible (I could use a statistics card but Mushroom cards are so much nicer looking when you customise them).
I’ve even set up an automation using the service ‘home assistant core integration: reload config entry’ (I’ve also tried ‘update entity’ in the automation, which did nothing), running every 30 minutes, but that doesn’t bring it within the 24 hours.
The only time that I see an entry update to within the 24 hour period is when I restart home assistant completely after updating or adding code, which obviously isn’t a usable solution for regular updates.
So far I haven’t found a solution to this. I’ve tried just using minutes, hours, days etc etc.
If I set up a short term statistic sensor, 5 minutes for example, as an experiment it refreshes reliably when, as an example, the max wind speed hasn’t been exceeded it will show a more recent max wind speed that is lower.
However, with longer periods, no matter how they are defined, they don’t update when you expect them to.
I have set up an automation that will reload all statistics sensors at 3am in the morning (regular refreshes would be crazy as the time taken to load the proper data is 10 or 15 minutes), so if I don’t find any better solution I will activate that, and the statistics will be relatively up to date at least.
If anyone else has suggestions that might work without using a daily automation it would be much appreciated.
What I’ve found is that the age only starts when HA last rebooted.
So if you’re adding more coding etc, you’re going to reset that period when you reboot to load it.
If you check the attributes, age coverage ratio reaches 1 when you have run the complete period of time without rebooting, and only then will it update within that time period.
Part of the issue is the constant updating of HA versions, which especially for time periods covering days, weeks and longer means you’ll probably never reach age coverage ratio of 1.