Sonos plugin

[quote=“Peraverde, post:79, topic:169644”]Thanks a lot Anker, Guessed and the others.
It works!!!

Not only UI4 but UI5 as well.
I tried few versions of luua files and this one works on Vera2 and Vera3.
Play, Stop, Mute, Mute(2nd), unMute, SkipDown, SkipUp, Pause, Down and Up (volume) functions work very well,
but FastForward, Rewind, Slow seems not working.

And I don’t understand the other commands ChapterUp, ChapterDown, DiskDown, DiskUp and GetTransportInfo.
What are they for?
How to use them?

I would like to make Sonos to play chosen audio file.
It would be nice when you leaving the house, to hear voice: “Window is open in the bathroom, please close it.”.
Anybody knows how to do it?[/quote]

Hi Peraverde,

Glad that you can use it!

The two different mute’s are to align to the Sonos and align to upnp. The Sonos1 mute is a typical Mute, but the one Volume1 is a mute/unmute toggle. Therefor the two different ones.

About the ChapterUp, ChapterDown, DiskDown, DiskUp commands. these are part of the standard MediaNavigation implementation on Vera. Doing this enables the plugin to work for example in other standards such as the iphone control point applications for Vera.

These are all listed, but not implemented in the sonos plugin! @guessed guided me on this and I trust his judgement :slight_smile:

The following actions has been implemented in the plugin:

Play, Pause, Stop, Mute, UnMute, SkipDown (Sonos Next command), SkipUp (Sonos Previous command), Up (Volume, Down (Volume)

the rest has no functionality as I have not found any Sonos related actions that would macth these.

GetTransportInfo is something I need to remove…

I am looking into a SetVolume action, but this involves a new way of programming the plugin. I hope to get this working soon. Will keep you posted.

The request to be able to play a specific song is a bit more hard to implement from what I can understand of the Sonos protocol. Will look into this at a later stage.

Regards,

anker

Update in revision 12 in the trunk: / – Sonos Wireless HiFi Music Systems

  • This adds a SetVolume action that supports setting an absolute volume from 0 to 100
  • I have removed an action that was not used called GetTransportInfo.

Thanks to @guessed for helping me out on the syntax for putting variables into a table!

/anker

Now in revision 13 in the trunk you will find a SetFileToPlay action that allows you to specify a specific audio file to replace the current queue.
Using this together with the Play action and the SetVolume action should match requirements from some users (teonebello and Peraverde).

Link to trunk: / – Sonos Wireless HiFi Music Systems

/anker

[quote=“Peraverde, post:79, topic:169644”]…but FastForward, Rewind, Slow seems not working.

And I don’t understand the other commands ChapterUp, ChapterDown, DiskDown, DiskUp …
What are they for?
How to use them?[/quote]
To further @anker’s comments above, the Vera Scene UI looks only at what Services have been implemented, and not at which Actions within those Services, have been implemented when it’s presenting it’s UI/Picklists for a given Device.

Often these services are a large collection of Actions, many of which won’t be implemented. When you go to the Scene creation UI, you’ll see them all listed.

More advanced UI’s only show you those Actions that are implemented by a particular device, which greatly reduces the confusion for users. SQRemote does this, for example, in it’s picklists.

[quote=“anker, post:83, topic:169644”]Now in revision 13 in the trunk you will find a SetFileToPlay action that allows you to specify a specific audio file to replace the current queue.
Using this together with the Play action and the SetVolume action should match requirements from some users (teonebello and Peraverde).

Link to trunk: / – Sonos Wireless HiFi Music Systems

/anker[/quote]

Hi Great work!

I have one question where does the file you want to play need to be? And how do you specify the path?

Hi J0rgensen,

Use the full path. I.e. //NAS/Music/… Or //ipadress of music library/…

/anker

Ok, i did that but Sonos keeps saying that it cant find the file. I can play the audio file when i use the Sonos controller. Maybe its not working in UI5 ?

It’s working fine on my Vera Lite with UI5. Path for me takes the form

//TimeCapsule/Data/Music/Folder/filename.mp3

Now its working :slight_smile: i did not know the path was case sensitive. Thanks

When working with Unix/ Linux, it is case sensitive.

  • Garrett

Hi again
I have one good news and one bad news.
The bad is: revision 13 and SetFileToPlay is not working :frowning: - but I hope to fix it.
And my NAS requires login/password :frowning:

The good news is: I’ve got new idea!
If mp3s will be stored on Vera filesystem (Samba is required or something like that)
the voice announcements will be NAS independent.
And we could say not only “Vera speaks Z-Wave” but “Vera speaks tongues”!

regards
Slavomir

[quote=“Peraverde, post:91, topic:169644”]Hi again
I have one good news and one bad news.
The bad is: revision 13 and SetFileToPlay is not working :frowning: - but I hope to fix it.
And my NAS requires login/password :frowning:

The good news is: I’ve got new idea!
If mp3s will be stored on Vera filesystem (Samba is required or something like that)
the voice announcements will be NAS independent.
And we could say not only “Vera speaks Z-Wave” but “Vera speaks tongues”!

regards
Slavomir[/quote]

Hi Peraverde,

SetFileToPlay does work for NAS connected music libraries. You must use the absolute path i.e. \ip address\Music\

Regarding user/pw - this is not a problem as it is the Sonos that reads the file and as long as this file is a part of the sonos Library already this will work. Be aware that the path is case sensitive!

Could you write back to me what path you put into the SetFileToPlay field?

I do not know how Sonos reacts if you point the SetFileToPlay to a local Vera audio file (if a file must be part of the library to work), but feel free to test.

Regards,

Anker

Thanks Anker
I use path like \NASA-02\muza\ACDC\1978 - Powerage\04. Riff Raff.mp3
and tested //NASA-02/muza/ACDC/1978 - Powerage/04. Riff Raff.mp3 - the same.

But I don’t understand why revision 9-14 doesn’t work.
The only files which work are older ones.
I checked that problem is with I_Sonos file.
When I upload 14 revision I got message “Sonos[19] : Startup Lua Failed”
and all Sonos commands stop to work.
After uploading an old 8th revision of I_Sonos1.xml - all commands start to work again, but not SetFiletoPlay.

I have ZP100, ZP80 and CONNECT:AMP and Vera3 Polish UI5 - all the same problem.
I have Vera 3 English UI as well - I testet shortly SetFileToPlay on it - the same problem

Hi,

Somes changes on 14th revesion to be UIV5 ready (but wont works with UIV4).

Antor! You are Great! as Anker is :wink:
It realy works on UI5

Path must be with slashes not backslashes (eg //NAS/My music/some file.mp3). Spaces and diacritic marks are allowed.

Thanks

Slavomir

[quote=“Peraverde, post:95, topic:169644”]Antor! You are Great!
It realy works on UI5[/quote]

Thank, but best thank is to Anker ! I just do some few changes to be UIV5 compatible

Hey @Antor,
I haven’t looked at the specific changes just yet, but given there’s no JSON file for this the original plugin code from code.mios.com should work fine on either UI4 or UI5.

There are definitely things you can do with Libs in UI5 that’ll prohibit it from working under UI4, but there’s no need to do those - the core Lua-based techniques from UI4 for library handling work fine in UI5 also, so there’s no need to use the MiOS (and UI5) specific extensions.

The biggest challenge for UI4 <-> UI5 compatibility are in the JSON file, and even there it’s possible to get a reasonable overlapping set of UI features that’ll work in both, with a single JSON… but we don’t have one of those yet, so that’s not an issue.

Can you summarize what problems you were having under UI5, and which UI5 Version, that triggered the need to change the code?

[quote=“Antor, post:96, topic:169644”][quote=“Peraverde, post:95, topic:169644”]Antor! You are Great!
It realy works on UI5[/quote]

Thank, but best thank is to Anker ! I just do some few changes to be UIV5 compatible[/quote]

Hey @Guessed

I cannot explain why the 14th release isn’t working with UIV5 because i’m still newbie, but if you upload file => you have got the “Sonos[XX] : Startup Lua Failed” like Peraverde says.

So i tried to check why it’s not working on UIV5, and according to the ssh consol message i remove the old way to do lua package :

    if (package.path:find("/etc/cmh-ludl/?.lua;/etc/cmh-lu/?.lua", 1, true) == nil) then
        package.path = package.path..";/etc/cmh-ludl/?.lua;/etc/cmh-lu/?.lua"
    end
    package.loaded.L_Sonos1 = nil
    upnp = require("L_Sonos1")

to new UIV5 way

<files>L_Sonos1.lua</files>

And replace all “upnp.” to “” in I_Sonos1.xml and remove “module(“L_Sonos1”, package.seeall)” on .lua file.

Ah yes, that’s bug/regression #2000 (http://bugs.micasaverde.com/view.php?id=2000), details in this bug:
http://forum.micasaverde.com/index.php/topic,8784.0.html

which was fixed in 1.5.261, but that release hasn’t been made generally available to users yet. Once they release it, the code will work unchanged between UI4 and UI5. The alternative to making these changes is to uncompress the .lua file after it’s uploaded, using the following:

cd /etc/cmh-ludl/ pluto-lzo d L_Sonos1.lua.lzo L_Sonos1.lua

I’m confused ???

I have UI4 1.1.1362 and I’ve downloaded revision 14’s zip file, unzipped it at my PC and uploaded all 4 files under “Luup files” tab.

/etc/cmh-ludl now contains D_Sonos1.xml.lzo, I_Sonos1.xml.lzo, S_Sonos1.xml.lzo and L_Sonos1.lua.

After creating a Sonos device, I got the “Startup Lua failed” message.

Then, I tried to upload the L_Sonos1.lua file under “Extra Lua files”, and got a confirmation message, but I still get the Startup Lua error after reload.

Any clue ? Shall I install revision 13 instead ? Where can I get iit ?