Capture/Restore Music Player?

Capture/restore what? You can put volume into a variable, and then set volume from it. What are you talking about needing?

Music player, that's what the OP is requesting isn't it?

Yes, this is what I said I am currently doing. But I was just putting a :+1: to adding a full capture and restore for "music player" it would make TTS things simpler.

1 Like

What attributes of Music Player are you talking about? I'm not understanding what the use case is.

1 Like

Sorry, out with my half helping her enjoy the apropos Ma/Granny routine. Granted big xmas in July list, but this sort of capture:

Sorry, but that doesn't explain this at all. What is the use case please? There are no commands to set trackData, status, or trackDescription. Are you just trying to restore the volume?

If so, you don't need a new feature to do that. Simply put it in a variable (using custom attribute) and then set it from the variable.

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?

Agreed. Only I'd entered that intersection from Notifications street where I can't make that turn.

Almost certainly it is a driver issue. Without the curious workaround I found, Sonos walks the volume down.

I don't know what that means, and have no idea what you are talking about in this thread.

Notifier (from Notifications) uses the same method as Rule Machine to do tts on a music player. But in the first post you were talking about RM.

Find out if this works for you from the device page for your music player device. or not. If not, then this is an issue with the device or driver.

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.

1 Like

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.

my sonos is not grouped or paired, I do have trueplay on (thats the apple surround sound thing yeah?)

Trueplay ( tunes speaker(s) according to surroundings.

Also cannot use TTS while music is playing. TTS will stop the music, set volume, play TTS message. No restore of previous volume and resume playlist.

1 Like

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...

1 Like

I played with it for a few minutes from the Sonos device page, and now it's working consistently.

Also, RM already uses PlayTextAndRestore for a music device, so it isn't necessary to use a Custom Action.

That's been doing that for years. I gave up on it, how did you manage to get it to keep working?


At least over 2 that I know of.


1 Like

PlayTextAndRestore doesn't work for me or @baldog


Resume Sonos After Speech

It always stays on the TTS, in my case this might be because I use radiostreams and they are 'unknown' when I look at the sonos data.

I came across this HA driver and thought maybe it could help you guys