We have moved at community.getvera.com

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

Offline big517

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 576
  • Karma: +1/-4
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #30 on: January 30, 2013, 04:29:20 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.

These enhancements would be great.  Can you set this p to specify ALL in the group devices?  will that restore previous groupings after the delay?

I'll test when I get home tonight, just want to be sure I know what to expect and how to do it for testing.

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #31 on: January 30, 2013, 04:41:35 pm »
These enhancements would be great.  Can you set this p to specify ALL in the group devices?

Not something I can do in five minutes. But it can certainly be implemented later if you confirm that what I have implemeted is working well.

Quote
will that restore previous groupings after the delay?

Sorry, I don't know... To be verified.
If it was previously working for Say action, it will work for PlayURI action.

Quote
I'll test when I get home tonight, just want to be sure I know what to expect and how to do it for testing.

You have my scene screenshot as example. In another topic, guessed explained how to use the GroupDevices parameter. It is a comma-separated list of device id.
Guessed's explanation is at the bottom of the first page of this topic: http://forum.micasaverde.com/index.php/topic,12860.msg96511.html#msg96511
« Last Edit: January 30, 2013, 04:47:48 pm by lolodomo »

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #32 on: January 30, 2013, 04:53:51 pm »
When units are grouped in the way we are now doing it, I have no idea whether the volume is still managed unit per unit or global to all grouped units ?
If it is still individual to each unit, another easy enhancement could be to change Say and PlayURI actions to make the volume set globally for all the devices (the main one + the ones mentioned in the GroupDevices parameter).
If it is managed globally, then the volume I set should already affect all the units and nothing more needs to be done.
« Last Edit: January 30, 2013, 04:56:16 pm by lolodomo »

Offline big517

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 576
  • Karma: +1/-4
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #33 on: January 30, 2013, 05:06:56 pm »
Do I only need to replace the I_Sonos1.xml and S_SonosAVTransport1.xml files?
I updated last week and pushed the png files via WINSCP so I have the icons, and i've uploaded those 2 files, but i'm not seeing the SavePlaybackContext - GrouipDevices action...
« Last Edit: January 30, 2013, 05:25:27 pm by big517 »

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #34 on: January 30, 2013, 05:59:10 pm »
S_Sonos1.xml bas been updated toi.

Offline big517

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 576
  • Karma: +1/-4
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #35 on: January 30, 2013, 06:12:23 pm »
updated all again to be safe, context menu is there.  I only have 2 sonos's plugged in right now but I noticed that when I do

Code: [Select]
luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say",
                 {Text="Welcome Home", Devices="399,163"}, 163)

This ONLY plays on the 163 unit...  Does this code REQUIRE 3 sonos systems, or is this a bug?  I'll test with 3rd hooked up tonight.

Testing the Saveplayback / PlayURI, PAUSE RestorePlaybackContext now...
Hoping that both devices will resume what they were playing previously.

Seems to Work, but refreshing looks buggy when testing remotely
1st test appeared to work by looking at status of devices.
2nd test did not reflect grouping playback or volume adjustment in non-master, it remained playing same
3rd test did not relfect gouping playback or volume again...

.... Will resume test tonight when i'm home, and with 3 sonos' hooked up.




Offline big517

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 576
  • Karma: +1/-4
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #36 on: January 31, 2013, 06:15:18 pm »
Findings of Grouping with SAY function

Testing "SAY" function in advanced scene setup and grouping 2 other sonos systems (399,485);

While playing 3 separate Streaming Radio Stations via TuneInRadio

Sending text "Testing 1, 2, 3, 4" takes roughly 7 seconds to play, then another 15-20 seconds to resume previous playback of streaming radio.
Pre-existing groups before the Say command are returned to their pre-existing groups (great job).

Same tests done with Local Media files had a different results
3 to 5 seconds to speak the words which is better BUT only the Master Sonos device that executed the command would resume playback, the others sat with no queue and no music playing when they should be resuming!

Interesting to find this did not resume playing local music.  So I tested with all 3 Sonos's playing from 3 different Network Attached Storage Devices.    Same Result... Only Master resumed playing, and other 2 lost all playback info except volume.

Summary-
Speed / Response time is lagging, not acceptable for instant feedback, or if you are playing from more than one network file source.

Will test Saveplaybackcontext, and restore respectively next.

Findings of Testing SavePlaybackContext, PlayURI of local file and Grouping 2 additional Sonos's, then RestorePlaybackContext.

Same findings as above except much faster response time.  Works flawlessly with Streaming Radio. however the same bug exists using 3 sources on "Music Library" will only resume playback on the Master Sonos that executed the scene.

I think that is definitely a bug.

Off topic a bit, but how to we play the "Line In" from a device?  That would be my next test...


« Last Edit: January 31, 2013, 06:37:34 pm by big517 »

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #37 on: February 06, 2013, 06:17:03 pm »
This requires guessed for testing and enhancing.
I have only one Sonos unit and so I cannot really help.

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 #38 on: February 24, 2013, 07:11:52 pm »
I started looking at this first for where all the time was going, given the comments about lag - something that'll benefit all users. 

Here's a fairly typical log output showing the low-level timings of the various "parts" of the Say command executing.

For this test, I turned off Verbose logging, as well as Debug logging from within the Plugin itself.  This isn't the way we currently distribute it, but it was done to eliminate the costs of Vera's logging functions (and we can turn off our debugging in the Checked in version as needed)

For the purposes of the test, I added a few log lines to show where we're at in the execution of the Say command.  Since the logs has finer timing granularity than os.time(), I'm using it to get an idea of the larger consumers.  I also print the os.time() diffs at the bottom, but you can see they're not as accurate overall.

The run below was a typical run.  There are typically only minor variations across runs, but occasionally it takes a few seconds more.  I'm attributing that to "other things" running in the Vera at that time (eg, our own cyclic refresh of the state, for example).

For the test, I used the TTS of "This is a test".

Overall, the Plugin's contribution to the lag is nearly 2s.  The rough timing for the key contributors...
  • Google TTS: ~840ms
  • Save Context: ~270ms
  • SetAVTransport: ~480ms
  • Group: ~240ms
  • Play: ~100ms

We may be able to shim some time out of this by looking at our UPnP calls, but we're not likely to see large savings there.

The biggest savings would come in having the MiOS UPnP routines works correctly, esp the NOTIFY stuff, since we could completely avoid [synchronously] calling the device to get it's "current" context.  After that, a little resequencing may also help, since the Sonos must be losing some time before it starts playback also.  (so tell it to Play, then tell it to Group)



If I get some time with both Sonos units, I'll look at the other problem.

08   02/24/13 15:58:08.039   Scene::RunScene running 104 Say Guest+Master <0x2f8ba680>
08   02/24/13 15:58:08.039   JobHandler_LuaUPnP::HandleActionRequest device: 295 service: urn:micasaverde-com:serviceId:Sonos1 action: Say <0x2f8ba680>
50   02/24/13 15:58:08.041   luup_log:295: Sonos: Say: Start <0x2f8ba680>
50   02/24/13 15:58:08.486   luup_log:295: Sonos: Say: After Concat <0x2f8ba680>
50   02/24/13 15:58:08.487   luup_log:295: Sonos: Say: After File size <0x2f8ba680>
50   02/24/13 15:58:08.687   luup_log:295: Sonos: Say: After save context <0x2f8ba680>
50   02/24/13 15:58:09.143   luup_log:295: Sonos: Say: After SetAVTransportURI <0x2f8ba680>
50   02/24/13 15:58:09.319   luup_log:295: Sonos: Say: After Group Devices <0x2f8ba680>
50   02/24/13 15:58:09.368   luup_log:295: Sonos: Say: After Play <0x2f8ba680>
50   02/24/13 15:58:09.369   luup_log:295: Sonos: Say: totalTime=1 <0x2f8ba680>
50   02/24/13 15:58:09.369   luup_log:295: Sonos: Say: googleTime=0 <0x2f8ba680>

Offline big517

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 576
  • Karma: +1/-4
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #39 on: February 25, 2013, 06:40:21 am »
Glad to see some progress on this.  I'm interested to see what your findings are with multiple units.
Can you also show the logs with the restore context?  Thx
Sent from my SCH-I535 using Tapatalk 2

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #40 on: February 25, 2013, 01:27:01 pm »
@guessed: could you check PlayURI with multiple zones please ? big517 said it was not working well. i may have done some mistakes as i did that in blind mode (no test).
« Last Edit: February 25, 2013, 02:22:11 pm by lolodomo »

Offline big517

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 576
  • Karma: +1/-4
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #41 on: March 04, 2013, 03:33:53 pm »
Any other tests i can help with?   I now have 2 Sonos amps now also
« Last Edit: March 04, 2013, 03:48:49 pm by big517 »

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 #42 on: March 04, 2013, 03:57:01 pm »
Any other tests i can help with?   I now have 2 Sonos amps now also
Not yet, it's mostly a matter of having some dedicated time to test it all out.  I have all the technical bits, but time is v. scarce right now.

Offline big517

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 576
  • Karma: +1/-4
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #43 on: March 19, 2013, 07:12:55 am »
Good news!

Earlier in the thread I mentioned using a "phantom zone" to transfer Pandora currently playing data over so we don't start a new song when a Restore to is called and a device goes back to it's Pandora station.  Currently when you restore a device that was playing a Pandora station, it will start a new track unfortunately.

I have a device that has been disconnected for a week... It still shows up on the Sonos network, and in the Sonos software. 
I successfully played a Pandora station on it... Then grouped a real Sonos device that is active and it retained playback!  :o

This is proof that Sonos will allow you to "shift" the Pandora station over to another device (even if device does not exist), continue to play, and shift back to an existing device for uninterrupted Pandora experience!

Does this provide you the opportunity to successfully restore streaming audio without sacrificing the currently playing Pandora track?   Maybe this is faster than Saving playback context?  I saw lolodomo's update that will only restore modified queue data which will speed things up anyway, but this has to be a big step in the right direction for Pandora users...

What do you think?


Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Group Sonos players? Party Mode? then restore previous mode...
« Reply #44 on: March 20, 2013, 05:16:54 am »
I saw lolodomo's update that will only restore modified queue data which will speed things up anyway

Please note that it was potentially slower from the the version committed the 28th of February until my commit dated the 18th of March.