Help with variables

Hello,

Still learning every day with HA.
I have a smart button that calls the childeren voor dinner trough their google home and tts.
It started with just 2 google nest mini, but now their are 5 also for gameroom and kitchen.
I have now this:

alias: Knop Damian
description: ''
trigger:
  - platform: event
    event_type: deconz_event
condition: []
action:
  - service: media_player.volume_set
    data:
      entity_id: media_player.kantoor_display
      volume_level: 0.5
  - service: tts.cloud_say
    data:
      entity_id: media_player.kantoor_display
      message: We gaan eten. Willen jullie naar beneden komen
      options:
        gender: female
      language: nl-NL
  - service: media_player.volume_set
    data:
      entity_id: media_player.kantoor_speaker
      volume_level: 0.5
  - service: tts.cloud_say
    data:
      entity_id: media_player.kantoor_speaker
      message: We gaan eten. Willen jullie naar beneden komen
      options:
        gender: female
      language: nl-NL
mode: single```

It it possible to set the devices and volume in a variable so i can use 1 script instead of 5 times the same?

i dont really understand your needs but maybe i can give you ways to achieve ur needs.

  • you do a script with all your media…and call the script with a service where u need (automations, button…) with:
service: script.yourscriptname
  • you can create an input_number for volume, and set :
volume_level: {{ states('input_number.volume') }}

-TTS to ALL:

service: tts.google_translate_say
entity_id: "all"

-maybe make a group:

and your options for tts have to be in your configuration.yml so u havn’t to write it everywhere

tts:
  - platform: google_translate
    language: "de"

@tomdudu38 thanks i go for groups