Making better scripts with checkboxes

I have a script to TTS on my Google home speakers. I can call it and pass in the message.

I to see how I can take it to the next level and actually select which speakers on individual calls to the script. How can I make it so that when I call the script it shows check boxes for all the configured speakers and then I can tick each one I want?


''
alias: Announce
description: Play message on speakers
fields:
  message:
    name: Message
    description: The message you want to play
    selector:
      text: null
sequence:
  - service: tts.google_cloud_say
    target:
      entity_id: |
        {% if is_state('input_boolean.test_mode', 'on') %}
          media_player.kids_room_speaker
        {% elif is_state('input_boolean.client_session', 'on') %}
          media_player.kids_room_speaker, media_player.living_room_group
        {% else %}
          media_player.all_speakers
        {% endif %}
    data:
      message: <speak><prosody volume="+60dB">"{{ message }}"</prosody></speak>
mode: queued
icon: mdi:bullhorn-variant
max: 10
''

Entity Selector

Thanks that is great. Now I let it select many.


    selector:
      entity:
        multiple: true
        integration: cast
        domain: media_player


    target:
      entity_id: |
        {% if is_state('input_boolean.test_mode', 'on') %}
          media_player.kids_room_speaker
        {% elif is_state('input_boolean.client_session', 'on') %}
????????
        {% else %}
          {{ speakers }}
        {% endif %}


Also how can I deal with removing a player based on a input_boolean? Or any other good idea?

Basically just 1 speaker in the office I don’t want to sound.

Or I can use some sort of grouping?

Eg if “all speakers” chosen, then use “different group” instead.