Handle statistics for sensor with changing state class (#55316)

This commit is contained in:
Erik Montnemery 2021-08-27 16:18:49 +02:00 committed by GitHub
parent cc857abfd2
commit 7e70252de5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 158 additions and 24 deletions

View file

@ -352,7 +352,7 @@ def compile_statistics(
# We have compiled history for this sensor before, use that as a starting point
last_reset = old_last_reset = last_stats[entity_id][0]["last_reset"]
new_state = old_state = last_stats[entity_id][0]["state"]
_sum = last_stats[entity_id][0]["sum"]
_sum = last_stats[entity_id][0]["sum"] or 0
for fstate, state in fstates: