Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions homeassistant/components/sensor/history_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,13 @@ def update_period(self):
if end is None:
end = start + self._duration

if start > dt_util.now():
# History hasn't been written yet for this period
return
if dt_util.now() < end:
# No point in making stats of the future
end = dt_util.now()

self._period = start, end


Expand Down