Update Required: New Sonos Integration

There is another very significant benefit to using jishi’s Sonos http api, and that is group management. jishi’s code provides for multiple “preset” groups and makes it easy to create, join and leave groups. Combining this with webCoRE automation, I can easily join my upstairs speakers to my downstairs speaker group, or even move music from one group to the other.

1 Like

To get mine to run at startup I added these lines to rc.local file in /etc

You ca modify the path to match where your server.js script is located.

node /home/pi/node-sonos-http-api/server.js < /dev/null &
exit 0

For some reason I tried a custom automation in the new app but can’t seem to find a way to control the volume. The tts notifications are extremely loud even if my speaker volume is set very low. It seems hard coded.

The jishi api works great.

Appreciate if someone can guide me on what app can i now use to announce activities around the home on our Sonos speakers ?

BigTalker no longer works.

thanks

New app automation creator. @joshua_lyon can SharpTools rule creator do audio announcement with the new Sonos websocket DTH?

Yes, SharpTools can do audio announcements. TTS is a bit more tricky due to the changes made to the websocket DTH.

SharpTools has access to all of the methods that the new Sonos Websocket DTH exposes including playTrack() and related commands. The playText() method which performed text-to-speech with the previous Sonos DTH is no longer available in the Sonos Websocket DTH.

So there’s not a built-in TTS method directly on the driver anymore, but you can play any file that’s hosted on the web.

So one approach is to use a service like fromtexttospeech.com and then use the resulting file in the playTrack() method.

Create the TTS File

  1. Navigate to fromtexttospeech.com
  2. Enter in your desired phrase and tap Create Audio File
  3. (For testing purposes) Right-click the link of the resulting file and choose ‘Copy link address’

Note: I have no idea how long they keep the files hosted for you, so you’re probably better off downloading the file and storing it on Dropbox, Google Drive, etc. and then using a link directly to your stored copy of the file.

Create the Rule
(Assuming you already have your Sonos authorized in SharpTools)

  1. Open the SharpTools.io Rule Engine
  2. Tap Create Rule
  3. Under Flow, add a new ActionDevice
  4. Choose your Sonos device and select the playTrack() command
  5. Enter the URL to your TTS file in the first string argument
    Optionally: enter a target volume level for the number argument
    (or switch the ‘Advanced’ toggle on in the top-right corner and delete the number argument)

Note: In most cases, you’ll want to have some sort of Trigger defined in the rule otherwise the rule will never run.

4 Likes

ugh, what a pain.

Well, it’s past Oct 17th and my Sonos devices have not automatically been updated as ST said they would. Not that I’m complaining.

1 Like

thank God I was using 3rd party device handlers for Sonos speakers (media renderer) and my TTS automation did not break.
but this is really very bad planned update by Samsung.
anyway, is there any good in this update ? (I mean apart from local execution)

What is your 3rd party device handler? I am hosed, can’t use my Sonos with BigTalker since the update.

I am using media renderer.
check here:


they both say “cheap sonos alt.” but the device handler also work with Sonos.

Actually one of the minions has actively said it won’t be worked on my them. Although playing has started working so someone has done something but volume isn’t working yet.

anyone know why the volume is SO LOUD?

You talking about voice notifications in the new app?

I had same issue. Even with my volume on Sonos all the way down the alerts would be like max volume. Contacted support who said it’s a Sonos issue. Smh.

Hi all: A question re: the original subject of this thread. There now appears to be 3 separate DTHs for Sonos. Which one am I supposed to use? And are any of them actually going to go away as was originally implied in the thread?

I added my SONOS to ST via the New ST app at the end of November '19 and it used the “LAN Sonos Player”. I had not realized there were others until I found this thread looking to see if I can control the Sonos Station/Favorite directly from webCoRE…alas so far it seems no, and I am stuck with managing an unwieldy IFTTT setup. Awkward and clunky but it works.

The other 2 are:

  1. LAN Sonos Player websocket - which is supposed to be the new one but has very little “capability”
  2. Sonos Player - which seems have to have the same as LAN Sonos Player but I did not compare every line item.

Also all three of them show Execution Location = Cloud. Someone had showed the LAN Sonos Player Websocket as being Local but it did not change for me when I installed the DTH…but I did lose some functionality I had set up in IFTTT so I went back to the one installed by default with the new ST App.

BTW I have a Sonos Play 3 that is a couple or 3 years old. It is still considered a “new” device according to Sonos’ recent announcements about not supporting some of their older speakers.

BTW 2 - I did have an Announcement working with appropriate volume control using LAN Sonos Player but I turned it off as I figured it would be too spooky and annoying with our guests coming and going all the time. I know who comes in based on the code entered on the lock. We run a small B&B.

Thanks all.

You should use LAN Sonos Player websocket. That is the latest DH and it runs locally. Indeed, if you have added your device really in November 2019, then that should have been assigned directly.

What do you mean “very little capacity”? If you mean that you cannot control it through WebCoRe, than you need to reach out to the WebCoRe Minions. As far as I know they haven’t implemented the new capabilities what has came with the new DH. For sure, @joshua_lyon has implemented integration in the Sharptools.io rule engine for the new capabilities of the new DH. You can control you Sonos Favourite presets etc.
The new DH has full control over the Sonos, volume/mute, play/stop/pause, next/previous song and preset selection, and media details too. It is far more better than the Sonos app, what allows you to control the device only on the same network. The DH allows you full control from anywhere. But all works in the new OneApp, the one with the “Snowflake” icon.

2 Likes

Wow! That hadn’t occurred to me!

Is there a way to group speakers for playback like you can in the Sonos app?

I have only one Sonos, so I cannot tell exactly. But the DH has group attributes too. So you can use groups I think. Actually the last announcement in the new app talks about group announcements on multiple speakers. And I think I saw something on the Google Play description about the last update, which mentions grouping speakers.

I mean full control, as starting music from within the SmartThings app, not being on the same network as the Sonos. The Sonos app is limited to LAN control as far as I know. You can start the last played tracks/album or start any of your My Sonos Favourite presets, basically anything what has been added there in the Sonos app. Like Spotify albums, tracks, playlist, or TuneIn radio stations. And that is what the Sharptools.io can utilize too. Check their video in the other post.

2 Likes

So still being new to this I could be not understanding what I see. So here is the screen shots from the 3 different DTHs. And yes I did install the Sonos in my ST hub (Nvidia Shield) at the end of November. I had never used the hub before and had just bought a few wi-fi lights to try it out. And ST picked LAN Sonos Player as the DTH. I had never looked at the details in IDE until I read this thread and switched to the Websockets version.

I have virtual switches defined in ST connected via IFTTT to tun on a Favorite in Sonos. Then I wrote a simple piston to make sure that only the last pressed Station switch was “on”. It just turns the others off. I display and control this also in ActionTiles.

As I mentioned I would prefer to set the Station/Favorite directly from webCoRE which is how I found this thread. So I don’t know if that is a missing webCoRE capability or if the Device Handlers cannot provide that capability.

When I switched to the Websockets DTH, my switches via ActionTiles immediately stopped working. I changed the DTH back to the original LAN Sonos Player and all was good again. I never considered if I should have deleted the Sonos and re-added it and then updated all my IFTTT/webCoRE/Action tiles after changing the DTH.

And that is when I noticed that the Current State data for the Websocket version was significantly less than the others. Whih lead to my assumption of “less capable” for the new DTH.

Either way I want to make sure that I use the correct DTH and wonder why the other 2 are still available and what are the difference between them all. Some “release Notes” would be helpful if there is something like that I can read.

Thanks for the help in understanding all this.

LAN Sonos Player:
Shows Execution Location = Cloud

LAN Sonos Player Websocket:
Shows Execution Location = Cloud
Does not show any TrackData so my assumption is that the data is not available then via ST/webCoRE

Sonos Player
Shows Execution Location = Cloud
Current States Data is similar to LAn Sonos Player.

I would try deleting the device and then let SmartThings rediscover it.

The new device handler has local execution capability and has a few more features and functionality than the old DTH. (One exception being that the playText()/speak() commands were dropped so you would need an alternative approach for TTS)

As @GSzabados mentioned, SharpTools.io has full support for the new DTH, including Album art and activating the presets (via rules). We’ve seen some pretty cool usage of the new DTH for doing things like creating jukebox dashboards:

SharpTools.io Jukebox Dashboard with Album Art

SharpTools.io Jukebox Dashboard

2 Likes