New TTS Announce Feature For Sonos (Overlay)

I am finally getting around to trying the new overlay feature for Sonos to streamline my announcements and cannot get it to work. I start a playlist on Sonos (Youtube Music, Plex, etc.) and when I play the announcement the playlist stops and does not overlay the announcement over the music. The announcement plays fine but the playlist stops. Any ideas? Below is a sample script.

service: media_player.play_media
data:
  media_content_id: media-source://tts/google_translate?message="I am very loud"
  media_content_type: music
  announce: true
  extra:
    volume: 80
target:
  entity_id: media_player.great_room
1 Like

I am beginning to wonder if the Sonos speakers need the be the latest generation. Currently, mine are all S1 generation. I have a Play 5, a Play 3 and an IKEA Symfonisk. Does this new feature require S2 speakers?

I have a mix of S1 and S2 devices and use the following for them all, when executed is lowers the volume of what is currently playing and plays the message on top. I happen to be using google cloud but the same works regardless of the TTS service.

service: tts.google_cloud_say
data:
  entity_id: media_player.sonoslivingroom
  message: test message

I figured out what the problem was. All three of my speakers were running the S1 OS firmware. The Play 3 and the Symfonisk both support the S2 OS so I updated them both and now everything works as advertised. I hope this can help someone else if the future. The documentation should be updated to note this.

BTW is anyone using the Chimes TTS HACs integration for announcements? It works great with the main feature being combining a sound effect with TTS before sending it to the media device. The only thing I am surprised it doesn’t support is sending to multiple speaker entities at once.

This only plays the TTS on the targeted device even though that sonos is in a group with others.
Any clues on how to play on all in the group?

@tortho you need to create a Sonos Group within the Sonos app and use that as your media player device.

Yeah, but then the point of using HA to group/ungroup based on presence is lost in my case.
Was hoping not to fiddle with the Sonos app.
I can play media, etc to all speakers right now so the tts announcement should have been possible in the same manner…

Btw. I’m unsing the mediaplayer join and unjoin function (and the speakers do group in the sonos app)

Currently, that’s a known limitation.

The developer who maintains the Sonos integration implemented support for announce in version 2023.5.0 and here’s jjlawren’s description of the feature:

The new announce behavior avoids the need to snapshot/regroup/etc and will play over any currently playing music without interruption.

The tradeoff is that you need to explicitly target all rooms/speakers where you’d like the announcement to play and they are called individually, so audio playback may not be perfectly synced.

tl;dr
Sonos announce feature doesn’t currently support playing to all members of a grouped set of speakers.


NOTE

It’s my understanding that if the target speaker is a stereo pair, the announcement will only play via one of the paired speakers.

1 Like

Be advised that the difference between your example and what’s in the first post is that theadlee is using the optional volume property. The documentation warns that it may not be supported on S1 speakers

The documentation already states notes it. See the screenshot I posted above.

Contact its author. I believe others have already requested this enhancement.

It would involve using the traditional snapshot/group/play/restore technique as opposed to using announce because announce doesn’t natively support prepending a sound effect (or anything else) to TTS.

FWIW, I currently use a script to do that, optionally playing a ‘preamble’ prior to the announcement.

@123 I see the documentation now thanks.

I have been in contact with the Chime TTS author @Nimrod_Dolev. He has made the enhancement to support multiple speakers. He is merging the ‘preamble’ with the TTS into one mp3 so the announce feature still works.

And if I then understand correctly if I implement snapshot, send tts and restore it will send to all even in my case?

Cool. I’ll be inspecting the code to learn how the two MP3 files are concatenated.

Yes; that’s the method I am currently using (in a script).

I am investigating adding support to Chime TTS for grouping speakers together with the standard join and unjoin services.

I hope to release it shortly in an incoming release.

theadlee indicated you will be “merging the ‘preamble’ with the TTS into one mp3”. What are you using to do that?


FWIW, in the script that I mentioned above, it plays the two MP3 files (preamble and announcements) one after the other. It waits until the preamble is finished before starting to play the announcement.

Hi @123 , I wrote a custom integration called Chime TTS which is written in Python.

It adds a new service (chime_tts.say) to Home Assistant which allows you join audio files before and/or after TTS audio to form a new local mp3 file, played in a single service call to your media_player/s without any lag.

The service is configurable, so you can do things like specify how long of a delay you want to insert between the audio and TTS, change the speed of the TTS audio, and supports the various language-specific parameters available in Google Translate’s and Nabu Casa’s TTS services.

Hello guys, did anyone get this to work with Amazon polly?

For some reason it will not work, in the logs I will find a error saying that the provider tts.amazon_polly_say it’s not found.

I have set it up in the config, because you can’t do it true the ui.

Service tts is working!

So I was wondering if anyone as it working?