Don't reset meter when last_reset is set to None (#56609)
parent
931cf4eaab
commit
58f465f271
|
@ -445,6 +445,7 @@ def compile_statistics( # noqa: C901
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
!= old_last_reset
|
!= old_last_reset
|
||||||
|
and last_reset is not None
|
||||||
):
|
):
|
||||||
if old_state is None:
|
if old_state is None:
|
||||||
_LOGGER.info(
|
_LOGGER.info(
|
||||||
|
|
|
@ -494,9 +494,9 @@ def test_compile_hourly_sum_statistics_amount_invalid_last_reset(
|
||||||
"min": None,
|
"min": None,
|
||||||
"last_reset": process_timestamp_to_utc_isoformat(dt_util.as_local(one)),
|
"last_reset": process_timestamp_to_utc_isoformat(dt_util.as_local(one)),
|
||||||
"state": approx(factor * seq[7]),
|
"state": approx(factor * seq[7]),
|
||||||
"sum": approx(factor * (sum(seq) - seq[0])),
|
"sum": approx(factor * (sum(seq) - seq[0] - seq[3])),
|
||||||
"sum_decrease": approx(factor * 0.0),
|
"sum_decrease": approx(factor * 0.0),
|
||||||
"sum_increase": approx(factor * (sum(seq) - seq[0])),
|
"sum_increase": approx(factor * (sum(seq) - seq[0] - seq[3])),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue