Sonos HTTP API - run commands to Sonos via http

This looks very interesting for getting Sonos to play nice in ST. I am running an Unraid server and I am wondering if you know of Node servers for this platform? I see Node-red in the unraid dockers http://nodered.org/ and I am wondering if this would work the same way?

I don’t, sorry. My experience with Node servers is limited to setting up a couple on Linux on my Raspberry Pi.

I am having a hard time getting this going. I did the npm install sonos and it seemed to do that and it put it into the node_modules directory. However in step 5 above, where am I supposed to run this command from? I am using windows so do I run it in the command screen? I have tried to do this but I am getting an error module.js:471 throw err. I think I am missing something.

I haven’t used a windows machine in AGES, so I’m just guessing here - but we’re you in the node-modules directory when you ran the node server.js command? If so, then all I can say is try Googling how to start a node server from Windows.

OK, I got this working. I am trying to test the Say command and I have created the settings.json file with my Voice RSS API as per the instructions from jishi’s site. It says to put this in the root directory. Which root directory? I put it in the sonos node directory but it just keeps saying that I have to have a registered API. Any ideas?

I figured it out. I had to restart the server.

To run a Http command do I have to type GET or something? I am really new to this. Sorry for the dumb question. Also how do you run a preset file?

Jishi has pretty good instructions on his website here http://jishi.github.io/node-sonos-http-api/

1 Like

Thanks, I have read all that but I don’t know how to use this in ST. Can you give me an example of how to use http in ST?

http://thingsthataresmart.wiki/index.php?title=URI_Switch

URI Switch is a great way to use ST virtual switches to call http requests. Check out the documentation in the above link.

I don’t know anything about SmartThings, but you can definitely control Sonos with HTTP commands, and you can group speakers too (I discovered this yesterday). In my case, I have a Sonos Connect taking sound from line-in. I set the Sonos Connect URI to x-rincon-stream:xxx, and the Play:1s I set to x-rincon:xxx. This groups the Play:1s with the Connect.

Connect:

x-rincon-stream:RINCON_01400

Play 1s:

x-rincon:RINCON_01400

I attach a screenshot of the HTTP command from my - ahem - competing home automation controller.

Yonomi released support, haven’t looked into integrating with ST yet: