Adjust search to not access DeviceEntry.config_entries (#181888)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Erik Montnemery
2026-09-11 11:26:36 +02:00
committed by GitHub
co-authored by Copilot Autofix powered by AI
parent 458b11ee9b
commit 7c9fd38643
+7 -4
View File
@@ -147,8 +147,7 @@ class Searcher:
self._add(ItemType.DEVICE, device.id)
# Config entries for devices in this area
if device_entry := self._device_registry.async_get(device.id):
self._add(ItemType.CONFIG_ENTRY, device_entry.config_entries)
self._add(ItemType.CONFIG_ENTRY, device.config_entry_id)
# Automations and scripts referencing this device
self._async_add_automations_and_scripts_for_device(device)
@@ -623,8 +622,12 @@ class Searcher:
self._add(ItemType.AREA, area_id)
self._async_resolve_up_area(area_id)
self._add(ItemType.CONFIG_ENTRY, device_entry.config_entries)
for config_entry_id in device_entry.config_entries:
if device_entry.is_composite_device:
config_entry_ids = device_entry.config_entries
else:
config_entry_ids = {device_entry.config_entry_id}
self._add(ItemType.CONFIG_ENTRY, config_entry_ids)
for config_entry_id in config_entry_ids:
if entry := self.hass.config_entries.async_get_entry(config_entry_id):
self._add(ItemType.INTEGRATION, entry.domain)