Cannae speak for other music players, but @Eskay found means to step into the unlisted features via RM Set Mode or Variables, Run Custom Action: Run Custom Action in the thread at:
Sonos does curious actions behind and in the middle of TTS and to add insult to injury, it does different different things when playing from the Sonos App vs play from the Spotify vs cast to Sonos speaker from Spotify, same for YouTube Music and chromecast. It made me dinky head hurt. Thankfully, I've abundant Tanguerary in the frig....
The data track appears to hold all the Elvis return to sender song beyond the other five elements.
It is worth pointing out that when you use RM to play tts on a music player, it uses playTextAndRestore command to do so, and it passes the volume you selected to the player. That should restore the music player to whatever it was doing prior.
It sounds as though you are describing driver issues. Does this work as expected if you do this command from the device itself?
Using the built-in "Notifications" app, the TTS volume walks down using a Sonos speaker and from the driver (having used the Sonos Integration built-in app).
Using playTextAndRestore and the Notifications app plays the text with decreasing volume and then leaves the text as the music track to play. It does not restore, hence my request.
When my TTS comes through it stops the music altogether and plays the TTS at the volume the music was, then stops playing altogether.
I've tried it other ways with a playlist, and like @jchurch the music will then go back to the beginning of the playlist and start again.
What I do now is play music, when im finished set the sonos back to the volume I want the TTS to come through at and leave it alone, which sucks as I tend to use my echo / jbl soundbar instead of my nice sounding sonos because I dont want to mess up the TTS notifications.
I'm taking one step forward and two back chasing this. @stevebott123, is the Sonos speaker you use for TTS grouped or stereo paired to other Sonos speaker(s) and/or do you have Sonos TruePlay on? The rabbit hole I'm presently in has good scent, so this ole dog's hunting that direction.
You can get this to work in RM using a Custom Action for now. Select the Sonos player as the device for the custom action, and select command PlayTestAndRestore. It takes a single String parameter, the text you want to speak.
Update: Hmmm, it worked once, but not a second time. Will investigate...
@bravenel any chance of open sourcing some of these drivers? I agree with sentiment in this thread, it hardly works. I have a rule that says "bath time kiddos" but the volume is never restored properly. struggling to get door chime working properly to play on Sonos.
Has this been tested if music is playing on a sonos group of devices? Then when I playTrackAndRestore on a single speaker (door chime) and won't restore the previous state / group of speakers playing music...