Getting Sonos working again

Unfortunately, this app no longer works without tweaking - and even then it doesn’t work like it used to. And apparently the app developer is no longer supporting it. So I’d like to use this thread to gather the steps necessary to get the app working properly again. Please add any suggestions you might have to help others get their Sonos devices working in UI7

I’ll start…

When I downloaded the app into UI7 for the first time (firmware 1.7.3500), the app did nothing. No discovery - nada. So, after doing research here and figuring a few things out on my own, here are the steps I came up with to at least get the buttons to respond. Starting from the beginning:

  1. Install the UPnP app
  2. Install the Sonos app
  3. Down the attached zip files and unzip the two files within. Then, upload these two files to your Vera via the Upload box in the Apps>Develop Apps>Luup files tab. The discussion about why this is necessary is found here ->http://forum.micasaverde.com/index.php/topic,51432.0.html. Big thanks to amg0 for sharing his edited files!
  4. Using your phone or PC Sonos app (or going into your router) find the Sonos’ IP address.
  5. Open the UI7 Sonos device and go to the Advanced menu. Enter the Sonos IP under the Advanced> Params> IP field.
  6. I also entered the router IP in the Advanced>Variables>RouterIP field, but I’m not certain that was necessary.
  7. Reboot Vera using the Settings>Net&WiFi - Reboot button
  8. When Vera restarts, the Sonos device should be present and should work; at least for music playback. There are still many aspects of the device that don’t work correctly, such as album art, currently playing, etc. But the buttons work…

One note - The mute button works, but there is no means to “un-mute”. At least none that I could find.

As for TTL and the voice functions, I’ve not found a way to get that to work. If anyone has, please post the steps here.

Melsman

Had the same issue with TTS and contacted Vera, reply below

Hi
Thank you for contacting Vera Customer Care
We would like to let you know that we are aware of this issue and it is because a security concern that was added to latest version of the firmware, we already report this to our development team and they are working on it but we do not have an ETA for it.
We are awaiting that the plug-ins writers change some files on the API that work with the plug in on the port which it was blocked.
We suggest you to post this on our forum in order to see if there is a work around for it, but we are recommending to downgrade to 7.21 version of the firmware until we get the full fix for it.
Thank you for understanding
Regards
Regards,

Regarding the TTS I have a (partly) working solution. I found someone that have implemented a TTS service using ResponsiveVoice (https://responsivevoice.com)

I had it working pushing the voice to all my Sonos speakers at some point…but now I only get it to work with my main Sonos device (that was added by default when adding the Sonos app). I’m still investigating what went wrong but haven’t found the solution yet.
I’m also having issues with the group settings and the player status…but I can start/stop the music with the buttons.

So upload the files via the “Develop Apps/Luup files” and then go to your Sonos device and select TTS. I’ve set the default engine in the js-file to ResponsiveVoice and the language to Swedish. But you could of course switch to another language that better suits your needs. Enter some text in the box and hit “Say”…and you will hopefully hear the phrase in your Sonos speaker.

Hope it works for you!

melsman : your posting on the two files that needed to be uploaded and the instructions were the ticket. Not everything works (but basic functions do) and if Vera is working on native integration, this will do it for now. Awesome. Thanks.

My version attached. Incorporates some updates from amg0 and reneboer.

Buttons work, discovery works, album art/status info updates and responsive voice TTS works. (At least for me, your mileage may vary)

After updating the files and restarting luup, make sure to refresh your browser (may need to clear cache) so the Javascript gets reloaded.

Great news Spanners.
I am not home to install your version yet but when I get back to Delaware I am looking forward to having Sonos work again completely. Does your version bring back the regrouping buttons?
Will report back.

Thanks!

Grouping buttons work ok for me.

Good luck. :slight_smile:

I gave it a shot - the Sonos is back to working, but TTS isn’t. If I have music playing on the Sonos, it will stop playing and go quiet for an amount of time that would equal what the TTS should say, and then resume playing music.

I can’t see anything obvious in the logs, so I’m not sure why the generated mp3 file isn’t playing on the Sonos. Any ideas?

Nice.
First syllable/word disappears due to some fade in though. You also have that?

I ended up uninstalling the original Sonos plugin after it stopped working. I since move to the new ALTSonos plugin via ALTUI. Its still in beta but for me it works great. It supports TTS, Grouping, and via the UI you can see all the art for songs and control music via controls. If you have not moved to ALTUI, this might be a great time to move. Its really great.

Thank you. the files sonos 1.4.2 is working for me!!!

[quote=“Spanners, post:5, topic:198403”]My version attached. Incorporates some updates from amg0 and reneboer.

Buttons work, discovery works, album art/status info updates and responsive voice TTS works. (At least for me, your mileage may vary)

After updating the files and restarting luup, make sure to refresh your browser (may need to clear cache) so the Javascript gets reloaded.[/quote]

I have used the variable “TransportState” in my LUA code and even “SonosOnline”. SonosOnline works but TransportState didn?t change status when pushing PLAY, PAUSE and STOP, but if I reload the LUA code the status has changed in the variable.

Is there any possibilities to take a look at that.

Hi All,

If you can give me some detailed steps* on how to reproduce the issues you are still seeing, I’m happy to see if I can duplicate them and maybe resolve them.

At least if they can’t be duplicated you know the problem may be somewhere else - I can’t make guarantees about fixing anything as I didn’t write the original code and for TTS I’m using the sonos-http-api docker container rather than the Vera plugin, so I can use Amazon Polly for the voice.

*really really detailed step by step with code snippets/scene examples if part of the scenario

Hi,

I will try to explain.

I use some Variables in the Sonos app, see Attachment Variables.

The parameter SonosOnline change between 1 and 0 (1 when it is online and that one works alwright and will be updated automatic)

I also use the parameter TransportState and use it to check the state “STOPPED”, “PAUSED_PLAYBACK” and “PLAYED” see attachment. TransportState dosen?t update automatic but by a coincidence I saw it had changed after I reload the LUA code so there must be something with updating the Varables.

I also use this LUA code luup.call_action(“urn:micasaverde-com:serviceId:Sonos1”, “PlayURI”,
{URIToPlay=“TR:17553”, Volume=30},
sonos_kok_device)
and start playing a radiostation depending who comes home first and that dosen?t work either anymore.

Ok, I tried to reproduce your issue with the variable update - it works fine for me.

Change state of sonos (eg from iPhone App) and the TransportState variable updates. There is one important difference in my setup that might explain it.

ProxyUsed: proxy is not in use

I don’t have the discovery patch installed and the UPnP Event Proxy is not installed.

OK

I tried to uninstall the UpNP server and made the changes you recommend but no changes for me.

Now it works.

After I Uninstall the Sonos app and delete all “Sonos” files in my Vera via FTP and then Install the Sonos app again and load up sonos 1.4.2 it?s okey.

I have not installed the UpNp plugin.

This LUA don?t work yet

luup.call_action(“urn:micasaverde-com:serviceId:Sonos1”, “PlayURI”,
{URIToPlay=“TR:17553”, Volume=30},
sonos_kok_device)

Where TR:17553 is a Tunein station but if I change the Radio station to a Playlist in Sonos it works.

luup.call_action(“urn:micasaverde-com:serviceId:Sonos1”, “PlayURI”,
{URIToPlay=“SQ:Party 1”, Volume=30},
sonos_kok_device)

I don’t think your station ID is valid.

I tried: luup.call_action(“urn:micasaverde-com:serviceId:Sonos1”, “PlayURI”, {URIToPlay=“TR:44935”, Volume=30}, 30)

And it worked fine (ABC Jazz Radio).

When I put your station ID into the Sonos HTTP API I get this response:

{"status":"error","error":"Got status 500 when invoking /MediaRenderer/AVTransport/Control","stack":"Error: Got status 500 when invoking /MediaRenderer/AVTransport/Control \n at Object.invoke (/node-sonos-http-api/node_modules/sonos-discovery/lib/helpers/soap.js:99:10) \n at Player.setAVTransport (/node-sonos-http-api/node_modules/sonos-discovery/lib/models/Player.js:725:15) \n at Object.tuneIn [as tunein] (/node-sonos-http-api/lib/actions/tunein.js:23:31) \n at handleAction (/node-sonos-http-api/lib/sonos-http-api.js:117:35) \n at HttpAPI.requestHandler (/node-sonos-http-api/lib/sonos-http-api.js:94:5) \n at /node-sonos-http-api/server.js:50:13 \n at Server.finish (/node-sonos-http-api/node_modules/node-static/lib/node-static.js:111:13) \n at finish (/node-sonos-http-api/node_modules/node-static/lib/node-static.js:170:14) \n at /node-sonos-http-api/node_modules/node-static/lib/node-static.js:144:17 \n at FSReqWrap.oncomplete (fs.js:158:21)"}

If I go to the Tunein Website with that ID I get a message saying “This Station is not currently available on Tunein”.

Hi
I have 7 sonos devices ip addresses discovered by the 1.4 version of the Sonos app using the discovery patch. I only created one device. (#298) with the Sonos “Connect” being the default When I select various zones to play in a group either for music or through TTS (responsive voice) issues occur. Usually stating… “Driven by another zone” on the Settingd Page.

I have created varios tts scenes interrupting music or live tv to say via lua code. Example code is
luup.call_action(“urn:micasaverde-com:serviceId:Sonos1”, “Say”,
{Text=“Door Open. Basement Door Open”, Language=“en”, GroupZones=“ALL”,
Volume=55, SameVolumeForAll=“true”},
298)
After successfully saying the text not all the groups return to my original configuration. I know it has been suggested to add each zone as a device number. Do I need 7 Sonos device numbers? Would I need to list all the device numbers seperatly in the code? Seems the “Group All” options are not working properly.

@lakewoodjazz have you installed the 1.4.2 version of the plugin (manual install, review thread for file) or just the version from the Vera App Store?

I don’t think you specifically need to have all Sonos speakers configured in Vera - I don’t think it does anything to improve the issue you’re seeing, there’s no communication between plugin instances. But it does let you write code to specifically set the state of each device.

You might also want to look at the SavePlaybackContext and RestorePlaybackContext functions and see if that helps with your group changes.

Also, if you have any Stereo Pairs then all bets are off. There’s been issues with those since day 1.

My Sonos vs is reading 1.4 but I did install your additional downloaded files from the September 4 post.
I do have a pair of Play Ones linked together as rear speakers with a playbar.
They work (so far) in conjunction with the playbar in all ways. I will research the SPC & RPC gunctions you kindly mentioned. Thanks for keeping this app working!

© 2019 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy