Google Assistant SDK broadcast and queuing

I have various notifications using the notify.google_assistant_sdk action/service. And mostly it works fine - it pauses any music, broadcasts on all live speakers etc, and resumes any music.

BUT there seems to be cases where if notifications are sent that overlap, they are played over each other.

Has anyone written something to queue notifications so they don’t overlap - I’m not looking for deferred notifications, they need to be handled when sent. Ideally as a drop in replacement for the existing action

I’ve seen the use of a wait template ( Google Home notifications stepping on each other ) but this assumes that one of the google home devices is always unused…

You could use Chime TTS as a really nice solution.

Another way is to create a script which you sent variables to ad then have that script set to ‘queued’ mode. That’s how I currently have mine setup but planning to try out Chime TTS when I get time to do it.

eg:

script:
  tts_queue_kitchen:
    alias: TTS Queue Kitchen Speaker
    mode: queued
    sequence:
      - service: media_player.volume_set
        data:
          entity_id: media_player.googlehome3019
          volume_level: 0.35
      - service: tts.cloud_say
        data:
          entity_id: media_player.googlehome3019
          message: "{{ message }}"
      - delay: "00:00:02"
      - wait_template: "{{ is_state('media_player.googlehome3019', 'idle') }}"

Then the following action part of an automation sends it’s message to the above script:

      - service: script.tts_queue_kitchen
        data:
          message: >
            "Good morning, the weather forecast for today will be a maximum of {{ states('sensor.morley_temp_max_0') }} a minimum of {{ states('sensor.morley_temp_min_0') }} and it will be {{ states('sensor.morley_extended_text_0') }}"

Hmm - not clear if ChimeTTS will fully replicate google broadcast - some of the issues suggest it doesn’t correctly restart previous usage on the device.

But using a script to wrap around google broadcast should do it. Will give it a go.

Interesting quirk of using the script editor in HA -

data:
  message: "my message"

always gets saved as

data:
  message: my message

And fails to broadcast

Hmm. I haven’t tried that. My example above was from good old YAML file code.

it gets saved to scripts.yaml in the filesystem, where I’ve gone and changed it manually