diff --git a/homeassistant/components/search/__init__.py b/homeassistant/components/search/__init__.py index 6c40b77dae0f..0580793b8003 100644 --- a/homeassistant/components/search/__init__.py +++ b/homeassistant/components/search/__init__.py @@ -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)