Avoid linear search in purpleair to find devices (#114816)

This commit is contained in:
J. Nick Koston 2024-04-03 23:51:57 -10:00 committed by GitHub
parent d7153d525f
commit 0710f4c661
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -115,8 +115,9 @@ def async_get_remove_sensor_options(
device_registry = dr.async_get(hass) device_registry = dr.async_get(hass)
return [ return [
SelectOptionDict(value=device_entry.id, label=cast(str, device_entry.name)) SelectOptionDict(value=device_entry.id, label=cast(str, device_entry.name))
for device_entry in device_registry.devices.values() for device_entry in device_registry.devices.get_devices_for_config_entry_id(
if config_entry.entry_id in device_entry.config_entries config_entry.entry_id
)
] ]