Show entities from a particular integration

{{ states.media_player
        | rejectattr('state', 'in', ['off', 'idle', 'unavailable', 'unknown'])
        | map(attribute ='name') | list }}

How to show media_player entities from a particular integration only. E.g jellyfin, google cast etc.

Kindly guide.

{{ integration_entities('jellyfin') | select('match', 'media') | list }}

If you want the friendly names, like your example would return, add the filter map('state_attr', 'friendly_name') before the list filter.

1 Like

Thank you so much… it worked👍

This would populate the dropdown with media_players friendly name. I need to get the entity_id of the selected dropdown item/media_player.

{{ integration_entities('squeezebox') | select('match', 'media') | map('state_attr', 'friendly_name') | select('search', 'Bedroom speaker') | map(attribute ='entity_id') | list }} >> This one

I am trying the above but not getting the entity id what am I doing wrong here?
Kindly help

In the third step, map('state_attr', 'friendly_name'), you are left with a list of friendly names… just the plain strings, not a dictionary or state object. So when you get to map(attribute ='entity_id') they don’t have entity_id attributes to extract.

You can think about what you did step-by-step kind of like:

{{ integration_entities('squeezebox')    ---> List of entity IDs
| select('match', 'media')               ---> Smaller list of entity IDs
| map('state_attr', 'friendly_name')     ---> List of friendly names
| select('search', 'Bedroom speaker')    ---> Smaller list of friendly names
| map(attribute ='entity_id')            ---> List of Undefined values because friendly names don't have attributes
| list }}                                ---> Still a list of Undefined values

Is there another way to whittle the list down to the desired entities without the conversion to friendly names? Two good options might be to use Areas or Labels because both of those have related functions to list their entities.

{{ integration_entities(‘squeezebox’)
| select(‘match’, ‘media’)
| map(‘state_attr’, ‘friendly_name’)
| select(‘search’, ‘Bedroom speaker’)
| map(attribute =‘entity_id’)
| list }} >> final

hmmm giving [Undefined] >> final

Because you already mapped to “friendly_name”, so mapping to entity_id has no sense.
Didn’t you get answers here also?

yes got it solved now… Thank you so much guys…

1 Like