:pensive:, I guess I’ll resume working on my driver then. It supports TTS somewhat at least but doesn’t instantly report updates made from the app (and it makes use of my RPi that was feeling a bit neglected these days). I’ll probably use a combination of both drivers till you guys add all the functionality needed to make it a complete driver. Still looking forward to this release though.

1 Like

So if I wanted to play a single mp3 on a webserver, can I use the following command?

speaker.playTrack(uri, duration, volume)

I want to use this for announcements in the home and already have the mp3s hosted on a lan Web server, just waiting for this integration.


I’ve just fallen at the first hurdle.
Put in command npm install --production on my RPi and got a load of error messages.

pi@raspberrypi:~ $ npm install --production
npm ERR! install Couldn’t read dependencies
npm ERR! package.json ENOENT, open ‘/home/pi/package.json’
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can’t find a package.json file in your current directory.

npm ERR! System Linux 4.9.35-v7+
npm ERR! command “/usr/bin/nodejs” “/usr/bin/npm” “install” “–production”
npm ERR! cwd /home/pi
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! path /home/pi/package.json
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/pi/npm-debug.log
npm ERR! not ok code 0

Tried to find file package.json and it doesn’t exist.

The play track method only accepts one parameter uri, but yes this shoud work.
The easiest way to figure out the uri is to copy it from the trackUri item in the state variable after playing something from the sonos app…
After seeing the uri prefix that sonos uses, it’s straightforward to then build custom uris

Thanks Mike
I did think that the standard http://server/file.mp3 would work as the uri so I’m grateful for the info.
Would this be the preferred method or is there an alternative?


I would attempt to help but my linux skills are next to none and I would probably cause you more problems.

Do you have node installed? I know it’s required for this api to work. I already had this installed from previous setups on my Pi from a while back. Unfortunately I don’t remember the right way setup node.

That will not work without a sonos style prefix (already tried it with a few radio urls),
Radio prefix: x-rincon-mp3radio://
Another: aac://
You’ll see shortly

1 Like

Any luck @bobbles?

Sorry I didn’t respond.
Not yet. Googled how to install node.js and have done that.
Watching football so gave up. (Or is that soccer. Depends where your from. :smile:)
Will perhaps have another look tomorrow.

Sonos is now available in latest update .709



Downloading now

1 Like

Mike did you change something with the sonos implimentation?
Http call to mp3 DOES work

Found by accident as an already configured app triggered.


1 Like

no, turns out it works just fine for mp3’s

1 Like

Sure Does…
I’ll post a little app for it in about 10 mins :slight_smile:


1 Like

App posted here…



@mike.maxwell, in ST I used the below code to pull a list of recently played uri’s that could then be saved as playlist presets. It doesn’t seem to work with the new sonos device drivers. Is this possible with your integration? Specifically line 3 below. I’ve changed “trackData” to “enqueuedUri” but it doesn’t return anything. Oh…and “sonos” is the musicplayer device input variable.

def stationSelections(){	//retrieves recently played stations from sonos speaker and presents as options when choosing station in VPLs
    def newOptions = state.savedPList.findAll()//{it.selected==true}	//ensures previously selected stations are included in the new list
    def states = sonos.statesSince("trackData", new Date(0), [max:30]) //??gets all previously played tracks from sonos speaker
    states?.each{	//for each track in the fresh list
    	def stationData = it.jsonValue
        if(!newOptions.find{fav->fav.station==stationData.station}){ //checks whether previously selected tracks(newOptions) exist in the new list and prevents adding second entry
   			newOptions << [uri:stationData.uri,metaData:stationData.metaData,station:stationData.station]
    def options = newOptions.collect{it.station?:"N/A"}.sort()
    state.savedPList = newOptions
	return options

the trackData json isn’t currently being sent to the event stream, which is why this won’t work currently.

Gotcha. Please let me know if that changes so I can bring this app over.

what do we need to get SONOS to talk to the hub?

Not sure what you’re asking but the simple answer is … install the Sonos App.

1 Like