Group Sonos players? Party Mode? then restore previous mode...

Hello All,

I have 2 Sonos systems now.
I have a scene that plays a file when someone approaches the home.
The problem is that I cannot play across both zones unless I happen to have selected the first zone as the source, then Grouped the other zone.

So, if someone changes the 2nd zone, that zone will never receive the alert. I’ve tried to run the scene to duplicate the actions across both zones, but it seems to stop playback (maybe acessing same file?)

I’m thinking a solution would be to Save the mapping of players and playback info, Group the players, play the file on the master, then restore the Mapping and Playback context.

Is that possible? I’m looking at some of the options in the plugin events and I see something about manage with source, but there is a lot of data that needs to filled in and i’m not too familiar with that yet. Anyone know the answer on how to do this?

Thanks,

Good idea, sounds like we need some kind of ‘broadcast’ function…I have three rooms covered by Sonos systems so this definitely makes sense as a requirement!

Grouping them prior is fairly easy, restoring everything afterwards would require some work.

Each Sonos has a unique “address” of sorts. It looks like:
[tt]x-rincon:RINCON_000E5…01400[/tt]

where the last part is basically the MAC address concatenated to “[tt]1400[/tt]” (the Port used for commands). You’ll see something like this value in the Advanced section, under “[tt]SonosID[/tt]”.

As an example, let’s say I have Sonos units called “Master” and “Portable”. If I want “Master” to play the stuff currently playing on “Portable”, then I issue a Scene command like the attached screenshot.

This tells the “master” unit to play (join) the “Portable” unit (using it’s unique address).

@lolodomo: If we wanted to make this part of “Say”, then we’d need a parameter that lists the SonosID’s to group-prior, and restore-after. This could be more generally useful if we had a “playOne” type call, that behaved similarly… for those wanting to play a Warning [MP3/WAV] Tone, then restore context also.

There is apparently two different needs:
1 - addressing TTS to all Sonos
2 - restoring grouping after TTS

For the first point, we could use your solution, meaning stopping the playback on the desired Sonos, then asking all others Sonos to play the same thing as this Sonos, and finally play the Google file.
We need a new parameter to choose between the targetted Sonos or all Sonos.

For the second point, that’s doable, but that would require when saving the playback context to interrogate all Sonos to check if they are “grouped” with the Sonos that we ask to say something. In fact, we would have to store, save and restore the playback context of several zones.

That’s an interesting subject but until I buy a second Sonos unit, unfortunately I cannot really help you.

When a Sonos is grouped to a master one, I am curious to know what we got in all our variables for the “slave” unit ?
I imagine we loose media information for example if the meta data are not filled ? If true, we could get them from the other Vera device.

I’d imagine we’d call_action on each Sonos unit to have it save its context, so they’d each do it themselves. Then execute the grouping action, then Say (or more generally PlayOne for one off ‘Siren’ MP3s)

Afterwards we’d need to do the same for restore… Basically telling each Sonos to restore itself by calling it via call_action.

I’ll give it a go after Christmas sometime.

I noticed you can originate media playing on the master, then group the slave so both are playing, then ungroup the master leaving the slave playing whatever you originally queued up for the Master and allow the master free to play whatever you want. Once it’s done playing you can re-group the original playlist or radio station and not have to restart a new track on pandora because it was never “stopped”.

This makes me think of a solution to pause and resume media that cannot be resumed such as pandora, and this may be a workaround…

Theoretically if we could create a phantom sonos on the system it may be cleaner and faster to simply group (transfer) the information to the phantom sonos which will not lose the pandora or other internet media connection. Play the TTS or announcement file on the main sonos or group, then re-group all sonos systems and continue / resume play without losing the track.

this was my thought when I originally started this post because it seemed to be the solution to interrupt Pandora without having to start a new track and deal with the delays involved.

[quote=“guessed, post:6, topic:173594”]I’d imagine we’d call_action on each Sonos unit to have it save its context, so they’d each do it themselves. Then execute the grouping action, then Say (or more generally PlayOne for one off ‘Siren’ MP3s)

Afterwards we’d need to do the same for restore… Basically telling each Sonos to restore itself by calling it via call_action.

I’ll give it a go after Christmas sometime.[/quote]

That’s a good idea. But isn’t call_action asynchronous, meaning it returns before the action is really executed ?

[quote=“big517, post:7, topic:173594”]Theoretically if we could create a phantom sonos on the system it may be cleaner and faster to simply group (transfer) the information to the phantom sonos which will not lose the pandora or other internet media connection. Play the TTS or announcement file on the main sonos or group, then re-group all sonos systems and continue / resume play without losing the track.

this was my thought when I originally started this post because it seemed to be the solution to interrupt Pandora without having to start a new track and deal with the delays involved.[/quote]

Unfortunately, creating a phantom Sonos is certainly very complex, maybe simply impossible.
But you may use a real Sonos unit, one currently unused, setting its volume to 0.

. But you may use a real Sonos unit, one currently unused, setting its volume to 0.

Can this be done via advanced scene setup?

Sent from my SPH-D710 using Tapatalk 2

[quote=“big517, post:10, topic:173594”]

.
But you may use a real Sonos unit, one currently unused, setting its volume to 0.

Can this be done via advanced scene setup?[/quote]

Setting the volume ? Yes, of course.

For the full scenario, you are the guy who explained how to do it:

I noticed you can originate media playing on the master, then group the slave so both are playing, then ungroup the master leaving the slave playing whatever you originally queued up for the Master and allow the master free to play whatever you want. Once it's done playing you can re-group the original playlist or radio station and not have to restart a new track on pandora because it was never "stopped".

You did it with a Sonos control application or with the Vera ?

I did it with the Sonos Application on my iPad. I’m just trying to figure out how to emulate that scenario with the functions we have available in the plugin.

Looking outside the box for ideas…

http://www.ip-symcon.de/wiki/PHPSonos or http://www.google.com/translate?hl=en&ie=UTF8&sl=auto&tl=en&u=http%3A%2F%2Fwww.ip-symcon.de%2Fwiki%2FPHPSonos

http://translate.googleusercontent.com/translate_c?depth=1&hl=en&ie=UTF8&rurl=www.google.com&sl=auto&tl=en&u=http://www.ip-symcon.de/forum/threads/7676-PHP-Sonos-(Klasse-zum-Ansteuern-einzelner-Player)%3Fp%3D156671&usg=ALkJrhhvBcq6T9CfJwGqR62qOqyt-PK5-g#post156671

Whether it’s sync or async across the channels it won’t really matter as long as it’s serial within a given [Sonos] device.

Basically the “initiator” device’s Say method would logically do something akin to:

initiator.savePlaybackContext store the list of remote Sonos devices forEach remote Sonos device... remote.call_action(SavePlaybackContext) remote.call_action(SetAVTransport... initiator SonosID) end StartAutoPlay code... initiator.call_delay(stopSay)
and then later, in stopSay on the “initiator” device…

restore the list of remote Sonos devices forEach remote Sonos device... remote.call_action(RestorePlaybackContext) end initiator.restorePlaybackContext

It won’t be perfect, since the “tracking” stuff you recently added will be local only to the initiator. As a result, there’s a possibility of things getting out of sync if a “Say” were initiated across multiple nodes concurrently… but it should be good enough.

It’ll take me a while to get the exact combo, but it should be something like the above… time will tell. Hopefully this will spread the state-management burden across the various Sonos devices somewhat :wink:

Ok, this is now implemented in the [tt]Say[/tt] action. I’ve added a new “[tt]Devices[/tt]” parameter. If present, it represents a CSV list of deviceId’s of other Sonos units that should be included during the save-say-restore model of the Say command.

As a Lua snippet it would look like:

luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say", {Text="Welcome Home", Devices="667,668"}, 666)

This would instruct Sonos device “[tt]666[/tt]” to say “Welcome Home”, and during the execution the two other Sonos units ([tt]667[/tt] & [tt]668[/tt]) would follow whatever [tt]666[/tt] is doing. They’ll all [separately] restore to whatever they were doing at the end.

I’ll add some doco for this action to the Sonos Web/Wiki page.

We can use these techniques to eventually build out a similar, parallel, method for firing off “one-off” MP3’s (sound files) per the original request (for alarms and such)… The main difference there being we don’t know how long these files are, so the “restore” part of the work will need a timeout parameter.

Maybe you should add a control that in the devices list is not included the master device.

Done. If someone passes a value in the Devices list that matches the deviceId of the Sonos unit they’re already calling, then it’ll be skipped over.

In the process though, I noticed that ALL of the services implemented are of this form:
urn:micasaverde-com:serviceId:Sonos1
whereas all of the variables are of this form:
urn:sonos-com:serviceId:Sonos1

So we have mis-matched SID’s between the stateVars and the Actions…

We can correct this, but if we do we’ll break every scene that anyone has defined against the existing code.

Thoughts on correcting it?

Better to wear the hurt now than later.
It is a find and replace for each scene so not a complex task.

[quote=“Brientim, post:18, topic:173594”]Better to wear the hurt now than later.
It is a find and replace for each scene so not a complex task.[/quote]
If users are comfortable unpacking ([tt]pluto-lzo d[/tt]), editing, and repacking ([tt]pluto-lzo c[/tt]) their JSON file ([tt]/etc/cmh/user_data.json.lzo[/tt]) then it’s fairly easy for them to make the change.

If they’re not comfortable with that, then it will involve re-creating any of the scenes using the impacted services.

Hello again, any update on this? Can it be accomplished with Line-In at least?

Since i’m committing 100% to Sonos after selling my Russound system and replacing keypads with ipod controllers for Sonos app i’m hoping that I can still accomplish the same things I did before which was utilize a “Line-In” to play back alerts/sounds from a re purposed Android Phone running Vera Alerts.

So this topic is more important than ever to me.

I want to broadcast the audio across all zones and groups, then restore what was playing and the volume it was at (including groupings)

OPTIONAL READING:

Here is my progression; I used to have Sonos play a File to announce things, however the problem was that I needed to create an MP3 and store it on the network, there was a slight delay playing the file also but it worked, and here is how I accomplished it; [code] Immediate - SavePlaybackContext Immediate - GetVolume (Channel: Master) Immediate - SetVolume (Channel: Master, Desired Volume: 80) Immediate - PlayURI (URIToPlay: x-file-cifs://[remote IP]/[folder]/[filename].mp3) Delay 4 seconds - RestoreVolumePriorToRamp (channel: Master) Delay 4 seconds - RestorePlaybackContext[/code]

After going crazy creating every possible MP3 file I could think of, or think I would need in the future, I decided I needed a dynamic playback without sacrificing the quality of TTS engine, and not requiring a PC to be running all the time.

I was using the Ivona PC application and “Amy” UK English voice to create all my files, and coincidentally it’s available as a TTS engine on the Android and it works great.
The Google TTS seems a bit off try “There is a visitor approaching”, it doesn’t sound natural.

Enter Vera Alerts;
I bypassed the Sonos altogether, and just used Zone 6 in my russound as an input for the Android Phone running Vera Alerts.
When an alert was tripped I simply changed the Zones on my russound from Input 3 (Sonos) to Input 6 (Vera Alerts) for 4 seconds.
This allowed me to still get the announcements AND not lose playback on streaming audio like Pandora (It would restart a new song when I restored Playback Context (Maybe this has been fixed by now?)

The Problem with this setup was related to restoring zone volumes, but that’s in the past;

Now I’ve gone all in with Sonos.

Can I still use the Line-Out from my Android phone to play the audio through the “Line-in” on a Sonos Connect, broadcast audio to all zones (Party Mode), then restore back to what was happening previously?

In Detail;
Actions;
Save Volume level of All
Save Grouping(s)
Set Sonos:Connect to LINE-IN →
Group all Zones to play the Master’s Line-In (Party Mode?)
WAIT Determined period of time;
Restore Volume Levels
Restore Grouping(s)
Restore Playback

Possible? Please advise how, can it be done with Scene Setup Advanced tab? this feature would be invaluable for a number of reasons.

Thanks again