Sonos plugin

[quote=“guessed, post:198, topic:169644”]The error i’m commonly getting is “translate_tts?tl=en Station Not Found” which makes me wonder if the plugin or Vera, or Sonos is getting hung up on the “&” part of the URL…[/quote]it’s not encoding the URI internally (right now) but you can test if that’s the issue by changing the & in the URL into & like this:

http://192.168.0.40:3480/data_request?id=action&DeviceNum=163&serviceId=urn:micasaverde-com:serviceId:Sonos1&action=SetURIToPlay&URIToPlay=x-rincon-mp3radio//translate.google.com/translate_tts?tl=en&q=the+test+is+on+to+verify+playback
[/quote]

Same error, I tried x-rincon-stream:, and x-rincon-mp3radio: with no luck… Parkerec said he was able to save this as a Station, then play. How would we specify a station that we have saved in our favorites?

Actually, given that it’s coming in on a URL it may need to be double-encoded. It’ll get decoded once by Vera, then we still need to pass an encoded value in the XML to the Sonos.

Unfortunately I don’t have a Sonos to test this against.

@anker: it looks like the IP is hardcoded in the UPnP_subscribe call also, probably not an impact right now though. You may also want to move some of the startup stuff to a call_delay block, as it’ll make startup faster.

Check also your serviceIds for the state variables you’re setting. These should likely be stored against a Sonos specific serviceId (… With “…:serviceId:…” in its name)

[quote=“big517, post:197, topic:169644”]You are running the latest version: 1.5.408 .
I downloaded all files in the Trunk 18 link, you may want to re-uplaod them just in case…[/quote]

I’ve just re-downloaded the files again and uploaded them all (inc. the D_Sonos1.xml) and strangley this time only urn:MiCasaVerde-com:serviceId:HaDevice1 appears in the functions dropdown list. VERY STRANGE ?!?

Reverting back to v. 14 and it is OK again.

While I eagerly await ankers thoughts on my particular issue, I’ve been doing some digging and found some interesting things that might be of interest. (it certainly was for me) - using the IP of your Sonos unit…

http://192.168.1.xx:1400/status = gives you a list of links to various status/info pages. e.g

http://192.168.1.xx:1400/status/topology = to get the UUID of each zone player

http://192.168.1.xx:1400/status/radiolog = the radio stations you have added, so for the tts one I created it shows it as

Timestamp Type URI
4259963 stream x-rincon-mp3radio://translate.google.com/translate_tts?tl=en&q=kitchen+lights+off

http://forums.sonos.com/showthread.php?t=5706&page=6 suggests - “x-rincon-stream:uuid” is where the uuid is the identifier of the ZP with the line-in you want to use… … something like “x-rincon:RINCON_000E5811467403420”.

Works here :slight_smile: UI5, Vera3, Sonos play5, I uploaded the new files and made a new scene with this uri:

x-rincon-mp3radio://live-icy.gss.dr.dk:8000/Channel5_HQ.mp3 (DR P3)

[quote=“parkerc, post:202, topic:169644”]While I eagerly await ankers thoughts on my particular issue, I’ve been doing some digging and found some interesting things that might be of interest. (it certainly was for me) - using the IP of your Sonos unit…

http://192.168.1.xx:1400/status = gives you a list of links to various status/info pages. e.g

http://192.168.1.xx:1400/status/topology = to get the UUID of each zone player

http://192.168.1.xx:1400/status/radiolog = the radio stations you have added, so for the tts one I created it shows it as

Timestamp Type URI
4259963 stream x-rincon-mp3radio://translate.google.com/translate_tts?tl=en&q=kitchen+lights+off

http://forums.sonos.com/showthread.php?t=5706&page=6 suggests - “x-rincon-stream:uuid” is where the uuid is the identifier of the ZP with the line-in you want to use… … something like “x-rincon:RINCON_000E5811467403420”.[/quote]

That is an awesome find! Cannot wait to see what gets done with this plugin now. Seems that the plugin could now pull the data to specify each zone player through UUID and specify what is played to what player. I only have 1 running my entire home so that wont benefit me too much, I may switch it up in the future.
I noticed in that radiolog link I also see the TTS link that I pushed through Vera, however it is cut off exactly at the “?” in the URL which makes me wonder if there is an alternate character we could send thru that wont mess up, such as the & to replae the &, however i cannot find one to replace the ? symbol. I believe once that hurdle is cleared it would be no prob to send dynamic data to Sonos and pull whatever we want to be said from the Google TTS engine.

Update!
Found this also:
http://192.168.0.3:1400/support/review – provides a consolidated, browsable view of the diagnostics across all the devices. It includes the controllers if they are awake at the time.
http://192.168.0.3:1400/support/ – Seems to be some xml page not html friendly.
http://192.168.0.3:1400/reboot
http://192.168.0.3:1400/unlock.htm – Mystery Submit page
http://192.168.0.3:1400/region.htm

… The rabbit hole goes deepers.
Found a link to an old WIKI now replaced with spam, checked version history and found these noteable links;

That Wiki has a lot of strange info if you go to the history before the spam/hackers took it over.

This may be useful to Anker or any other dev on this plugin;

WATCH THIS VIDEO - This guy is doing EXACTLY what we are trying to accomplish, and pretty scary to see that Pandora has 0 security and with any email you can pull the StationID’s which (if/when supported we can specify in the Sonos)
http://www.screencast.com/t/to34GwN5d

Link to his website with probably everything we’ll need. Props to him for this genius piece of software attached.
http://www.sonoscontrol.com/

My digging continues, found this at https://groups.google.com/forum/m/?fromgroups#!msg/sonospy-devel/8Y1-q_3Aqws/i2HbVLFO8-gJ. (alas I’m still unable to test :frowning: )

http-get::audio/mp3:
x-file-cifs::audio/mp3:
http-get::audio/mp4:
x-file-cifs::audio/mp4:
http-get::audio/mpeg:
x-file-cifs::audio/mpeg:
http-get::audio/mpegurl:
x-file-cifs::audio/mpegurl:
real.com-rhapsody-http-1-0::audio/mpegurl:
file::audio/mpegurl:
http-get::audio/mpeg3:
x-file-cifs::audio/mpeg3:
http-get::audio/wav:
x-file-cifs::audio/wav:
http-get::audio/wma:
x-file-cifs::audio/wma:
http-get::audio/x-ms-wma:
x-file-cifs::audio/x-ms-wma:
http-get::audio/aiff:
x-file-cifs::audio/aiff:
http-get::audio/flac:
x-file-cifs::audio/flac:
http-get::application/ogg:
x-file-cifs::application/ogg:
http-get::audio/audible:
x-file-cifs::audio/audible:
real.com-rhapsody-http-1-0::audio/x-ms-wma:
real.com-rhapsody-direct::audio/mp3:
sonos.com-mms::audio/x-ms-wma:
sonos.com-http::audio/mpeg3:
sonos.com-http::audio/mpeg:
sonos.com-http::audio/wma:
sonos.com-http::audio/mp4:
sonos.com-spotify::audio/x-spotify:
sonos.com-rtrecent::audio/x-sonos-recent:
real.com-rhapsody-http-1-0::audio/x-rhap-radio:
real.com-rhapsody-direct::audio/x-rhap-radio:
pandora.com-pndrradio::audio/x-pandora-radio:
pandora.com-pndrradio-http::audio/mpeg3:
sirius.com-sirradio::audio/x-sirius-radio:
x-rincon:::*
x-rincon-mp3radio:::*
x-rincon-playlist:::*
x-rincon-queue:::*
x-rincon-stream:::*
x-sonosapi-stream:::*
x-sonosapi-radio::audio/x-sonosapi-radio:
x-rincon-cpcontainer:::*
last.fm-radio::audio/x-lastfm-radio:
last.fm-radio-http::audio/mpeg3:

@big517 - I’m curious if http-get::audio/mp3: will work with tts URL

My goodness, this really does seem to be going somewhere. Starting to get excited…

Nope… but I bet you figure it out when you get your plugin working. I’m just taking stabs in the dark with different syntax.

@big517 - I admire your optimism in me, (especially when I have no programming skills, only a strong desire to help make this work :wink: ) I’ve used the Intel upnp device spy and can see the stream value (GetInfo) used by the Sonos to play my tts URL and it looks to be what you have tried too.

There are some references on the web to Google not accepting requests that have been refered from another site (different header) and a ‘good’ friend suggested that it might need a browser reference in the request to. However seeing that it works as a stored station now and we are trying to send the same value then, i’m intrigued why it is not working.

As for my own testing, sadly i’m still unable to do any, truck 14 & 15 work fine, yet the latest one, trunk 18 still only returns urn:MiCasaVerde-com:serviceId:HaDevice1 in the functions dropdown list. VERY, VERY STRANGE :frowning:

@parkerc.

Download all the files in the #18 trunk and simply upload them in Vera and refresh a couple times.

I don’t see why it wouldnt work. I did not create a new device when I did this I simply uploaded all 4 of the files and restarted it with no probs.

Go into your SONOS plugin this way and see what is listed afterward.

http://192.168.x.x:3480/data_request?id=lu_invoke

I’m hoping we can figure this out today :slight_smile:

Since Anker uploaded the new version, I’ve done the upload multiple times now, (if i leave a D_sonos1.xml from 14 or 15 i lose the sonos1 service id listing, if i upload everything i only get the hadevice1 - so it is still no joy with Trunk 18. Trunk 14 & 15 are still fine for me.

There should be no need to create a new device, besides I’ve had the earlier version of the plug in working for a while, and moving between T14 & T15 is no problem, just for some reason trunk 18 does not want to come up correctly.

[quote=“big517, post:209, topic:169644”]Go into your SONOS plugin this way and see what is listed afterward.
http://192.168.x.x:3480/data_request?id=lu_invoke[/quote]

Sadly i get the same listing, that I have reported before. :frowning:

I’ll private message you, maybe you can send me your copies of trunk 18 if you’re using UI5 too.

I'll private message you, maybe you can send me your copies of trunk 18 if you're using UI5 too.

Sent! hopefull this will work for you :slight_smile:

Thanks Big517 - Success !! All installed and working now.

I was indeed downloading the files individually rather than collectively in a zip, so by doing that, trunk 18 has installed correctly and I’ve been able to have a play !!!

First of all - not being a programmer i always try to do things through the UI. So by simply creating a new scene, going to the Advanced tab, selecting/adding my Living Room Sonos, i can then select the new SetURIToPlay option, and have been able add any number of file type/prefix combinations and all seem to work - even the Google TTS one… e.g. using x-rincon-mp3radio://translate.google.com/translate_tts?tl=en&q=kitchen+lights+on

In regards to your situation , by the sounds of things you’re just trying to use the invoke URL, and while I know you have an issue with the ‘&’ stopping it - after doing some digging and testing I found out that you need to change the “&” for “%26” to make it work ("%26" is the ASCII Hex code for &) - So this means your original one.

http://192.168.1.xxx:3480/data_request?id=action&DeviceNum=163&serviceId=urn:micasaverde-com:serviceId:Sonos1&action=SetURIToPlay&URIToPlay=x-rincon-mp3radio://translate.google.com/translate_tts?tl=en&q=the+test+is+on+to+verify+playback

Becomes.

http://192.168.1.xxx:3480/data_request?id=action&DeviceNum=163&serviceId=urn:micasaverde-com:serviceId:Sonos1&action=SetURIToPlay&URIToPlay=x-rincon-mp3radio://translate.google.com/translate_tts?tl=en%26q=the+test+is+on+to+verify+playback

This worked for me, so it should (hopefully) work for you…

Remember this just sets up the required URI - you still need to send a follow up ‘Play’ command to make it play/run/stream.

Let me know if that helps

One additional observation is that the TTS streams seems to go on a loop, which means either another track request should be sent, or maybe even the stop command at some point afterwards - however the timing for that, is not easy as the Google translate service response times vary

I KNEW YOU WOULD FIGURE IT OUT!

Great work man! Glad I was able to help you out with the trunk files. Now the next challenge;

How do you specify a Pandora station (See a few posts back where I attached a file to pull the stations)
How do you choose a radio station from favorites?

Great work.

@big517 & parkerc,

Glad that you figured it out and that the TTS is working! I have to dig into this myself!

About the looping it might have to do with the “Playstate” of the sonos zone itself. I cannot remember the various possibilities as I am away from home at the moment, but you can specify repeat, shuffle, etc on the sonos and this might be the reason fo rthe looping…

To figure out what Pandora etc is a great tool is upnp device spy where you can have a look into the sonos via upnp.

/anker

@Anker and all

To help the Sonos Plugin evolve, I’ve been trying to build a specific .JSON file for it, with the ultimate goal is to have a Sonos Icon, with a window for album art and for it to also show the current status and also what’s playing ( most of this info is already visible on the Advanced Tab, under Variables)

The current Sonos plugin (i think) uses the generic_device.JSON as a specific Avmisc1 or Sonos1 .JSON is not mentioned for the device within the D_Sonos1.xml (D_xxxxxxxxxxxxxxx.json)

I should stress I have no programming experience, but the wiki guide for this is close to being legible to me;) - http://wiki.micasaverde.com/index.php/Luup_plugins:_Static_JSON_file.

My first task has just been to create a dedicated JSON, with a Sonos Icon (I’m testing against http://minidigita.com/wp-content/uploads/2012/05/Sonos-Icon.png), but cna be done local too, so I have uploaded my first attempts (a revised D_sonos1.xml and a new D_sonos1.json), I think I’m close, sizing/positioning issues, but just not 100% yet :frowning:

Anyone with greater affinity with coding who can help would be appreciated?

I’m interested to see how that progresses @parkerc.

I’m still trying to get the functionality to play a radio station, or a pandora station. Here is the info from my pandora station that would work on the video from one of my last couple posts

Pandora Radio
PSEL|Frank Sinatra Radio|184844212746047319|joe****|

How would we get that play?

has anyone found out how to play a radio station? Or specify a station in our favorites?
Using UPNP Spy i believe this is a station, but i’m having no luck getting it to play
aac://wkqi-fm.akacast.akamaistream.net/7/92/19925/v1/auth.akacast.akamaistream.net/wkqi-fm
Update: I was able to get this station to play, I just didnt recognize that it would not show the typical “art” and name of station. I simply had to press play, and even though it reads “wkqi-fm” it’s actually playing the station… Now I will use the UPNP Spy to find all my favorites “links”, and create a scene to SetURI, then Play for each station :slight_smile:

In experimenting w/ Pandora, I copied the URI from the UPNP Spy and received a very large string of characters, when pasted into the scene it will play the entire song, but cannot skip to the next song, interestingly enough, I can click back and repeat the same song which is not a function of Pandora players typically (hack!?) ;D
Still need help w/ the Pandora Stations to play and continue with standard functions…

Here are more interesting links;


http://board.homeseer.com/showthread.php?p=700323#post700323

@Anker

Looking at the changes made to the lua file in trunk 18, what does the following do?
And why is there a need for a fixed local IP to be stated ? I only ask as the IP actually matches with one on my Sonos player, so curious if that was a risk?

            -- event url, user-agent, callback, nt, TimeOut 
34	function UPnP_subscribe(ipAddress, ipPort) 
35	 
36	  -- 
37	  -- Execute the subscription 
38	  -- 
39	  local status, statusMsg = http.request{ 
40	    method = "SUBSCRIBE /MediaRenderer/RenderingControl/Event HTTP/1.1", 
41	    headers = {["HOST"] = ipAddress .. ":" .. ipPort, 
42	               ["CALLBACK"] = "<http://192.168.1.15/cmh/event>", 
43	               ["NT"] = "upnp:event",}, 
44	    } 
45	  return status 
46	end

@parkerc,
That’s the review comment I made above to @anker. It shouldn’t be hardcoded, but it is benign and appears to be part of a notification experiment.

Best Home Automation shopping experience. Shop at getvera!

© 2021 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules