core
core copied to clipboard
History stats sensor will become unknown after the end of the measuring period
The problem
When creating a history stats sensor which measures something during only part of the day, the sensor becomes unavailable after the measuring period ends and stays this way until the measuring starts with a reset again. Correct behavior should be for the sensor to stay at the end amount until resetting and starting over.
What version of Home Assistant Core has the issue?
core-2024.1.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
History stats
Link to integration documentation on our website
https://www.home-assistant.io/integrations/history_stats/
Diagnostics information
No response
Example YAML snippet
- platform: history_stats
name: Ellinore nightly screen time
unique_id: history_stats_ellinore_nightly_screen_time
entity_id: binary_sensor.ellinores_phone_interactive
state: "on"
type: time
end: "{{ (now().replace(minute=0, second=0, microsecond=0) + timedelta(hours=17)).replace(hour=7) }}" # end at 7, at right side of dateline
duration:
hours: 8
Anything in the logs that might be useful for us?
Didn't spot anything of interest
Additional information
I believe the correct behavior should be that the amount at the end of the measuring period should remain until the measuring starts again at the starting time. Correct me if I'm wrong. The way it works now, I have to create a template sensor to correct the behavior, skipping unknown state.
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. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.