Open JonLaliberte opened 2 months ago
I discovered the same recently. Example:
- platform: history_stats
name: masked
entity_id: switch.masked
state: "on"
type: time
start: "{{ now().replace(hour=0, minute=0, second=0) }}"
end: "{{ now() }}"
# Update 2022-10-25: "scan_interval" not working anyway
scan_interval: 900
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: As @JonLaliberte mentioned
I have seen this issue happen sporadically for maybe 6 months or so now.
that might match the HA 2024.2 release assuming @JonLaliberte installed it right in Februar - just a wild guess.
Idea number two:
We both use the same start: "{{ now().replace(hour=0, minute=0, second=0) }}"
. Maybe something in HA Core's internals has changed when operating on these?
Anyway, a dev needs to have a look at this as I (we) can only provide assumptions and indicators or wild guesses. For me currently all my history_stats sensors are useless as not reliable
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