mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 03:37:07 +00:00
Fix track_change error in utility_meter (#21134)
* split validation * remove any()
This commit is contained in:
parent
ce7f678b9b
commit
3b5ed7a20f
@ -83,9 +83,9 @@ class UtilityMeterSensor(RestoreEntity):
|
|||||||
@callback
|
@callback
|
||||||
def async_reading(self, entity, old_state, new_state):
|
def async_reading(self, entity, old_state, new_state):
|
||||||
"""Handle the sensor state changes."""
|
"""Handle the sensor state changes."""
|
||||||
if any([old_state is None,
|
if old_state is None or new_state is None or\
|
||||||
old_state.state in [STATE_UNKNOWN, STATE_UNAVAILABLE],
|
old_state.state in [STATE_UNKNOWN, STATE_UNAVAILABLE] or\
|
||||||
new_state.state in [STATE_UNKNOWN, STATE_UNAVAILABLE]]):
|
new_state.state in [STATE_UNKNOWN, STATE_UNAVAILABLE]:
|
||||||
return
|
return
|
||||||
|
|
||||||
if self._unit_of_measurement is None and\
|
if self._unit_of_measurement is None and\
|
||||||
|
Loading…
x
Reference in New Issue
Block a user