Updated variable name for readability (#21528)

This commit is contained in:
Victor Vostrikov 2019-02-28 13:05:39 +01:00 committed by Fabian Affolter
parent bfc6f51b25
commit 342ddbfe8c

View File

@ -381,7 +381,7 @@ class Person(RestoreEntity):
@callback
def _update_state(self):
"""Update the state."""
latest_home = latest_not_home = latest_gps = latest = None
latest_non_gps_home = latest_not_home = latest_gps = latest = None
for entity_id in self._config.get(CONF_DEVICE_TRACKERS, []):
state = self.hass.states.get(entity_id)
@ -391,12 +391,12 @@ class Person(RestoreEntity):
if state.attributes.get(ATTR_SOURCE_TYPE) == SOURCE_TYPE_GPS:
latest_gps = _get_latest(latest_gps, state)
elif state.state == STATE_HOME:
latest_home = _get_latest(latest_home, state)
latest_non_gps_home = _get_latest(latest_non_gps_home, state)
elif state.state == STATE_NOT_HOME:
latest_not_home = _get_latest(latest_not_home, state)
if latest_home:
latest = latest_home
if latest_non_gps_home:
latest = latest_non_gps_home
elif latest_gps:
latest = latest_gps
else: