parent
d55693762e
commit
c544845e29
|
@ -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…
Reference in New Issue