From 7bf0fb9e489c76086c16fa32eaf2efed0f88dac4 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 21 Feb 2024 12:45:00 -0600 Subject: [PATCH] Avoid late import of area registry in device registry if its not used (#111081) --- homeassistant/helpers/device_registry.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/helpers/device_registry.py b/homeassistant/helpers/device_registry.py index cab47258f67..b8e07117377 100644 --- a/homeassistant/helpers/device_registry.py +++ b/homeassistant/helpers/device_registry.py @@ -654,10 +654,6 @@ class DeviceRegistry: via_device_id: str | None | UndefinedType = UNDEFINED, ) -> DeviceEntry | None: """Update device attributes.""" - # Circular dep - # pylint: disable-next=import-outside-toplevel - from . import area_registry as ar - old = self.devices[device_id] new_values: dict[str, Any] = {} # Dict with new key/value pairs @@ -688,6 +684,10 @@ class DeviceRegistry: and area_id is UNDEFINED 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_id = area.id