-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
history_stats doesn't always reset #121535
Comments
I discovered the same recently. Example:
I roughly know when this behaviour started... ...but not why.
There was no change on 2024-08-04 according to my event log. Only:
Idea number one:
that might match the HA 2024.2 release assuming @JonLaliberte installed it right in Februar - just a wild guess. Idea number two: Anyway, a dev needs to have a look at this as I (we) can only provide assumptions and indicators or wild guesses. |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
@JonLaliberte are you still seeing this issue on your side? |
@bcutter I see there is a draft PR that is meant to resolve the issue, but I can't confirm that it is valid, and I'm not 100% sure these are caused by the same problem (though it seems likely). |
@JonLaliberte - could you estimate about what percentage of the time the sensor fails overnight? |
@karwosts I checked another history stats sensor that is in active use (though doesn't have data every day as the switch isn't used daily) and it failed on the same days as this one did: I have not seen this happen since September 16th though. So maybe it was fixed somewhere... I'm going to set up an automation to notify me if this problem is detected going forward. |
I've setup a similar entity on my dev instance I'll monitor for a little while, with some extra debug logging, see if I can reproduce this at all. (unfortunately doesn't have much logging by default so there's not much to check when it doesn't work). Must be some subtle timing related issue but looking at the code I couldn't obviously see anything. |
Also trying another sensor that "resets" every 10 minutes, since that might be more likely to trigger than something once a day. Haven't seen an issue so far though. This paired with a sensor that alternates 3 minutes on / 7 minutes off.
|
Note: unchanged for me. But I'm not on latest HA Core release yet. Edit: |
In #133770 I propose a fix for a bug that feels very similar, but I can't tell if it's exactly the same as your issue here. Lets see if it helps. |
Let's see if it gets merged and when it would arrive... I think in a few weeks at best. |
Your diagnosis and solution look good to me. Hopefully this resolves it. |
The problem
I have some history stat's sensors set up, like this:
Most of the time, this works great. But sometimes it gets stuck:
Here you can see that the sensor was at 125 from about 12pm to about 10am. At that time I restarted Home Assistant and it reset the sensor's value to 0, then an automation kicked in which started it accumulating time again.
The problem is, this automation depends on this sensor to know whether or not to run - so if I had missed this, the automation would have never turned the switch on.
I have seen this issue happen sporadically for maybe 6 months or so now.
To be perfectly clear, I don't know that I would have noticed it much before that as I didn't use this sensor type as much before.
What version of Home Assistant Core has the issue?
core-2024.7.1
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
history_stats
Link to integration documentation on our website
https://www.home-assistant.io/integrations/history_stats/
Diagnostics information
No response
Example YAML snippet
The text was updated successfully, but these errors were encountered: