Avoid linear search of the device registry in deconz (#114803)

This commit is contained in:
J. Nick Koston 2024-04-03 21:02:18 -10:00 committed by GitHub
parent c18ff39540
commit aa52688d4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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