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 }}"
4 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!

1 Like

Exactly what Iā€™m currently looking for :slight_smile:
Somehting that would look like (based on Mini media player for instance):

Dropdown list to < Select speaker > | Dropdown list to < Select web stream >
image

If you want change speakers while music is playing, the music would be transferred from speaker 1 to speaker 2.