On/Off scripts launched from single service call

HA 0.106.1
I have several media player scenes. In the example below the current active scene SRF3 plays over 3 Sound (media players) zones.


with the entities in the Sound Zone section, I want to toggle off one or the other zones from the current scene.
I created the necessary scripts. mediazone_xyz_on and mediazone_xyz_off.

### test
mediazone_living_off:
  alias: MZ Living Off
  sequence:
    - service: media_player.media_stop
      entity_id: group.living_players

mediazone_living_on:
  alias: MZ Living On
  sequence:
    - service: media_player.media_play
      entity_id: group.living_players

To control the zone from the glance Card I created an input boolean entity.

input_boolean:
  mediazone_living:

From the UI Sound Zones Card I am trying to toggle the zone on and off by activating one of the scripts as follows but I am getting a code error for a missing service data.

             - type: glance                                    # SOUND   ZONES  CARDS
                style: |
                  ha-card {
                    color: white;
                    font-variant: small-caps;
                    border-top: 3px double grey;
                    border-left: 1px dotted grey;
                  }
                  .card-header {
                    font-size: 23px;
                    color: white;
                    text-align: center;
                title: Sound Zones
                columns: 5
                show_state: false
                show_name: true
                entities:
                  - entity: input_boolean.mediazone_living
                    name: Living
                    icon: mdi:sofa
                    tap_action: 
                      action: call-service
                      service: script.turn_on
                      data_template:
                        entity_id: >
                          script.mediazone_living_{{states('input_boolean.mediazone_living')}}

something is wrong in there but can’t figure where.
Erik

I may be wrong but I believe Jinja2 templates are not supported where you are using them (for tap_action’s entity_id).

I searched the forum and found that there is another technique used instead of Jinja2. I don’t have much experience with it but, for starters, look at the example in this post:

Specifically this portion:

  tap_action:
    action: call-service
    service: switch.toggle
    service_data:
      entity_id: >
        [[[return 'switch.' + entity.entity_id.split('.')[1] + '_switch' ]]]