mirror of
https://github.com/home-assistant/core.git
synced 2025-04-27 18:57:57 +00:00
Fix circles in person integration (#64991)
This commit is contained in:
parent
07563f4fd2
commit
b2de177104
@ -8,7 +8,6 @@ from typing import Any, cast
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.components.person import DOMAIN as PERSON_DOMAIN
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_EDITABLE,
|
ATTR_EDITABLE,
|
||||||
ATTR_LATITUDE,
|
ATTR_LATITUDE,
|
||||||
@ -361,7 +360,8 @@ class Zone(entity.Entity):
|
|||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
"""Run when entity about to be added to hass."""
|
"""Run when entity about to be added to hass."""
|
||||||
await super().async_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]
|
object_id = split_entity_id(self.entity_id)[1]
|
||||||
for person in persons:
|
for person in persons:
|
||||||
state = self.hass.states.get(person)
|
state = self.hass.states.get(person)
|
||||||
@ -371,7 +371,7 @@ class Zone(entity.Entity):
|
|||||||
self.async_on_remove(
|
self.async_on_remove(
|
||||||
event.async_track_state_change_filtered(
|
event.async_track_state_change_filtered(
|
||||||
self.hass,
|
self.hass,
|
||||||
event.TrackStates(False, set(), {PERSON_DOMAIN}),
|
event.TrackStates(False, set(), {person_domain}),
|
||||||
self._person_state_change_listener,
|
self._person_state_change_listener,
|
||||||
).async_remove
|
).async_remove
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user