From aa52688d4b83bb909fa339df23e83366a9c967ef Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 3 Apr 2024 21:02:18 -1000 Subject: [PATCH] Avoid linear search of the device registry in deconz (#114803) --- homeassistant/components/deconz/services.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/deconz/services.py b/homeassistant/components/deconz/services.py index 91f36bb871e..233f9c3f570 100644 --- a/homeassistant/components/deconz/services.py +++ b/homeassistant/components/deconz/services.py @@ -160,8 +160,9 @@ async def async_remove_orphaned_entries_service(hub: DeconzHub) -> None: entities_to_be_removed = [] devices_to_be_removed = [ entry.id - for entry in device_registry.devices.values() - if hub.config_entry.entry_id in entry.config_entries + for entry in device_registry.devices.get_devices_for_config_entry_id( + hub.config_entry.entry_id + ) ] # Don't remove the Gateway host entry