Fill dropdown with all available media players

How can I fill a drop-down with all available media players ?

Kindly guide.

There are a few posts that speak of ‘dynamic lists’ so have a look there.
On a simpler note… I use a entities card where I am filtering on available/not

This is as far as I got, not sure if any recent updates would solve it now though!

You can’t use templates in the input_select configuration.

You can only use templates in the set_options service.

1 Like

I am not getting any. Can you please point me to it. Please

I tried your example but I am getting all entries in a single line like option1 option2 etc but not like below

Option 1
Option 2

It’s not completely clear how you are defining “available” media players or how you want them to appear in the dropdown (name, entity id, area, etc) but you can do it with a template select and an input text helper.

template:
  - select:
    - name: "Available Media Players"
      state: "{{ states('input_text.selected_media_player') }}"
      options: >
        {{ states.media_player
        | rejectattr('state', 'in', ['off', 'idle', 'unavailable', 'unknown'])
        | map(attribute ='entity_id') | list }}
      select_option:
        - service: input_text.set_value
          target:
            entity_id: input_text.selected_media_player
          data:
            value: "{{ option }}"
3 Likes

Thanks a million. Was looking for this solution…

Sorry but how do I implement that code ?
New to this stuff.

Thanks

The Template select shown above needs to be added to your configuration.yaml file. Instructions for accessing and editing configuration.yaml can be found at:

How would I tweak this so that it also gives me a list of my radio stations and spotify playlists?

And would there be a way to combine the list of stations and the list of playlists/radio stations so that you could select a speaker, then select a music option and it plays? That would be amazing!