From 3531444e2e3f2a64b7ce4c6eae3101826e7e7ceb Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 4 Feb 2024 14:13:06 -0600 Subject: [PATCH] Avoid linear search of entity registry in huawei_lte (#109637) --- homeassistant/components/huawei_lte/device_tracker.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/huawei_lte/device_tracker.py b/homeassistant/components/huawei_lte/device_tracker.py index fd1b9850054..1bb5077a2b4 100644 --- a/homeassistant/components/huawei_lte/device_tracker.py +++ b/homeassistant/components/huawei_lte/device_tracker.py @@ -70,11 +70,10 @@ async def async_setup_entry( track_wired_clients = router.config_entry.options.get( CONF_TRACK_WIRED_CLIENTS, DEFAULT_TRACK_WIRED_CLIENTS ) - for entity in registry.entities.values(): - if ( - entity.domain == DEVICE_TRACKER_DOMAIN - and entity.config_entry_id == config_entry.entry_id - ): + for entity in registry.entities.get_entries_for_config_entry_id( + config_entry.entry_id + ): + if entity.domain == DEVICE_TRACKER_DOMAIN: mac = entity.unique_id.partition("-")[2] # Do not add known wired clients if not tracking them (any more) skip = False