How to use the enqueue attribute when playing media clips

I’m making an automation to play a media clip, followed by a voice announcement. I’ve tried using the state.idle action on the speaker but that’s too unwieldy because I am playing it to many speakers at once. The documentation for the media_player.play_media service shows an enqueue attribute that sounds like just what I need, but I can’t get it to work. No matter what value I put there, it skips the media clip and goes right to the announcement. Here’s some test YAML:

alias: Another speaker test
description: ""
trigger: []
condition: []
action:
  - service: media_player.play_media
    target:
      entity_id: media_player.bedroom_speaker
    data:
      media_content_id: media-source://media_source/local/modern-tech-logo-13492.mp3
      media_content_type: audio/mpeg
      enqueue: add
    metadata:
      title: modern-tech-logo-13492.mp3
      thumbnail: null
      media_class: music
      children_media_class: null
      navigateIds:
        - {}
        - media_content_type: app
          media_content_id: media-source://media_source
  - service: media_player.play_media
    target:
      entity_id: media_player.bedroom_speaker
    data:
      media_content_id: >-
        media-source://tts/tts.google_en_com?message=This+is+a+test.+Please+ignore+it.&language=en-uk
      media_content_type: provider
      enqueue: add
    metadata:
      title: This is a test. Please ignore it.
      thumbnail: https://brands.home-assistant.io/_/tts/logo.png
      media_class: app
      children_media_class: null
      navigateIds:
        - {}
        - media_content_type: app
          media_content_id: media-source://tts
        - media_content_type: provider
          media_content_id: >-
            media-source://tts/tts.google_en_com?message=This+is+a+test.+Please+ignore+it.&language=en-uk
mode: single

I can’t find any examples of how to do this. Can someone help?

1 Like

I found this tip. I spent a couple hours on it and got no where. I wish you better luck.
Are you senting your alerts to HomePod Mini’s? I have read there are very simple methods with Amexa and Sono’s, but mini’s have some serious issues and the HA documentation for media is rediculous.

I also found this but got no where with “enqueue” add, true, alert?
Expand enqueue options media player · Issue #765 · home-assistant/architecture (github.com)

I found that you can send audio to all of the speakers at once, and wait for them all to become idle at once as well. So I just made a script that does that and I call it from each automation that needs to play something in the speakers, passing the text and name of the audio clip that it needs to play. It’s not too unwieldy this way.

Apparently the enqueue attribute doesn’t do what I think it does.