Make new cycles for sensor sum statistics start with 0 as zero-point (#55473)
This commit is contained in:
parent
88a08fdf57
commit
f9225bad5f
2 changed files with 12 additions and 15 deletions
|
@ -403,11 +403,8 @@ def compile_statistics(
|
|||
# ..and update the starting point
|
||||
new_state = fstate
|
||||
old_last_reset = last_reset
|
||||
# Force a new cycle for STATE_CLASS_TOTAL_INCREASING to start at 0
|
||||
if (
|
||||
state_class == STATE_CLASS_TOTAL_INCREASING
|
||||
and old_state is not None
|
||||
):
|
||||
# Force a new cycle for an existing sensor to start at 0
|
||||
if old_state is not None:
|
||||
old_state = 0.0
|
||||
else:
|
||||
old_state = new_state
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue