We have moved at community.getvera.com

Author Topic: Group Sonos players? Party Mode? then restore previous mode...  (Read 21043 times)

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #15 on: December 31, 2012, 05:45:54 am »
Maybe you should add a control that in the devices list is not included the master device.

Offline guessed

  • Community Beta
  • Master Member
  • ******
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #16 on: January 09, 2013, 12:36:00 am »
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?

Offline Brientim

  • Sr. Hero Member
  • ******
  • Posts: 2497
  • Karma: +78/-7
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #17 on: January 09, 2013, 01:06:39 am »
Better to wear the hurt now than later.
It is a find and replace for each scene so not a complex task.

Offline guessed

  • Community Beta
  • Master Member
  • ******
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #18 on: January 09, 2013, 01:13:52 am »
Better to wear the hurt now than later.
It is a find and replace for each scene so not a complex task.
If users are comfortable unpacking (pluto-lzo d), editing, and repacking (pluto-lzo c) their JSON file (/etc/cmh/user_data.json.lzo) 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.

Offline big517

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 576
  • Karma: +1/-4
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #19 on: January 26, 2013, 07:54:04 am »
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:
Quote
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: [Select]
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

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

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #20 on: January 26, 2013, 10:02:19 am »
If what has done guessed is working well for Say action, we could use the same principle for the general save/restore context.
In addition, it would be cool to be able to ask "all' devices rather than specifying the id of each device.

Offline big517

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 576
  • Karma: +1/-4
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #21 on: January 27, 2013, 06:17:25 am »
@Guessed,
Did you make the change you mentioned a few posts back?  Understanding it will result in re-creating scenes already in place, I agree with @lolodomo in "wearing the hurt now".

Offline guessed

  • Community Beta
  • Master Member
  • ******
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #22 on: January 27, 2013, 06:03:54 pm »
@Guessed,
Did you make the change you mentioned a few posts back?  Understanding it will result in re-creating scenes already in place, I agree with @lolodomo in "wearing the hurt now".
That change, to alter the ServiceId's to the standard for ACTIONs, has not been done.  I only got one reply to that issue, from @Brientim, and I needed more positive confirmation before I made the change.

I believe we need to make it now, but it will break EVERY scene that anyone has defined, once it's rolled in.

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #23 on: January 28, 2013, 05:09:00 am »
What would be the SID you will prefer ?

Offline guessed

  • Community Beta
  • Master Member
  • ******
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #24 on: January 28, 2013, 10:08:57 am »
The Variables all consistently use:
Code: [Select]
38   local SONOS_SID = "urn:sonos-com:serviceId:Sonos1"
The actions all use:
Code: [Select]
39   local SONOS_ALT_SID = "urn:micasaverde-com:serviceId:Sonos1"

I'd like the sonos-com version, but clearly making that change will break existing scenes.  Having "both", for ACTIONS, would result in dual entries in the LoV and folks would still get confused.

Offline big517

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 576
  • Karma: +1/-4
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #25 on: January 29, 2013, 06:43:09 am »
I plan to redo all my scenes when this is implemented anyway because it is more useful feature for people with multiple devices.
Maybe implement this is a "paging" function that does all the work of saving vol/group/playback behind the scenes, and for ease of use make whichever sonos device is being used for the page feature be the main one.

Master device: Page (global sonos save then tune all slave devices into master's playback)
Master device : Specify playback for page duration
Pause duration in seconds
Master device: EndPage (restore all settings across sonos network prior to page function)


For advanced usage the line in now has auto detect on signal. Can you call the voltage level from sonos and have it (endPage) when there is no more voltage sensed on the master device input? I :)

Seems to be that there are 2 major features here that revolve around a big piece of the Sonos software which is group / party mode.

This an line level detection I just thought of would be a real nice function in this plugin especially utilizing the absence of the line in to determine when the page is finished as that could trigger the (EndPage). Function and this would be separate from party mode.

Another feature for ease of use would be in advanced tab when selecting party or page you have a drop down to select the slave devices you want included if not (all).

Just to clarify, the "End Party" function is called when all the girls at the party voluntarily leave and that is the users problem to fix.

Offline a-lurker

  • Hero Member
  • *****
  • Posts: 872
  • Karma: +66/-8
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #26 on: January 30, 2013, 01:11:30 am »
This all looks like a lot of work but I really like the 'page' concept. To make it more complicated I would like to be about to assign a switch to the power supply of each Sonos box. ie I don't want them running all day waiting for a page. Just power them up when needed and noting which one's were already running, so the correct ones can be powered down again. Doing so would require a (settable) delay while the units power up and join the Sonos network. Clearly paging on regular basis would make this a bit silly but for say, for less frequent announcements, such as a "Fire", it would make sense.

Offline big517

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 576
  • Karma: +1/-4
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #27 on: January 30, 2013, 10:49:37 am »
This all looks like a lot of work but I really like the 'page' concept. To make it more complicated I would like to be about to assign a switch to the power supply of each Sonos box. ie I don't want them running all day waiting for a page. Just power them up when needed and noting which one's were already running, so the correct ones can be powered down again. Doing so would require a (settable) delay while the units power up and join the Sonos network. Clearly paging on regular basis would make this a bit silly but for say, for less frequent announcements, such as a "Fire", it would make sense.

You can accomplish the power management outside of this plugin and the time it takes to start this up/connect and execute the grouping just to send a page defeats the urgent nature of paging.   

I'm hoping they can get this basic functionality in place first...   It may take a little extra work to fix some scenes, but what's hard in the beginning is always easy in the end.

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #28 on: January 30, 2013, 03:49:27 pm »
I have done few changes that should clearly help, I hope.
Please see an example of scene (image attached=. This example saves the playback context then play one of my favorite radio setting the volume to 50; 30 seconds later, the previous playback context is restored.
What is interesting for you is the new parameter GroupDevices for the SavePlaybackContext and PlayURI actions. You can use it to group additional Sonos devices. Sorry I am not able to show you an example or even test the code as I have only one Sonos, but it should be ok. You have to set a comma separated list of device id.

All this is mainly an extension of what guessed done with the Say action.

I am waiting for your feedback.

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #29 on: January 30, 2013, 04:02:53 pm »
And if you are interested, I could easily add a new parameter to PlayURI action to make all this possible just calling PlayURI.
The parameter would be named CxtRestoreDelay. If set, the current playback context would be first saved and then automatically restored when the delay expires. If not set, we would have the current behaviour (no save/restore of the current playback context).

Another possible enhancement would be to let the user specify "all" in the GroupDevices parameter. This will automatically group all Sonos devices (the ones defined in the Vera). That would avoid to have to set a list of devices.