Avoid late import of area registry in device registry if its not used (#111081)
parent
395a452162
commit
7bf0fb9e48
|
@ -654,10 +654,6 @@ class DeviceRegistry:
|
||||||
via_device_id: str | None | UndefinedType = UNDEFINED,
|
via_device_id: str | None | UndefinedType = UNDEFINED,
|
||||||
) -> DeviceEntry | None:
|
) -> DeviceEntry | None:
|
||||||
"""Update device attributes."""
|
"""Update device attributes."""
|
||||||
# Circular dep
|
|
||||||
# pylint: disable-next=import-outside-toplevel
|
|
||||||
from . import area_registry as ar
|
|
||||||
|
|
||||||
old = self.devices[device_id]
|
old = self.devices[device_id]
|
||||||
|
|
||||||
new_values: dict[str, Any] = {} # Dict with new key/value pairs
|
new_values: dict[str, Any] = {} # Dict with new key/value pairs
|
||||||
|
@ -688,6 +684,10 @@ class DeviceRegistry:
|
||||||
and area_id is UNDEFINED
|
and area_id is UNDEFINED
|
||||||
and old.area_id is None
|
and old.area_id is None
|
||||||
):
|
):
|
||||||
|
# Circular dep
|
||||||
|
# pylint: disable-next=import-outside-toplevel
|
||||||
|
from . import area_registry as ar
|
||||||
|
|
||||||
area = ar.async_get(self.hass).async_get_or_create(suggested_area)
|
area = ar.async_get(self.hass).async_get_or_create(suggested_area)
|
||||||
area_id = area.id
|
area_id = area.id
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue