Today I recognized, that the time for today was not reset, but still showed me the duration from yesterday. After the door was opened and closed for 11s today, the duration for today fell back to almost zero (which is actually correct). However, i expected the drop to 0 at midnight and not after the first event today.
So for me it seems, the statistics (or my config?) required a state change today in order to update the statistics for today. Is this the expected behavior for the history stats? If so, it is very confusing/unexpected to me.
It should render upon state changes of the source sensor and every minute. Clearly yours wasn’t updating every minute, but I’m interested to know if that was a one-time error or if that happens every time?
so I checked this sensor if there are any weird state changes in the past. It seems all fine, except for the single instance I highlighted in the initial post:
Besides the “not resetting at midnight” problem, is your sensor even climbing at a 1:1 slope when the source is “on”? It appears to be jumping to some value just after 16:00 on your graph.
The way you’ve configured your history_stats sensor (using “time” and a window that starts at midnight each day), the graph should only be constructed with 3 distinct segments:
A constant rising slope of 0.17 hours (i.e. 1 minute) per 1 minute of time on the x-axis, when the source sensor is “on”
A flat horizontal line, when the source sensor is “off”
A vertical line from some value down to zero, at midnight when it resents.
Can you also show the history of the source sensor when you take images?
Here’s what I would expect to see. This is for my HVAC, showing when it is cooling and when the fan is “on”. I’m also showing the state of the uptime sensor (“uptime” is an integration that can be added to give you a timestamp of when HA started). This is useful to see if any of the issues correspond to HA restarts.
Let me know, if there are details missing. Unfortunately, my uptime sensor has only 2 days of history … did not notice that before. It should have more, since I added it weeks ago…
The zoomed part shows the source sensor for today. It rises in steps, while the door is open. Exactly as you wrote. However, sometimes the source sensor jumps and if this happens it does not reset at midnight. Maybe an indication for something?