Avoid linear search in geofency to find devices ()

This commit is contained in:
J. Nick Koston 2024-04-04 09:27:14 -10:00 committed by GitHub
parent c7d1319acf
commit a83d5e4071
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -38,9 +38,10 @@ async def async_setup_entry(
dev_reg = dr.async_get(hass) dev_reg = dr.async_get(hass)
dev_ids = { dev_ids = {
identifier[1] identifier[1]
for device in dev_reg.devices.values() for device in dev_reg.devices.get_devices_for_config_entry_id(
config_entry.entry_id
)
for identifier in device.identifiers for identifier in device.identifiers
if identifier[0] == GF_DOMAIN
} }
if dev_ids: if dev_ids: