Plugin: ALT Sonos

The Sonos plugin is getting problematic for me. the reliance on the UPNP event proxy and the verbosity in the logs creates problems and too frequent reload of luup to my state

I therefore started to write a ALTSONOS plugin. UI7 & ALTUI are supported. it also supports a set of UPNP action that are callable from scenes.

for those interested docs and plugin is available here. it is for now rudimentary but works

https://github.com/amg0/ALTSonos

I am welcoming early testers to help me progress here. it is still very early code and not all functionality is yet there ( like for instance I do not manage the events coming back from sonos yet, but that will come )

it is a radical different approach from the current sonos plugin so there are things to know before you decide to jump on it.
Warning: read installation instructions at https://github.com/amg0/ALTSonos and be ready to use google cloud

  • It makes uses of the new sonos developper API and sonos cloud : https://developer.sonos.com and therefore needs internet but the discovery of sonos players is therefore extremely reliable and does not rely on any tricky setup on vera ( like the upnp proxy )
  • it will requires that you create an account client ID and client secret on sonos developper web site in the integrations screen
  • it will also require a https , internet accessible function to act as a small proxy to the vera. this is only required for the OAuth authorization process ( only once ) because Sonos cannot call your vera directly. once authorized, the plugin will have a OAuth access token and refresh token and should not need the 3 leg OAuth ( with user consent ) any more unless you reset the plugin. The best way to create this proxy is to use a google cloud function, to do this small proxy. I give instructions and the cloud function code in the github repository

Interesting! I will give it a try in due course…

I have made progress and uninstalled the old Sonos plugin.
details : https://github.com/amg0/ALTSonos
the install is not so easy so instructions are important.

There is a bit of latency that you can notice but no more than a couple of seconds so not too much. I made a adaptative timer strategy so it should reduce the polling rate if there is no activity

the counterpart of the disagreement is:

  • no opening to be accessble from internet
  • no UPNP proxy device
  • no load in log files with verbose chat from the UPNP or old Sonos plugins

Nice. This reminds me to try it.

Personally, I never used the UPNP proxy, but it was certainly chatty in the logs.

I have today managed to install the plugin from Github.
I have been able to start some playback as a first test but I don’t get any feedback in the device GUI.

[quote=“amg0, post:3, topic:199987”][/quote]

I have not heard of Passenger - I will have to check it out.

(I am a music collector)

Looks interesting. Read the readme and for the instructions I see, not too bad. One think I am missing, when I look in the ALT apps store or the UI7 App store, I can not find the ALTSonos app. How do I install the plugin itself?

it is too tricky to install , I have not made it into the vera store. you install it from https://github.com/amg0/ALTSonos
the installation instructions on the readme page must be religiously followed :slight_smile: I am trying to make it easier but it is not too simple, if there are google clound expert out there I welcome some help

functionally it works well for me, you have to accept some latency in the UI due to the cloud nature of the sonos developper API and the very limited vera architecture, but it works.
I made ALTUI TTS action compatible with it so I can send text to speach notifications through the speakers

I guess I do not get it. I have read the readme a few times. I see you need google account, sonos account, that all makes sense. But the last section is confusing. Talks about the plugin settings, but never where to add the plugin to Vera.

Configuration of the ALT Sonos plugin in settings tab

Enter the Key and the secret in the settings field
Enter the Cloud Function trigger http url in the field : the 3 of them : SonosAuthorization, SonosEvent and VeraPull

How to I get this to show up in the Vera Plugin Settings tab? I see no instructions to add the plugin in for Vera, just all the cloud parts.

[quote=“kyle.dawson, post:9, topic:199987”]I guess I do not get it. I have read the readme a few times. I see you need google account, sonos account, that all makes sense. But the last section is confusing. Talks about the plugin settings, but never where to add the plugin to Vera.

Configuration of the ALT Sonos plugin in settings tab

Enter the Key and the secret in the settings field
Enter the Cloud Function trigger http url in the field : the 3 of them : SonosAuthorization, SonosEvent and VeraPull

How to I get this to show up in the Vera Plugin Settings tab? I see no instructions to add the plugin in for Vera, just all the cloud parts.[/quote]

ok I ll add. You basically download the files from github ( zip file ) , then open the zip extract all files. then in VERA UI7 go to Apps/Develop App chose “Lua files”, make sure the restart checkbox is checked. drag and drop all files you extracted from the zip in the dotted rectable area, let it upload and reload luuP;

the plugin settings are then in the usual place under the ALTSONOS plugin settings screen

Ok, that is the missing part. Sorry, never added a plugin this one but once. I thought that was a one off. I will try this weekend. Thanks.

Ok, I downloaded the files and via the UI7 UI, add all the files via the Develop apps screen. I reloaded the engine and nothing shows up in UI7 or ALTUI for plugins. I even restarted the entire unit, still nothing shows up.

ok I missed a step.
go to Apps/Develop Apps
Choose Create Device
in “Upnp Device Filename” type D_ALTSonos.xml
in “Upnp Implementation Filename” type I_ALTSonos.xml
click create device button
let vera reload luup ( or force a reload )

Thanks, now I am cooking with gas… Will setup the cloud accounts next. Thanks again.

I think I have everything up and running. I can play/pause each sonos but thats really it.

Any instructions on TTS or using is scenes?

Will this support a new device for each sonos player or it will always be under the single ALTSonos device?

Also, the sceen show attached, should I see ID and more info?

So far thinks looking good.

[quote=“kyle.dawson, post:15, topic:199987”]I think I have everything up and running. I can play/pause each sonos but thats really it.

Any instructions on TTS or using is scenes?

Will this support a new device for each sonos player or it will always be under the single ALTSonos device?

Also, the sceen show attached, should I see ID and more info?

So far thinks looking good.[/quote]
Yes , it probably something is not correct n the setup.
I have updated the gcloud procedure and install shell script for potential problems.
try it again please

if that is still not giving info ( album arts ) , then We need to check the whole chain.
Can you please use email and share screen shots of your Sonos , gcloud, and altsonos settings ?
I will send you my email in a private message.

v0.8 https://github.com/amg0/ALTSonos
UI modified to poke and display backend version of cloudfunction to hint the user to upgrade when needed

I update to the latest version 0.10

I restarted Luup and reboot vera after the update. The ALTSonos logo is green not red. When I got to the Groups tab, its blank. When I go the the players tab is has all three of my sonos. But when I use the ALTUI TTS feature it only works if I use the “ALL” feature. Before it would work if i put in the player ID.

I also cleared out the Sonos Access and Refresh Token and re-logged into Sonos cloud. Reloaded LUUP and rebooted vera, same result.

I have ALTSonos in debug, it seems to pull the cloud info, player name, favorite stations player id, etc. But the Group tab is blank and the TTS to specific speaker not working.

[quote=“kyle.dawson, post:18, topic:199987”]I update to the latest version 0.10

I restarted Luup and reboot vera after the update. The ALTSonos logo is green not red. When I got to the Groups tab, its blank. When I go the the players tab is has all three of my sonos. But when I use the ALTUI TTS feature it only works if I use the “ALL” feature. Before it would work if i put in the player ID.

I also cleared out the Sonos Access and Refresh Token and re-logged into Sonos cloud. Reloaded LUUP and rebooted vera, same result.

I have ALTSonos in debug, it seems to pull the cloud info, player name, favorite stations player id, etBut the Group tab is blank and the TTS to specific speaker not working.[/quote]

Try a luup reload or a upnp action discover

Tried luup reload and discover. Still no Group info by have player info.

Any changes to cloud code that I need to rebuild?