SONOS not working as before

Thank you Brad for all of your help with this :slight_smile:

1 Like

Certainly, you’re welcome!

Unless someone gets to it first, I’ll try to take a closer look this weekend when I have more availability.

1 Like

Thank you again :slight_smile: Please let me know if I can provide any additional information

1 Like

Would some kind soul recommend how I can get this older device handler working to get audio notifications under the new Sonos device type? I’ve been playing around with trying to make some changes but I’m not having any luck. I suspect it’s a fairly straightforward change but I’m no coder and striking out.

Very much appreciated in advance!

Hi all,

With the previous Sonos device handler, I could play files from a local samba server using the x-file-cifs protocol in the URI, but that no longer seems supported in the new LAN Websocket device handler. Thus far in my trial & error testing I can only call playTrack() with an HTTP or HTTPS URI.

Has anyone figured out how to pass this new device handler a local samba/cifs URI?

Thanks for help in advance…

Here you go, added the requirement for the new Sonos DH. You need to define the volume as that is better to be set when doing audio notification, otherwise I don’t know what volume would the device use.

@MultiMike, I think the playTrack is not really what you need. That is part of the audioNotification, and the Sonos seems to reduce the volume and plays the music behind when does the notification. I never managed to get the music stop. So if you are trying to stream music from your local network, then you might get a better result with the Media Presets.

https://docs.smartthings.com/en/latest/capabilities-reference.html#media-presets

It would use the Sonos’s “favorite” list (Media Presets). The Sonos itself should be capable to play from the local network. Use the Sonos mobile app to play your music, then try to add it as a preset, then you can select the preset for playing by SmartThings.

I know it is an awkward solution, but might work for you.

@Brad_ST, I’ve had a quick look on the code. The weather report will definitely not work with the following function,

def current = getWeatherFeature("conditions", zipCode)

That part of the code should have been replaced when the TWC API has been implemented.

There is another thing, what I couldn’t find out how would work,

playSoundAndTrack

Is this function still supported by any of the current capabilities of the new Sonos LAN Websocket DH? If not, then that might can cause some issues as it shows up at 12 different places. Anyhow it wasn’t a well documented feature of the musicPlayer neither.

Could we get somehow an updated documentation of the new capabilities what is used by the DH? The old developer portal has proposed capabilities only, and the new portal is lacking a lot of capabilities which are already in use, and still has ones with proposed states.

Maybe the announced Developer Portal Planned Maintenance will bring an update of the documentation? - I have emailed support and asked them to update it about a month ago, but the state is still the same.

Are you able to use Sonos, with Webcore, and Bigtalker2?

As I wrote before. I have updated BigTalker2 to a version BigTalker2-SonosMod and posted the link in multiple topics. And yes, it is working with the modified SmartApp.
I am not using WebCoRE, but someone mentioned that it take a few days until WebCoRE updated for the new capabilities. Following that comment I guess the guys at WebCoRE updated the code for the new Sonos. For sure, sharptools.io is working with the new Sonos DH.

2 Likes

Thanks for this invaluable piece of code for audioTrackData. I’m not a SONOS user, but want to update a different type player. Do you also have any visibility into something similar for the presets attribute or something that might be used for the favorites list?

This has been an enlightening thread. Thanks again!

The presets attribute is a JSON Array of Objects with the format {id, name, mediaSource}:

[
  {
    "id": "1",
    "name": "106.1 | 106.1 KISS FM (Top 40 & Pop Music)",
    "mediaSource": "TuneIn"
  },
  {
    "id": "3",
    "name": "90s Rock Anthems",
    "mediaSource": "Spotify"
  },
  {
    "id": "4",
    "name": "Guns N' Roses Complete Collection",
    "mediaSource": "Spotify"
  },
  {
    "id": "2",
    "name": "Hot 97",
    "mediaSource": "TuneIn"
  },
  {
    "id": "5",
    "name": "Steve Ray Vaughn",
    "mediaSource": "Spotify"
  },
  {
    "id": "6",
    "name": "This Is Queen",
    "mediaSource": "Spotify"
  },
  {
    "id": "0",
    "name": "Today's Top Hits",
    "mediaSource": "Spotify"
  }
]

Thanks!! This is great info!

Has anyone managed to do Play Track & Resume with a Sonos speaker?

It plays the track just fine but never resumes on my system (doesn’t resume to music nor to TV, regardless of what it was. It just seems to be stuck in no man’s land).

1 Like

Do you also see it setting the volume to 0 after playing. This something I noticed with the Sonos Playbase.

No, my IKEA Symfonisk plays the Track, but it doesn’t stops the music meanwhile. It just plays the music with lower volume in the background. And after the end of the Track, it restores the Volume to the original.

1 Like

Did you ever figure out your issue with “Play Track & Resume” not resuming?

Hi all. My Sonos integration was upgrades automatically this week but I cannot work out how to replicate the simplest of automations that would make a big difference to me:
— Turn off other devices (eg doorbell chime) when Sonos device is turned on
— send out push notification when Sonos is turned on or off (ie play / stop)
— start iteratively reducing volume if it is >50% for more than 5 minutes.

Most of the above I was doing with webcore with the notifications done using an automation in smarttthings.

However it looks like smarttthings logs for the Sonos device (connect amp) only logs mute or unmute actions and creating new automations in the new app don’t seem to pickup these actions happening.

Hoping someone here can help me with what feels like quite a simple task.

I use this to turn on a tv light when the soundbase is used.

@GSzabados
Thanks for modifying the code for “Speaker Notify with Sound”
any chance to modify the code for " speaker weather forecast"

The issue in current code is no device found in “on this speaker player field” in app settings