Alexa TTS messages are stepping on each other

I have multiple automations and scripts that use alexa TTS (alexa media player). I am finding that they sometimes step on each other…one message is speaking and another just starts before the first message ends.

Is there a way to serialize messages or stop a new message from starting when the alexa is busy?

I use a script with mode “queued” to do the actual “talking” (using google, but I guess its the same principle):

  alias: Notify Google Home 
  mode: queued
  - service: script.tts_wakeup_device
      entity_id: media_player.speaker_2
  - wait_template: "{{ states('media_player.speaker_2') == 'idle' }}"
  - service: tts.google_translate_say
    entity_id: media_player.speaker_2
      message: "{{ message }}"
  - delay:
      seconds: 1.0
  - wait_template: "{{ states('media_player.speaker_2') != 'playing' }}"

That script first runs a simple little script to wake up the device before it actually say something (Google Home takes a second or so to start up from sleeping)

  alias: Wake up device if sleeping
  mode: single
  - condition: template
    value_template: "{{ states(entity_id) == 'off' }}"
  - service: media_player.play_media
      entity_id: "{{ entity_id }}"
      media_content_id: /local/1-second-of-silence.mp3
      media_content_type: 'audio/mp3'
  - wait_template: "{{ states(entity_id) != 'off' }}"
  - delay:
      seconds: 1.0
  - wait_template: "{{ states(entity_id) != 'playing' }}"

So if the device is off, it plays an mp3 that is simply one second of silence, and waits for the device to go from state “playing” (to “idle”) before returning.

Then all my other scripts are triggering the actual “notify”-script, so they are nicely queued.

  alias: TTS Weather report
  - service: script.notify_speaker
      message: >
        The weather report goes here