Fix track_change error in utility_meter (#21134)

* split validation

* remove any()
pull/21238/head
Diogo Gomes 2019-02-18 04:40:51 +00:00 committed by Paulus Schoutsen
parent d55693762e
commit c544845e29
1 changed files with 3 additions and 3 deletions

View File

@ -83,9 +83,9 @@ class UtilityMeterSensor(RestoreEntity):
@callback
def async_reading(self, entity, old_state, new_state):
"""Handle the sensor state changes."""
if any([old_state is None,
old_state.state in [STATE_UNKNOWN, STATE_UNAVAILABLE],
new_state.state in [STATE_UNKNOWN, STATE_UNAVAILABLE]]):
if old_state is None or new_state is None or\
old_state.state in [STATE_UNKNOWN, STATE_UNAVAILABLE] or\
new_state.state in [STATE_UNKNOWN, STATE_UNAVAILABLE]:
return
if self._unit_of_measurement is None and\