pull/20619/head
Diogo Gomes 2019-01-31 01:33:52 +00:00 committed by Paulus Schoutsen
parent 69ec7980ad
commit c7ff8d4996
1 changed files with 7 additions and 0 deletions

View File

@ -282,6 +282,13 @@ class HistoryStatsSensor(Entity):
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