-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
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 (type: time) problem when restarting Home Assistant #80871
Comments
Is anyone looking into this yet? My guess is that it must be very easy to fix. Just check if the 'on' timestamp has been assigned a valid value, when the 'off' event occurs. |
Hi all, the same problem here! Entity config:
Hope we can solve the issue, I'm available to test something if needed. |
This is also reported on community forums. https://community.home-assistant.io/t/history-stats-sensor-creates-wrong-data/476466 cc @bdraco who's been working on significant improvements to UPD: I'm on 2022.11.5. |
Same Problem here:
This works and sums the hours P1 has been |
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. |
With all Home Assistant components up-to-date this issue still persists. |
I also have the same problem, calculating how long a binary sensor has been on. Restarted HA this morning and it went from about 1h 10 minutes to 8h 15 minutes. To be more precise, the different was 7h 19 minutes, for two historical_stats sensors measuring two different input booleans. |
I think I'm seeing the same issue, basically when I upgrade Home Assistant and it restarts, my history_stats type:time based on a binary sensor values are wrong for the next 24 hours, with odd spikes. See the screenshot, you can see the time period after I did the restart with all of the odd spikes: |
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. |
The problem
I found that my History Stats sensor increases with a rather large (random?) number when I restart Home Assistant.
Here is my sensor in sensor.yaml
Here is an example:
At around 16:xx hour you can see a sudden unexpected increase.
Here is a part of the log of the binary sensor.
When it dawned to me that it might have something to do with restarting Home Assistant, I tried that again and could easliy reproduce the problem.
My guess is that the start time of the History Stats sensor is undefined after restarting.
What version of Home Assistant Core has the issue?
2022.10.5
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
No response
Link to integration documentation on our website
No response
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: