From 0710f4c661e06500709654f182b2784b5f8dc648 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 3 Apr 2024 23:51:57 -1000 Subject: [PATCH] Avoid linear search in purpleair to find devices (#114816) --- homeassistant/components/purpleair/config_flow.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/purpleair/config_flow.py b/homeassistant/components/purpleair/config_flow.py index f9a6415bb38..6c25681329a 100644 --- a/homeassistant/components/purpleair/config_flow.py +++ b/homeassistant/components/purpleair/config_flow.py @@ -115,8 +115,9 @@ def async_get_remove_sensor_options( device_registry = dr.async_get(hass) return [ SelectOptionDict(value=device_entry.id, label=cast(str, device_entry.name)) - for device_entry in device_registry.devices.values() - if config_entry.entry_id in device_entry.config_entries + for device_entry in device_registry.devices.get_devices_for_config_entry_id( + config_entry.entry_id + ) ]