The Vera Community forums have moved!

Advanced => Plugins & Plugin Development => Programming => Sonos Plugin => Topic started by: lolodomo on February 16, 2014, 05:15:29 am

Title: Beta 3 version of the Sonos plugin released
Post by: lolodomo on February 16, 2014, 05:15:29 am
A new update of the Sonos plugin is now available.
You can download the ZIP file at the bottom of this page: http://code.mios.com/trac/mios_sonos-wireless-music-systems/browser/tags/beta3#
Please note that the "services" subdirectory in this archive is unnecessary.

Here are the changes:


Installation part of the wiki page has now been updated.
http://code.mios.com/trac/mios_sonos-wireless-music-systems/wiki/WikiStart#

For users that used a previous version of the plugin, I would recommend that you delete unused files after new installation:
- all files matching S_Sonos* in the directory /etc/cmh-ludl except S_Sonos1.xml.lzo and S_SonosGroupRenderingControl1.xml.lzo
- file Sonos_silence.mp3 in the directory /etc/cmh-ludl
- file Sonos_silence.mp3 in the directory /www
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on February 16, 2014, 06:01:35 am
There are still 4 topics requiring work:

This ordered list matches my priorities.
I would like to handle the first 3 topics before releasing the plugin on the app store.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on February 16, 2014, 02:32:02 pm
Restoring queue content (after TTS): when the queue contains items from a paying service: for a technical reason I still ignore, it looks like the required service key is notified to the Sonos official application but not to our plugin

I was fully wrong, I was just not looking at the right place (tag). What we need is provided. 8)
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on February 16, 2014, 03:12:46 pm
Restoring queue content (after TTS): when the queue contains items from a paying service: for a technical reason I still ignore, it looks like the required service key is notified to the Sonos official application but not to our plugin

I was fully wrong, I was just not looking at the right place (tag). What we need is provided. 8)

It is now fixed, I hope that the fix will work with any Sonos service using the Sonos queue. As an example, it is working with Amazon Cloud Player service.
The fix is not included in the beta 3 version but is available in the "in development" version (trunk) and will of course be included in next release.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on February 16, 2014, 03:18:57 pm
Restoring queue content (after TTS): it could take a lot of time if the queue content to be restored is big

At least one reason is that I am using the action AddURIToQueue rather than the action AddMultipleURIsToQueue, that is one call for each queue item rather than one unique call.
If your queue has for example 100 items, it will produce 100 calls to AddURIToQueue that will produce 100 notifications of queue update that will produce 100 calls to browse the queue content !!! That's clearly not optimal :)
Why I did it like that ? Because I don't know how to use the action AddMultipleURIsToQueue :) But I will search.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: parkerc on February 16, 2014, 04:32:00 pm
Hi @lolodomo

Quote
For users that used a previous version of the plugin, I would recommend that you delete unused files after new installation:
- all files matching S_Sonos* in the directory /etc/cmh-ludl except S_Sonos1.xml.lzo and S_SonosGroupRenderingControl1.xml.lzo
- file Sonos_silence.mp3 in the directory /etc/cmh-ludl
- file Sonos_silence.mp3 in the directory /www/

What would happen if you did not delete them?
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on February 17, 2014, 05:16:44 am
Restoring queue content (after TTS): it could take a lot of time if the queue content to be restored is big

At least one reason is that I am using the action AddURIToQueue rather than the action AddMultipleURIsToQueue, that is one call for each queue item rather than one unique call.
If your queue has for example 100 items, it will produce 100 calls to AddURIToQueue that will produce 100 notifications of queue update that will produce 100 calls to browse the queue content !!! That's clearly not optimal :)
Why I did it like that ? Because I don't know how to use the action AddMultipleURIsToQueue :) But I will search.

IFor your information, I finally succeeded to use AddMultipleURIsToQueue. So the second point should be closed very soon.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on February 17, 2014, 05:27:48 am
Hi @lolodomo

Quote
For users that used a previous version of the plugin, I would recommend that you delete unused files after new installation:
- all files matching S_Sonos* in the directory /etc/cmh-ludl except S_Sonos1.xml.lzo and S_SonosGroupRenderingControl1.xml.lzo
- file Sonos_silence.mp3 in the directory /etc/cmh-ludl
- file Sonos_silence.mp3 in the directory /www/

What would happen if you did not delete them?

Nothing bad at least for all files except S_SonosAVTransport1.xml and S_SonosRenderingControl1.xml. For these two files, if you keep them, you will be in the case that you have two services files for the same service type AVTransport:1. As the two files (S_SonosAVTransport1.xml and S_AVTransport1.xml) are identical, my assumption is that it will work well but I am not 100% sure.
I could think about a new action to check and delete all old unused service files.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: RexBeckett on February 17, 2014, 06:42:36 am
I upgraded to Beta3_161 and everything is working well. The TTS now seems more responsive and returns to the previous program stream quicker. Great work!
Title: Re: Beta 3 version of the Sonos plugin released
Post by: jimpapa on February 20, 2014, 03:31:33 pm
Also installed and got TTS working with the OSX TTS server...

VERY cool.. thanks so much for this.. My Sonos addiction is never going to be fixed now :)
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on February 20, 2014, 05:06:35 pm
Also installed and got TTS working with the OSX TTS server...

 8)
Title: Re: Beta 3 version of the Sonos plugin released
Post by: parkerc on February 21, 2014, 05:26:37 pm
Hi @lolodomo

I've just updated to your latest release but I see this when I try a TTS command. Any ideas?

UPDATE - A few more reloads has solved it, but rather than delete this I thought I'd leave it here for information, should it be of help to others
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on February 21, 2014, 07:45:37 pm
There are still 4 topics requiring work:
  • Restoring queue content (after TTS): when the queue contains items from a paying service: for a technical reason I still ignore, it looks like the required service key is notified to the Sonos official application but not to our plugin
  • Restoring queue content (after TTS): it could take a lot of time if the queue content to be restored is big

I finally found an ultra efficient way to manage queue saving and restoring, simply through a Sonos playlist (saved queue).
The change will be really noticeable. I will make more tests but I think it will be fast more or less whatever the size of the queues.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: parkerc on February 22, 2014, 04:56:29 am
Hi @lolodomo

The Sonos error message "Unable to play Say.5.mp3 - the track is not encoded correctly" is back again.  A reload of Vera seems to fix it, but it does seems to come back again. 

You have to look at the Sonos Controller (official app) to see this error message.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on February 22, 2014, 07:52:01 am
Hi @lolodomo

The Sonos error message "Unable to play Say.5.mp3 - the track is not encoded correctly" is back again.  A reload of Vera seems to fix it, but it does seems to come back again. 

You have to look at the Sonos Controller (official app) to see this error message.

Sorry, it does never happen for me.
Is there special characters in your text ? I mean, are you sure that Google produces a file not empty ?

That being said, I could add a test to check that the file is not empty before trying to play it.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on February 22, 2014, 08:05:28 am
There are still 4 topics requiring work:
  • Restoring queue content (after TTS): when the queue contains items from a paying service: for a technical reason I still ignore, it looks like the required service key is notified to the Sonos official application but not to our plugin
  • Restoring queue content (after TTS): it could take a lot of time if the queue content to be restored is big

I finally found an ultra efficient way to manage queue saving and restoring, simply through a Sonos playlist (saved queue).
The change will be really noticeable. I will make more tests but I think it will be fast more or less whatever the size of the queues.

Unfortunately, it is now too much fast and it can lead to Sonos crash in particular conditions, when groups are involved and the queue is big. When a zone becomes a coordinator for a group, it apparently inherits the queue content of the previous coordinator. During this time, the queue of the old coordinator must not be updated. At least, that is my current analysis. More work and more study will be needed...
This problem could be present even in the current and previous versions, even if I never noticed it. I am not sure.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on February 22, 2014, 08:23:13 am
Hi @lolodomo

The Sonos error message "Unable to play Say.5.mp3 - the track is not encoded correctly" is back again.  A reload of Vera seems to fix it, but it does seems to come back again. 

You have to look at the Sonos Controller (official app) to see this error message.

Sorry, it does never happen for me.
Is there special characters in your text ? I mean, are you sure that Google produces a file not empty ?

That being said, I could add a test to check that the file is not empty before trying to play it.

Comment this line in the file L_SonosTTS.lua:
Code: [Select]
        os.execute(DELETE_EXECUTE:format(device))This will disable the deletion of the file.
Then, when the problem comes back, check the size of the file and try to play it from a WEB browser using this URL: http://VERA_IP/Say.XX.mp3
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on February 22, 2014, 02:58:53 pm
There are still 4 topics requiring work:
  • Restoring queue content (after TTS): when the queue contains items from a paying service: for a technical reason I still ignore, it looks like the required service key is notified to the Sonos official application but not to our plugin
  • Restoring queue content (after TTS): it could take a lot of time if the queue content to be restored is big

I finally found an ultra efficient way to manage queue saving and restoring, simply through a Sonos playlist (saved queue).
The change will be really noticeable. I will make more tests but I think it will be fast more or less whatever the size of the queues.

Unfortunately, it is now too much fast and it can lead to Sonos crash in particular conditions, when groups are involved and the queue is big. When a zone becomes a coordinator for a group, it apparently inherits the queue content of the previous coordinator. During this time, the queue of the old coordinator must not be updated. At least, that is my current analysis. More work and more study will be needed...
This problem could be present even in the current and previous versions, even if I never noticed it. I am not sure.

I GOT IT 8)
There is absolutely no need to manage queues, it is done automatically by the Sonos. The only point is to manage correctly the groups, which is the case now. TTS is now fast and not dependent on your queue content. 8)

My two first remaining points are now fixed. Remains at least the third enhancement (UI for TTS), I started to change the UI but not yet finished.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: jimpapa on February 22, 2014, 03:08:15 pm
Awesome Lolodomo.   8)

Title: Re: Beta 3 version of the Sonos plugin released
Post by: mickesanda on February 23, 2014, 12:46:42 pm
Hello,
I have a Vera3, upgraded to UI6. I have a Sonos Connect that is working flawlessly.
I cannot make it work in my Vera3. I also have the UPNP event Proxy installed.
I am able to see what is playing on the Sonos, i can control play stop, volume, but some features are not working, amongst them TTS Say. Also Discover button doesn't seem to do anything, nor ading the IP manually.
See attached pictures. I installed the Beta3 and i also checked that i have the silence.mp3.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: garrettwp on February 23, 2014, 12:53:02 pm
Many of the plug-ins that rely on java script will need to be updated to support UI6. Right now very few of these plug-ins support UI6.

- Garrett

Title: Re: Beta 3 version of the Sonos plugin released
Post by: mickesanda on February 23, 2014, 12:57:08 pm
Thx, i'll be patient. The sad part is that the update to UI6 came automatically, and as a new Vera user I didn't think twice about upgrading, I assumed that it is backwards compatible.
Lesson learned..
/Mike

P.S. I really like AuthomationHD and I hope you'll find the time to fix UI6 compatibility
Title: Re: Beta 3 version of the Sonos plugin released
Post by: garrettwp on February 23, 2014, 01:08:58 pm
I already have a test version out that works with UI6.

- Garrett

Title: Re: Beta 3 version of the Sonos plugin released
Post by: jimpapa on February 23, 2014, 03:03:18 pm
You can roll back to UI5 and enjoy working plugins etc.

The silence file is no longer needed.

Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on February 24, 2014, 07:58:20 am
There are still 4 topics requiring work:
  • Restoring queue content (after TTS): when the queue contains items from a paying service: for a technical reason I still ignore, it looks like the required service key is notified to the Sonos official application but not to our plugin
  • Restoring queue content (after TTS): it could take a lot of time if the queue content to be restored is big
  • Moving TTS UI in a new tab to let the user selects the engine and setup the engine parameters
  • Management of pairs

This ordered list matches my priorities.
I would like to handle the first 3 topics before releasing the plugin on the app store.

Point 3 is now done too.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: mickesanda on February 24, 2014, 12:19:28 pm
Thank you lolodomo,
I downloaded tags_beta3-165 and replaced all the files acording to instructions, deleted the old device and created a new one.
Unfortunately my above stated problem remains, the device discovery doesn't work as expected.
Maybe it is related to the UPNP plugin. How do i verify that UPNP is working well with UI6?
Thank you in advance,
/Mike
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on February 24, 2014, 12:37:55 pm
Thank you lolodomo,
I downloaded tags_beta3-165 and replaced all the files acording to instructions, deleted the old device and created a new one.
Unfortunately my above stated problem remains, the device discovery doesn't work as expected.
Maybe it is related to the UPNP plugin. How do i verify that UPNP is working well with UI6?
Thank you in advance,
/Mike

The Sonos plugin has not been validated with UI6 and we already know that plugin UI will not work with UI6 due to a change of JQuery version.

Until now, the plugin is only compatible with UI5 and I suppose UI4.

You will have to be patient to get the plugin compatible with UI6. I am still running UI5 on my side.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: a-lurker on February 24, 2014, 05:27:54 pm
Hi lolodomo

I have been using Beta 3 @161 for some time with no problems, except for one:

I have a sonos box that is powered off completely over night. In the previous version of the plugin, when the sonos was powered up, the plugin knew it was back online. However with Beta 3 it no longer does and I have to push the "Check" button on the settings tab to get it back online. The DLNA plugin does the same thing. In the reverse - if the power goes off, the DLNA plugin does detect it and after a short delay says it's off line.

The proxy is installed and running - the sonos plugin says:
"UPnP Event proxy: proxy is used"

Very minor point: "proxy is used" should be either "the proxy is in use" or "the proxy is being used"

My apologies for being so pedantic about the English, as I know you are a French speaker. Thanks for your on going efforts on both the plugins.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on February 25, 2014, 06:55:23 am
Hi lolodomo

I have been using Beta 3 @161 for some time with no problems, except for one:

I have a sonos box that is powered off completely over night. In the previous version of the plugin, when the sonos was powered up, the plugin knew it was back online. However with Beta 3 it no longer does and I have to push the "Check" button on the settings tab to get it back online. The DLNA plugin does the same thing. In the reverse - if the power goes off, the DLNA plugin does detect it and after a short delay says it's off line.

Yes, since beta 3 the refresh of the state is controled by a setting defining the refresh rate: The variable is named "CheckStateRate". You can find it in the Advanced tab. The default value is 0, meaning no refresh. The expected value is a number of minutes.
I think most of people like me have Sonos powered ON all the time. I thought it was useless for us to trigger treatments every 5 minutes.

Quote
The proxy is installed and running - the sonos plugin says:
"UPnP Event proxy: proxy is used"

Very minor point: "proxy is used" should be either "the proxy is in use" or "the proxy is being used"

My apologies for being so pedantic about the English, as I know you are a French speaker. Thanks for your on going efforts on both the plugins.

I know my English speaking is not perfect. ;D
I will correct the label in beta 4.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: Rich1983 on March 02, 2014, 04:37:38 pm
Hi

I have followed instructions from http://code.mios.com/trac/mios_sonos-wireless-music-systems/wiki/WikiStart#no1

I uploaded all files as it says and created icon on dashboard but doesn't show as a Sonos or when i go into setting Tab to continue etc.

I have attached screen shot for both. I have done this method twice step by step and get the same result. I am using Vera Lite

Any help would be great.

Rich
Title: Re: Beta 3 version of the Sonos plugin released
Post by: jimpapa on March 02, 2014, 04:57:54 pm
The second pic... Did you put you actual Sonos Ip in after the screen shot ?

Title: Re: Beta 3 version of the Sonos plugin released
Post by: Rich1983 on March 02, 2014, 05:05:31 pm
Yes. It was just xxx for purpose of screenshot


Sent from my iPad using Tapatalk
Title: Re: Beta 3 version of the Sonos plugin released
Post by: Rich1983 on March 03, 2014, 02:24:11 pm
Any Help Anyone?
Title: Re: Beta 3 version of the Sonos plugin released
Post by: SteveZ on March 03, 2014, 02:37:45 pm
When you downloaded the files did you download the zip archive then extract on your computer? Or download the files individually?  Because it can cause problems if downloaded individually.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: Rich1983 on March 03, 2014, 02:41:57 pm
When you downloaded the files did you download the zip archive then extract on your computer? Or download the files individually?  Because it can cause problems if downloaded individually.

There might be my problem. I downloaded each file on there own.

I couldnt find where to download the zip archive
Title: Re: Beta 3 version of the Sonos plugin released
Post by: SteveZ on March 03, 2014, 02:51:30 pm
Click on the zip archive on the bottom of this page

http://code.mios.com/trac/mios_sonos-wireless-music-systems/browser/tags/beta3
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on March 03, 2014, 02:58:22 pm
A version beta 4 is available...
Title: Re: Beta 3 version of the Sonos plugin released
Post by: Rich1983 on March 03, 2014, 03:14:29 pm
Click on the zip archive on the bottom of this page

http://code.mios.com/trac/mios_sonos-wireless-music-systems/browser/tags/beta3

Perfect, Done that with Beta 4 and now showing correctly, thank you
Title: Re: Beta 3 version of the Sonos plugin released
Post by: silverx on September 10, 2014, 09:59:50 pm
hi just wondering if the plugin installed from the appstore is indeed this version?

i am having issue with play:3 pair, i cant seem to group other zone to my pair zone

for example in my lounge room i have a pair play:3 (part of the 5.1 setup) and i would like my other zone, let's call this zone Living Room (1 play:5) to join my lounge room

i tried by using this luup.call_action(LS_SID, "PlayURI", {URIToPlay="GZ:Lounge1"},AV_DEV) but it wont join lounge1 group

the group is visible from living room sonos device property on vera, however i did notice in the help tab, the GZ command for Lounge1 seems to be missing, i can see other zones but Lounge1 is missing

what's the easiest way to find out the plugin version that i have installed?

cheers
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on September 11, 2014, 01:47:37 am
No, version in app store is version 1.0.
Pairs are not fully supported by the plugin.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: silverx on September 11, 2014, 04:31:02 am
i see
thanks for the reply, that makes sense because i couldnt see it from the help

i tried by putting in gz:Lounge (L) <-- the master, and doesnt seem to work either

just wondering what you did in group tab, because if i check both zones it will then be able to group the zone together. is there special command we can use? :)

cheers
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on September 11, 2014, 05:14:35 am
i see
thanks for the reply, that makes sense because i couldnt see it from the help

i tried by putting in gz:Lounge (L) <-- the master, and doesnt seem to work either

just wondering what you did in group tab, because if i check both zones it will then be able to group the zone together. is there special command we can use? :)

cheers

If I correctly remember, it was reported that using group feature with the plugin can "break" a pair.
I made few changes that could improove things but that is probably not enough. I have not a perfect idea how Sonos handles pairs, and as I don't own Sonos that I can pair, it is difficult for me to make progress on this problem.
Title: Re: Beta 3 version of the Sonos plugin released
Post by: silverx on September 11, 2014, 09:30:04 am
i see

i think the safest way for me to join a group is to call the JoinGroup action directly yeah?

i am going through the code and i have no knowledge of how things work but this line caught my eyes in getUUIDFromZoneName function:

if (zoneName == name and (channelMapSet == nil or invisible == "1")) then

may i know why is it excluding paired stereo (which will have channelmapset value) but will then allow bridge to be found?

regards
Title: Re: Beta 3 version of the Sonos plugin released
Post by: silverx on September 11, 2014, 10:57:08 am
alright i did the crazy thing.

i replace that code with this line

if (zoneName == name and invisible == nil)

this would prevent bridge and my right speaker in the stereo pair (both are marked invisible) to be selected but my left speaker, which is the coordinator will be picked up

and in my scene i will then call the JoinGroup action passing in my lounge zone name

i hope i am not doing anything harmful to my sonos!
Title: Re: Beta 3 version of the Sonos plugin released
Post by: silverx on September 11, 2014, 11:27:18 am
alright, having issue leaving the group when my stereo paired speakers has joined other zone. becomestandalonecoordinator doesnt seem to work on paired stereo. is there any other method to call to leave a group? i noticed avtransporturi property was set to id of whichever zone was connected to, any way to update this value to its own id?
it's 1.30am here so i think it's probably time to sleep lol
Title: Re: Beta 3 version of the Sonos plugin released
Post by: lolodomo on September 11, 2014, 11:44:35 am
I have found this old discussion relative to pairs and group: http://forum.micasaverde.com/index.php/topic,20891.0.html
Apparently I made changes to be able to use ALL even with pairs.

As soon as you have a working fix, let me know and I will consider it for the next release.

Good night :)