Sonos plugin

Hi

Is there a way to preset the server/folder location of the setfiletoplay option so I only have to enter the file name each time rather than the whole thing ?

Cheers

I am having a problem getting any Sonos actions in the Advanced Scene creation. I am using UI5 and have tried the Trunk 13, 14 and 15 files, all to no avail. I do seem to often get a message saying that there is a missing JSON file, which could be true as I havn’t installed one, as there isn’t one in the various trunks that I could see.

Any ideas would be very welcome.

Thanks

Gizmo.

So I recently purchased a sonos play 5 and I must admit that it’s worth every penny! Besides the simplicity it delivers high quality sound!

I did not read through the entire thread but as some others here I am waiting patiently for some way to play radio stations or playlists.

Besides that I would like to know if it’s possible to issue commands to the sonos player from luup code? I would for instance like to turn up the volume slowly over time.

Thanks for a great plugin! For UI4 users I had to use rev. 13 to make it work

@Anker @Guessed and everyone.

In an attempt to get Vera to talk to me via my Sonos I found that I could create and add the following URL

http://translate.google.com/translate_tts?tl=en&q=kitchen+lights+off

as a new streaming Radio station and it plays really nicely.

It’s my hope that the next update to the Sonos Plugin will allow me to pick and play a radio station, but I also have the goal to see (with help) if I can put together a piece of code (that could e.g take the device or room name etc.) and dynamically creates these URLs and then plays them automatically via the Sonos.

Any thoughts?

[quote=“computerScience, post:163, topic:169644”]So I recently purchased a sonos play 5 and I must admit that it’s worth every penny! Besides the simplicity it delivers high quality sound!

I did not read through the entire thread but as some others here I am waiting patiently for some way to play radio stations or playlists.

Besides that I would like to know if it’s possible to issue commands to the sonos player from luup code? I would for instance like to turn up the volume slowly over time.

Thanks for a great plugin! For UI4 users I had to use rev. 13 to make it work[/quote]

@cScience

All commands in the plugin are usable through luup code… Maybe an example should find it’s way into the wiki?

/Anker

This is a really great plug in.

Questions: I would like to use sonos to play my domotic feedback like “alarm on”, “alarm off”, etc

Can I store mp3 in the sonos to avoid to have a pc always on?

How long is the delay after the scene execution in Vera?

Thank you
Matteo

Having text to speech from Vera to any Sonos zone in your house would be the killer app for Vera IMHO.

Personally I would settle for getting My VeraLite with UI5 to communicate with my Sonos at all.

At present I have written a C# app that runs on my PC and will pause any currently playing tracks on my four Sonos Zones, play my doorbell sound, and then restore the Sonos to it’s original state. This works well, but I would prefer not to leave my PC running all the time.

Does the plugin actually work with UI5 and VeraLite? Has anybody got this going?

@Matteo,

It will be handled immediatly by your sonos device,

This should be possible from a technical point of view, but is not supported from sonos… And then again, very few people out there are familiar with the ssh user/pw combination to make it happen - if you are not one of these then don’t count on making this happen :wink:

Solutions could be a nas or simply use some kind of cloud service…

/Anker

[quote=“anker, post:168, topic:169644”]@Matteo,

It will be handled immediatly by your sonos device,

This should be possible from a technical point of view, but is not supported from sonos… And then again, very few people out there are familiar with the ssh user/pw combination to make it happen - if you are not one of these then don’t count on making this happen :wink:

Solutions could be a nas or simply use some kind of cloud service…

/Anker[/quote]

Thank you for answer.

That is great!

Do you believe that I can store the mp3 on dropbox and run with Sonos? Or in which other cloud service did you try?

Thank you
Matteo

Hi matteo,

I beliebve that sonos does not support any cloud solutions right now.

Anyway, it should be possible to use some service that allows you to make file refernces directly… Not my strong area though :slight_smile:

So all in all a nas would most likely be a good solution, also to accomodate your normal music collection until a cloud service is supported from sonos.

/anker

@anker,
welcome back!
Do you have an ETA on the next release, or in the meantime, a way to specify a station?
Looks like the TTS “station” in the previous post could really open some doors, and i’m simply looking to get a playlist on my PC, or a pandora station to run when a scene is executed. Either way, thanks for your hard work!

@big517

ETA will be sometime August as I am on vacation and only have ipad access for the time being…

You will not be able to use my plugin for anything else than simple files until I modify it, as it is a matter of a hardcoded protocol - a leftover from testing at an initial phase… :wink:

/Anker

Hi All

It’s really good to see some discussions on my TTS (Text To Speech) suggestion and making it work with Sonos… It really would be a great addtion and it seems like it could be possible, as the URL was only placed in a streaming link for a new Radio Station and it worked so well…

If we were just to look at achieving TTS via playing a preset radio station, then I’d suggest we might as well stick with the ‘setfiletoplay’ option and have the record message picked from a NAS. (there are TTS services out there that will create you a spoken MP3)

The goal (ideally) is to create dynamic URLs - one that could do “Temperature in Kitchen Has Reached 20 Degrees” - Variable change and TTS are great for that.

Day to day, I already use ‘static’ mp3s (or WAVs) stored on my NAS to report various events when they occur in Vera, e.g “Front door open” etc. or as a siren in place of an seperate alarm… And for fun i can’t help by play some sound effects from 2001 or Stat Trek to freak the Mrs out. (There are a number of speech, voice download sites out there)

The challenge with all this currently is that invoking a sound stops/clears everything; there’s currently no way to restore/return to the previous action, so maybe in the future the abilty to add the file as the next track in to the queue and then to play that next track might be a good option, at least that way, when the sound has finished, the next track in the queue would kick back in.

I had a play with the Intel uPNP spy, and looked at the option on the Sonos (which is an Aladdins cave of links etc. and i was completely lost) so I will have to defer to the Oracles of this stuff, like @Anker, @Guessed etc. and look forward to the subsequent plug ins.

The best plugin ever ! and I’m really looking forward to the next release.
Is there a plan to have it on (and managed via ) the Vera App installer (or did i miss it) ?

[quote=“GizmoB73, post:167, topic:169644”]Having text to speech from Vera to any Sonos zone in your house would be the killer app for Vera IMHO.

Personally I would settle for getting My VeraLite with UI5 to communicate with my Sonos at all.

At present I have written a C# app that runs on my PC and will pause any currently playing tracks on my four Sonos Zones, play my doorbell sound, and then restore the Sonos to it’s original state. This works well, but I would prefer not to leave my PC running all the time.

Does the plugin actually work with UI5 and VeraLite? Has anybody got this going?[/quote]

I have UI5 on VeraLite and I can confirm that the Sonos plugin works well for its supported functions. Unfortunately the plugin does not replicate all the features of your C# app, so it is not able to restore the original state.

[quote=“anker, post:170, topic:169644”]Hi matteo,

I beliebve that sonos does not support any cloud solutions right now.

Anyway, it should be possible to use some service that allows you to make file refernces directly… Not my strong area though :slight_smile:

So all in all a nas would most likely be a good solution, also to accomodate your normal music collection until a cloud service is supported from sonos.

/anker[/quote]

I know some routers support plugging in a USB memory stick and sharing the files just like a real NAS. This might be a low power way to have a library of mp3 available for the Sonos plugin to play…

@GizmoB73

Can you tell me what functions you activate in sequence to get back to original state after a file is played? As I remember it the queue is not altered, but I am simply asking for any experience you have here…

/Anker

@jtmoore

Thanks jtmoore with a bit more persistence I now have some actions, so it looks like the plugin has now installed correctly and the device is being recognised as a Sonos by Vera. It took me at least 5 attempts over a period of a few weeks. I wish I knew why it suddenly started working.

@anker

[quote=“anker, post:176, topic:169644”]Can you tell me what functions you activate in sequence to get back to original state after a file is played? As I remember it the queue is not altered, but I am simply asking for any experience you have here…

/Anker[/quote]

Happy to help where I can.

Not sure how this will format in here, but here is my code for that part.

[code]foreach (UPnPMediaRenderer myRenderer in myMediaRenderer)
{
n += 1;
//Capture all relevant Sonos Device details.
SonosInfoArray[n].FriendlyName = myRenderer.MediaRendererDevice.FriendlyName;
SonosInfoArray[n].Volume = GetVolume(SonosInfoArray[n].FriendlyName);
SonosInfoArray[n].PositionInfo = GetCurrentTrackInfo(SonosInfoArray[n].FriendlyName);
SonosInfoArray[n].MediaInfo = GetCurrentMediaInfo(SonosInfoArray[n].FriendlyName);
SonosInfoArray[n].CurrentState = GetCurrentState(SonosInfoArray[n].FriendlyName);

//Set All Sonos's to volume loud enough to hear.
SetVolume(SonosInfoArray[n].FriendlyName, BELL_VOLUME);

//Set each of the Sonos's to play the Doorbell Chime MP3.
myRenderer.AVTransport.SetAVTransportURI((uint)0, strDoorbellMediaURI, strDoorbellMetadata);

}

//Set each of the Sonos’s to start playing.
foreach (UPnPMediaRenderer myRenderer in myMediaRenderer)
{
myRenderer.AVTransport.Play();
}

//Wait for doorbell to finish playing.
System.Threading.Thread.Sleep(12000);

//Restore track info
foreach (UPnPMediaRenderer myRenderer in myMediaRenderer)
{
for (int i = 0; i < myMediaRenderer.Count; i++)
{
if (myRenderer.MediaRendererDevice.FriendlyName == SonosInfoArray[i].FriendlyName)
{

		//Set the original track back again
		myRenderer.AVTransport.SetAVTransportURI((uint)0, SonosInfoArray[i].MediaInfo.CurrentUri, SonosInfoArray[i].MediaInfo.CurrentUriMetadata);
		myRenderer.AVTransport.Seek((uint)0, "TRACK_NR", SonosInfoArray[i].PositionInfo.Track.ToString());
		myRenderer.AVTransport.Seek((uint)0, "REL_TIME", SonosInfoArray[i].PositionInfo.RelativeTime);
		SetVolume(SonosInfoArray[i].FriendlyName, SonosInfoArray[i].Volume);
		if (SonosInfoArray[i].CurrentState == UPnPMediaRenderer.AVTransportService.TransportStateEnum.PLAYING)
			myRenderer.AVTransport.Play();
	}
}

}
[/code]
That’s it.

Any use?

@anker @anyone else that knows the answer

[quote=“anker, post:165, topic:169644”][quote=“computerScience, post:163, topic:169644”]So I recently purchased a sonos play 5 and I must admit that it’s worth every penny! Besides the simplicity it delivers high quality sound!

I did not read through the entire thread but as some others here I am waiting patiently for some way to play radio stations or playlists.

Besides that I would like to know if it’s possible to issue commands to the sonos player from luup code? I would for instance like to turn up the volume slowly over time.

Thanks for a great plugin! For UI4 users I had to use rev. 13 to make it work[/quote]

@cScience

All commands in the plugin are usable through luup code… Maybe an example should find it’s way into the wiki?

/Anker[/quote]

I currently drive most of my scenes through Luup code so the driving the Sonos this way would seem to be the obvious next step.

I have tried a few different commands but I’m stabbing around in the dark without an example, and one hasn’t made its way onto the wiki just yet.

Can anyone post some basic Luup that works with the plugin to get me started.

Thanks

G

[quote=“GizmoB73, post:178, topic:169644”]I currently drive most of my scenes through Luup code so the driving the Sonos this way would seem to be the obvious next step.

I have tried a few different commands but I’m stabbing around in the dark without an example, and one hasn’t made its way onto the wiki just yet.

Can anyone post some basic Luup that works with the plugin to get me started.

Thanks

G[/quote]

I can update the wiki, but first when I get back from vacation…

Hint: see what functions I have implemented in the advanced tab of a scene…

/Anker

@anker

[quote=“anker, post:179, topic:169644”][quote=“GizmoB73, post:178, topic:169644”]I currently drive most of my scenes through Luup code so the driving the Sonos this way would seem to be the obvious next step.

I have tried a few different commands but I’m stabbing around in the dark without an example, and one hasn’t made its way onto the wiki just yet.

Can anyone post some basic Luup that works with the plugin to get me started.

Thanks

G[/quote]

I can update the wiki, but first when I get back from vacation…

Hint: see what functions I have implemented in the advanced tab of a scene…

/Anker[/quote]

Here is what I have tried running from the “Test Luup Code (Lua)” window in “Develop Apps”, but it doesn’t work.

local DEVICE_NO = 27 – the Office Sonos device number
local LS_SID = “urn:schemas-micasaverde-com:device:avmisc:1”

local lul_arguments = {}
lul_arguments[“newSetFileToPlay”] = “//FND/Music/Doorbell/Tubular_westminster_8.mp3”
lul_resultcode, lul_resultstring, lul_job, lul_returnarguments = luup.call_action(LS_SID,“SetFileToPlay”, lul_arguments,DEVICE_NO)

local lul_arguments1 = {}
lul_resultcode, lul_resultstring, lul_job, lul_returnarguments = luup.call_action(LS_SID,“Play”, lul_arguments1,DEVICE_NO)

return true

Any ideas where I have gone wrong?
As the “Play” action has no arguments, is that the correct way to call it?