Fix circles in person integration (#64991)

pull/64994/head
Paulus Schoutsen 2022-01-26 10:25:13 -08:00 committed by GitHub
parent 07563f4fd2
commit b2de177104
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,6 @@ from typing import Any, cast
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.person import DOMAIN as PERSON_DOMAIN
from homeassistant.const import (
ATTR_EDITABLE,
ATTR_LATITUDE,
@ -361,7 +360,8 @@ class Zone(entity.Entity):
async def async_added_to_hass(self) -> None:
"""Run when entity about to be added to hass."""
await super().async_added_to_hass()
persons = self.hass.states.async_entity_ids(PERSON_DOMAIN)
person_domain = "person" # avoid circular import
persons = self.hass.states.async_entity_ids(person_domain)
object_id = split_entity_id(self.entity_id)[1]
for person in persons:
state = self.hass.states.get(person)
@ -371,7 +371,7 @@ class Zone(entity.Entity):
self.async_on_remove(
event.async_track_state_change_filtered(
self.hass,
event.TrackStates(False, set(), {PERSON_DOMAIN}),
event.TrackStates(False, set(), {person_domain}),
self._person_state_change_listener,
).async_remove
)