Sonos plugin

Never mind… I found a “L_Sonos1.lua” file at /usr/lib/lua that I installed yesterday. I replaced it with the version unzipped at my PC and now it’s working fine !

For the future, are .lua files uploaded under “Luup files” or “Extra Lua files” tab ?

Thank’s

They all go up using “Luup Files”, nothing should be under [tt]/usr/lib/lua/[/tt], from this plugin’s standpoint, as it has the code to “path” to the right spot.

Thank you Guessed.

I tested SetFileToPlay both with luup.call_action(“urn:micasaverde-com:serviceId:Sonos1”,“SetFileToPlay”,{[“FileToPlay”] = “\ipaddress\path\filename”},60) and with a scene. Doesn’t work, I guess I need to wait for a new release that fixes UI4 issues !?

Is it possible to read Sonos state (volume/play/stop) with luup.variable_get, like any ZWave device ? I developed a scene engine that triggers scenes based on events and current scenes, so I would find it usefull…

Using [tt]luup.call_action[/tt], it’ll be something more like:

luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "SetFileToPlay", {FileToPlay = "\\\\ipaddress\\path\\filename"}, 60)

NOTE: “[tt][/tt]” is an escaping character in Lua. So “[tt]\f[/tt]” gets mapped an old form-feed character, so you need to escape-the-escape char (“[tt][/tt]” → “[tt]\[/tt]”)

PS: I don’t have a Sonos, so I haven’t tested the above and I’m really just guessing the issue with the use of DOS-based pathing.

[quote=“vascodp, post:103, topic:169644”]Thank you Guessed.

I tested SetFileToPlay both with luup.call_action(“urn:micasaverde-com:serviceId:Sonos1”,“SetFileToPlay”,{[“FileToPlay”] = “\ipaddress\path\filename”},60) and with a scene. Doesn’t work, I guess I need to wait for a new release that fixes UI4 issues !?

Is it possible to read Sonos state (volume/play/stop) with luup.variable_get, like any ZWave device ? I developed a scene engine that triggers scenes based on events and current scenes, so I would find it usefull…[/quote]

Hi,

You could use revision 13, as rev 14 only is a UI5 fix. I use it myself and SetFileToPlay works fine in scenes using the advanced tab. I did not try myself to use it in lua code, but it should be possible to do that.

Regarding the get functions - I did not implement these, but will put these on the to do list :slight_smile:

/ankere

@guessed, good point but it still does not work…

@anker, can you help me to find release 13 ? I can only find 14…

Thanks a lot, guys

@vascodp,

Link for rev 13: trunk – Sonos Wireless HiFi Music Systems

Enjoy!

/ankere

@anker,

I installed rev 13 and, after replacing \ by // (!?), I confirmed that the Sonos Remote now displays the file I want to play.

However, when I press play on the physical remote or using the Plugin, I get the error “Unable to play filename - access to //ipaddress/path denied”. So, I had to allow unsecured read access on my NAS and it now works fine. But shouldn’t Sonos use the credentials I provided during set up, to access a file stored in my itunes library ? Is it possible to change Sonos behaviour at the plugin’s level ?

I’m crossing my fingers to be able to control the sources to be played (radio station “X”, or CD player connected to Sonos “Y”…). Also, it would be usefull to link or unlink zones directly from the plugin. For example, I frequently link my kitchen with my living room, but I would like to use a scene to set play to my kitchen only, after making sure that it is not linked to any other room… Sorry if I’m asking too much :wink:

Thanks a lot,
vascodp

@anker

I’ve downloaded the files but can’t control any of my Sonos Zones. There aren’t any options for doing so in the Control tab in Dashboard or anywhere that I can find.

[quote=“shep29, post:109, topic:169644”]@anker

I’ve downloaded the files but can’t control any of my Sonos Zones. There aren’t any options for doing so in the Control tab in Dashboard or anywhere that I can find.[/quote]

@shep29

Did you followinstructions on installing it as a plugin?

/ankere

[quote=“vascodp, post:108, topic:169644”]@anker,

I installed rev 13 and, after replacing \ by // (!?), I confirmed that the Sonos Remote now displays the file I want to play.

However, when I press play on the physical remote or using the Plugin, I get the error “Unable to play filename - access to //ipaddress/path denied”. So, I had to allow unsecured read access on my NAS and it now works fine. But shouldn’t Sonos use the credentials I provided during set up, to access a file stored in my itunes library ? Is it possible to change Sonos behaviour at the plugin’s level ?

I’m crossing my fingers to be able to control the sources to be played (radio station “X”, or CD player connected to Sonos “Y”…). Also, it would be usefull to link or unlink zones directly from the plugin. For example, I frequently link my kitchen with my living room, but I would like to use a scene to set play to my kitchen only, after making sure that it is not linked to any other room… Sorry if I’m asking too much :wink:

Thanks a lot,
vascodp[/quote]

@vascodp

Is your audio file already a part of your sonos library - if not this could be the issue! Could you please check this?

With regards to the various audio types it should be possible to use the SetFileToPlay functionality - I only need to figure out the syntax.

The linking of Zones is a bit more tricky though…

/anker

@Anker

Yep, I followed these instructions exactly:

How To

Upload the plugin files:
    In the Toolbox section open MiOS Developers >> Luup Files and upload all the files you downloaded. check the Restart Luup after upload checkbox and click GO. 
Create the Sonos device:
    Open Create Device.
    In the UpnpDevFilename input box enter D_Sonos1.xml.
    In the Description input box enter a name for the panel device, e.g. Sonos Living Room.
    Click Create device. 
Close this window and Save.

@shep29

You will have to select the advanced tab on a scene, where you will find possibilities to control the device.

/anker

[quote=“anker, post:113, topic:169644”]@shep29

You will have to select the advanced tab on the device you created, where you will find possibilities to control the device.

/anker[/quote]

There is nothing in the Advanced tab, or any other tab, of the device to let me control my Sonos. See images of tabs attached.

And here’s Device Options…

Hi,

If you read the instructions carefully :slight_smile: you will see that you need to create a scene and here select the advanced tab to control the sonos device you created.

I know it can be confusing, but this is the way the plugin is designed.

Hope you will get this working - if not pls get back to me!

/anker

@anker,

The file was randomly picked from my itunes library (original location, no copies) and was indexed by Sonos. It seems that the plugin can only access non-protected NAS shares…

vascodp

Hi,

Cant tell what the problem is as this actually is the Sonos itself. If the sonos is able to show the file and attributes when you use the SetFileToPlay then the rest is the Sonos… I use mine with user/pw through the sonos setup on my NAS and it works fine…

Are you certain that you use the correct path? Do you see attributes (artist, picture, etc) after SetFileToPlay?

/anker

My Sonos plug-in works perfectly, but during installation and setup I found it helpful to have the Sonos app running on my laptop when trying to figure out paths etc. because if there’s a problem when Vera sends the command you can see an error message at the bottom of the Sonos app window.

Thank You all for the Sonos Plug in.
Question?
Has anyone created a command to set the Sonos Player to play a Music Service Like Pandora?
It would be nice if we could set the Zone Player to Play one of our Pandora Stations.