(hass: HomeAssistant, domains: list[str] | None = None)
return {
        state.entity_id: f'{state.attributes.get(ATTR_FRIENDLY_NAME, state.entity_id)} ({state.entity_id})'
        for state in sorted(
            hass.states.async_all(domains and set(domains)),
            key=lambda item: item.entity_id,
        )
    }
Fetch all entities or entities in the given domains.
Fetch all entities or entities in the given domains.
Fetch all entities or entities in the given domains .
def _async_get_matching_entities(hass: HomeAssistant, domains: list[str] | None = None):
    """Fetch all entities or entities in the given domains."""
    return {
        state.entity_id: f'{state.attributes.get(ATTR_FRIENDLY_NAME, state.entity_id)} ({state.entity_id})'
        for state in sorted(
            hass.states.async_all(domains and set(domains)),
            key=lambda item: item.entity_id,
        )
    }
def _async_get_matching_entities ( hass : HomeAssistant , domains : list [ str ] | None = None ) : return { state . entity_id : f'{state.attributes.get(ATTR_FRIENDLY_NAME, state.entity_id)} ({state.entity_id})' for state in sorted ( hass . states . async_all ( domains and set ( domains ) ) , key = lambda item : item . entity_id , ) }