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