Media_player.play_media use of "announce" option

Hi everyone,
I would like to use the option “announce: true” of the command media_player.play_media as described in the documentation, on a couple of Google media players (Home Mini and Nest Mini) but I haven’t found where to put that attribute, is it still valid?
It would be very useful in case the media player is playing some music and I receive an announcement, otherwise, I have to save the state of the object and then restore it after playing the announcement.
Tnx in advance,
M.

1 Like

Anyone have ever tried that option?
The saving and restoration of the state it works sometime and sometime not, without any useful information on how to solve this misbehavior…

That’s still needed because the announce: true feature, at this time, isn’t yet supported by any of the popular media device integrations (Google Cast, Sonos, etc). To put it another way, the announce feature is more aspirational than functional at the moment.

1 Like

Google cast enabled devices DO support the announce feature do they not ?
I can ask google assistant to announce something just fine. It seems the HA integration does not yet call the announce function correctly somehow ?

Having this functionality would be a game changer for my instance, so I can announce alerts to speakers that are playing music without needing to restart the music every single time.

If you review my original post, I refer to what Home Assistant’s integrations are currently capable of doing. Currently, none of them support announce: true. See emontnemery’s comment here:

This post is from over a year ago…anyone know if theres been movement on using the Announce attribute for google cast devices?
Google SDK has been a good work around, but the “incoming broadcast” is super annoying…

2 Likes

I have another problem with the announce feature.
I have two sonos move 2 devices. When I try this:

service: media_player.play_media
data:
  announce: true
  media_content_type: music
  media_content_id: /local/test_piper.wav
target:
  entity_id:
    - media_player.move_2_1
    - media_player.move_2_2

Everything works as expected: Music volume is lowered, announcement is played, music volume goes back to old level. BUT:

When I make a media_player group:

- platform: group
  entities:
    - media_player.move_2_1
    - media_player.move_2_2
  name: Sonos Moves
  unique_id: sonos_moves

And I call this media_player:

service: media_player.play_media
data:
  announce: true
  media_content_type: music
  media_content_id: /local/test_piper.wav
target:
  entity_id: media_player.sonos_moves

Then the music stops, the announcement is played and then nothing.

I also tried:

- platform: universal
  children:
    - media_player.move_2_1
    - media_player.move_2_2
  name: Sonos Move2
  unique_id: sonos_move2
  # data:
  #   attributes:
  #     - announce: true
# announce: true
# device_class: speaker

But this also stops the music, plays the announcements, and then nothing.

As you can see, I played with the announce attribute, but without any luck.

The above tests I performed with the dev tools, which is why I think this is an issue with the media_player group configuration (bug?)

The use case for this is a voice assistant (atom echo), where I added a media_player as a secondary output. By configuring a media_player group, I do not need to change and recompile the atom echo code (in ESPhome) every time I add or remove a player, instead I add/change/remove to the media_player group.

Is this possible, and if so, how?

Marcel

Looks like you found a bug. Create an issue in GitHub and I’ll look at it.

The group implementation does not pass through the optional attributes in kwargs like announce

As requested by @PeteRage I created a few weeks ago an issue on github (see The media_player group implementation doesn't honor the 'announce' option · Issue #119939 · home-assistant/core · GitHub), but just to be sure it is noticed, I provide the link here as well.

Marcel

1 Like

If you can go back into that issue, edit it and tag it against the Sonos integration, even though it’s a core issue, then it’ll get assigned to me.

I did go back to the issue, and I do see on the right side under ‘Labels’ that there are ‘None yet’, but I cannot find how to add a label to this issue.

I also cannot find any way to ‘tag’ the issue (if it’s not a ‘label’).

I checked the docs on gitlab, but apparently I am not authorized to add a label.

I am using Firefox (also tried Chrome) on Debian Linux.

This is my first bug report, so please be kind to my lack of knowledge…

1 Like

Today I installed Home Assistant Core 2024.8.0. In the release notes I found that this bug was fixed, and indeed it is!

I repeated the tests from earlier in this thread, and now the announcement works both for a single media player, as for both media players in the group.

Thanks for fixing this!

Marcel

2 Likes

You are welcome!