Cancel an announcement

Hi all,

When someone rings our smart doorbell, an announcement (media file, short song) is played on both our Sonos speakers . What I want to achieve is that this announcement is aborted / killed / stopped when somebody opens the door (i.e., value of the door sensor changes from closed to open. And, moreover, when (one of the) speakers was playing music before the announcement, the music should resume after the announcement has been aborted.

What I have tried:

  • The media stop command had no effect.
  • Next I started experimenting with both Home Assistant (HA) as well as Music Assistant (MA) as media players and announcement ‘players’. My experience is that MA player group is a little bit more in sync than the HA player group. But…
  • With the HA players I am able to ‘override’ an announcement by starting a new announcement, while in MA the announcements are queued. I tried a ‘silence.mp3’ announcement, but that did not work; it has to be a media file with sound.
  • Decreasing the volume to 0 plus the announcement volume (as extra parameter) to 0; had no effect, the second announcement wants to play at >10 volume level.

How should I get this working a proper way?

data:
  announce: true
  media_content_id: media-source://media_source/local/song.mp3
  media_content_type: audio/mpeg
metadata:
  title: song.mp3
  thumbnail: null
  media_class: music
  children_media_class: null
  navigateIds:
    - {}
    - media_content_type: app
      media_content_id: media-source://media_source
    - media_content_type: ""
      media_content_id: media-source://media_source/local/song
action: media_player.play_media
enabled: true
target:
  entity_id:
    - media_player.sonos_group
action:
  - service: media_player.media_stop
    target:
      entity_id: media_player.sonos_group

Hope someone can help me.

Thanks!

Edit: Forgot to mention that the MA core author told me that cancelling an announcement in MA is currently not possible (in a sonos speaker).