[ST Edge] Sonos LAN based Control

The driver version you have is quite outdated… The one to try is

2022-09-25T16:13:27.788986624

Also, while I have tested the upgrade of drivers on my end, it will be cleanest to remove the device and re-discover the devices to eliminate a bunch of other variables.

1 Like

@schwark thanks, got the new driver overnight and reinstalled a speaker on it.

I think maybe still not 100% though but may be my understanding. I have pm’d you with my observations and supporting screen grabs. If I can help with some logging let me know :+1:

@TheHundredthIdiot Thanks for the screenshots… A number of observations - all related to poor documentation by me on the functionality. Also, I never actually tried to use my devices in a scene till you did - so I just went through the adding to a scene and figured out you don’t need the switches and dimmers for what you are trying to do as part of a scene. Those are now ONLY needed for Alexa… Let me explain in a little more detail - posting here as opposed to PM as this is relevant to all using this driver.

I originally added the switch to use turn on and off via Alexa - which does not allow you to pick a song to play when you use Alexa. But you can set dimmers and turn on and off via Alexa giving you purely Alexa control of the song and playing.

Alexa usage Pattern
Alexa, set speaker-name to 40%
Alexa, turn on speaker-name

So what exactly does the dimmer do?
Nothing when you set it - it simply registers what you set it to

Then why set it?
It is used when you turn the switch on to decide WHAT playlist to play. If you set it to ZERO - which is a special value, it simply plays whatever is in queue at that time for that player. If you set it to anything but zero, it is used as a percentage of the number of entries in the Settings / Favorites 1…n to decide which of those to play - so if you have all 5 settings set - setting to 0-20% will pick the 1st one, 21-40% will pick the second one and so on. if you only have 4 settings set, 0-25% will pick the 1st one, 26-50% will pick the second one etc. However, ALL this only happens if and when you turn on the switch. Otherwise, setting the dimmer does nothing on its own.

How to use the device in a scene?
In a SmartThings scene, it allows you to play a favorite already. So to play a favorite, you DO NOT need to turn on the switch (as that does all of the above) - you simply pick play favorite and choose the favorite. That’s it.

What was likely going on in your case?
In your screenshots, I saw you turn on and then play favorite, that will do the same operation twice, which may explain why things were getting locked up, as the Sonos may be confused by the barrage of conflicting commands coming its way

Also I think you were changing dimmers and expecting something to change on the screen - and nothing will as explained above

Also, on the list of favorites, that is a scrolling list (it does not look like one, but swiping up or down scrolls the list) - so when you have a LOT of Sonos Favorites, and/or Sonos playlists setup (the list is a combination of Sonos Favorites and Sonos Playlists) you will need to scroll to find all of the ones you have.

And on “laggy” update of the playing track, it is because I am still using polling (every 10s) to get the track information rather than events - I cannot get events to work on my Sonos (I use Sonos NET and that may have something to do with it). When I eventually get events working on my network, I will move the implementation to get closer to real-time updates.

The Radio playing did have a bug in it… It should be fixed now.

PS: Coming to think of it, if the SmartThings scenes for these new devices allow you to play from favorites or playlists directly, the switch and dimmer functionality may be moot altogether (I did that because this was not the case for the older DTH devices). This is because Alexa has its own Sonos integration independent of SmartThings that allow you to play stuff on your Sonos anyway. So I may end up removing the switch and dimmer functionality altogether

EDIT: this is now done. So no more switch or dimmer… Just use Play Favorite on the scene construction UI.

Hi @schwark ,

Thanks for your response. Your explanation definitely cleared up driver use amd I can see how using the dimmer as a convenient trigger for my routines confused the issue :grin:

I subsequently got the % based favourite selection to work well but then the driver updated to:

and I just can not get a favourite to play using the direct route at all (either in this or previous driver). As mentioned the dimmer % approach worked for me previously but currently it will just not work for me!

I am using routines on a new speaker install.

Definite improvement on a full favourites list now :+1: amd the driver.is now much more.intuitive to use :+1::+1:

One additional thing though - it is a real shame you have removed the on/off switching. It was very useful for sleep routine as could play with a delayed off on the same device rather than mixing and matching ST and your devices to play/stop.

Your ongoing efforts are really appreciated…

I would love some logs to see why your playlists are not playing - especially if the dimmer model worked… that is odd as they both use the same logic underneath… That in itself could be a clue of where the issue is… Also if they are publicly available radio stations, give me the url to one, and I will try to add the same on my end and see if that works.

I am curious about your switch use case, I can easily add it back _ I removed it as it seemed to be causing usability issues. What is the use case you want that you cannot do with the play stop functionality instead? Either way, the switch is back without all the dimmer complexity - it is simply play/stop control now.

Also, the latest version is

2022-09-27T18:09:44.494582178

Radio stations are through BBC Sounds and TuneIn but I cant get it to work with Sonos playlists either. Previous driver % was working with playlists only as at that time the radio stations did not appear in your favourites list…

Cant get you any logs this evening but I will check all remains the same after the driver updates to the more recent version and grab some for you.

Oh and… The currently playing info is not updating for me outside of playlists either. Not really a problem but just comparing to stock…

The use case is below except only your device was required. Play and stop can not be seen on a routine action together but ‘on and stop’ or ‘play and off’ could previously (I think). As it is the mix-n-match with stock and yours below works…

So the ‘then’ would be play with a delayed off… actually you know, I’m not 100% sure this did work previously I may have been using both devices but with on instead of play originally - it was late last night and the routines deleted with your driver update :thinking:

Although on/off definitely allowed control from smart lighting as well as routines which was another bonus…

@schwark I owe you an apology the inclusion of on/off does not allow a doubling up on one device. My bad - put it down to a lot of late night fiddling and resultant brain fog :slight_smile: It does though expose the device to smart lighting allowing on/off control there so that is a definate +ve as it allows reduction in routines freeing up the 200 limit for other things, thankyou for that :+1:

I have further PM’d you with logs for the favourite issue, thank you again for your efforts :beers:

Hi @schwark I was just going to discard the ST stock in favour of your driver and noticed that selecting the LAN driver to play a message from a routine on does not seem to work when compared to stock?

1 Like

@schwark First, thanks for all the great work to get this going!

Will it be on the roadmap to fix the ability to play a message from a routine? I use this feature a lot and would love to switch over to the your driver for the additional functionality.

As a side note, do you know if a similar type of driver could be developed for the Roku soundbars?

Can this driver toggle the night mode for Sonos speakers?

@Robert_Singh This one can’t but @rym002 has one here:

Installs against play bar/arc ect:

Hi @schwark - Another feature request should you be so inclined :blush:

Would it be possible to expose Sonos groups to ST to allow direct group control:

Would be a really useful feature :+1:

I’m wondering if something has changed recently. For several weeks now I’ve had this Routine working where I open the liquor cabinet and a Favorite plays (and a notification gets sent). Suddenly it doesn’t do that anymore - I only get the notification. I logged the activity in the CLI and see the following results:

2022-12-22T18:28:54.883859687+00:00 INFO Sonos LAN found media Heavenly Choir for Heavenly Choir
2022-12-22T18:28:54.886919187+00:00 INFO Sonos LAN adding to queue on RINCON_B8E937F8B6CE01400 uri x-sonos-http:ALkSOiHpYKDhqX_Abi7x3M0hl41_O9Gt9qnHILFUb4jdDYw2.mp4?sid=284&flags=0&sn=13
2022-12-22T18:28:54.891210687+00:00 DEBUG Sonos LAN executing on Kitchen + 1 command AddURIToQueue with params {DesiredFirstTrackNumberEnqueued=1, EnqueuedURI=“x-sonos-http:ALkSOiHpYKDhqX_Abi7x3M0hl41_O9Gt9qnHILFUb4jdDYw2.mp4?sid=284&flags=0&sn=13”, EnqueuedURIMetaData=“dc:titleHeavenly Choir</dc:title>upnp:classobject.item.audioItem.musicTrack.#TRACK</upnp:class>SA_RINCON72711_X_#Svc72711-0-Token”}
2022-12-22T18:28:55.005794229+00:00 ERROR Sonos LAN Kitchen + 1 : AddURIToQueue error code 800 Command not supported or not a coordinator
2022-12-22T18:28:55.009985395+00:00 ERROR Sonos LAN Kitchen + 1 thread encountered error: [string “st/dispatcher.lua”]:233: Error encountered while processing event for <Device: 4ae52f21-e41a-4731-94ed-050d48567ab2 (Liquor Chime)>:
arg1: table: 0x2a361e8
[string “sonos/soap.lua”]:669: assertion failed!

Not sure why this “command not supported” error suddenly started popping up. Any help would be appreciated.
BD

have you tried recreating the Routine?

I have tried changing the favorite, but I haven’t tried recreating the routine. I can do that and post back.

BD

Same results with the new routine.

Great driver, just switched to this after the end of webcore. Feature request - can you add a volume up/down option, ie take current value and add or deduct a value, rather than simply being able to apply a fixed value? Thanks!

2 Likes

There is this GitHub - toddaustin07/edge_roku: SmartThings Edge Driver for Roku devices from @TAustin (disclaimer: I don’t have any Roku products - I have no idea if this covers your use case).

Hello @schwark , Thanks for the great work !
I just installed your driver and, on the iOS app, FR language, there are no “Settings” sub menu in the device menu. The favorite selection section is also greyed out.
My use case being playing a door bell sound, I’m stuck.

I also have the same problem. I can’t pick a favourite. It is greyed out. I can type a favourite in a routine or scene but it ignores it and simply plays whatever is already in the queue.