Sonos

Sonos is now available in latest update .709

3 Likes

Yipeeeeeeeeeeeeee!

Downloading now

1 Like

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

Found by accident as an already configured app triggered.

Andy

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:

Andy

1 Like

App posted here...

Andy

2 Likes

@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

that’s what i needed :slight_smile: only got the hub today so I assumed I just needed to select discover.

1 Like

It seems the play / pause displays the opposite to the Sonos app. Pause shows when the player is paused and play when it is playing.

Sonos handle this the opposite as an ‘action’. The pause button displays whilst playing and you press it to pause.

This is an interesting difference between current status display and a control panel for use… (dashboard)

That’s the difference between having discreet commands like the driver, and having a toggle using one ui element, as in the app.

Yeah, Sonos is odd. I found a bug today with some music sources like iheartradio don’t have a pause action and in order to pause, you need to actually send stop. This is inconsistent as well.

Not sure what to do with the “playing” state and then the need to pause some sources and stop others. If while playing it shows and sends the “pause” it won’t do it on that source, but others it works fine. I hate to have play, pause and stop all on the screen at the same time, but this might be needed.

So when I load the Songs app, I receive the screen that says discovering Songs (wait up to 5 minutes)… 20 minutes onward and no Sonos found :frowning:

Can you give this a shot?, look for and install a mobile app called UPnP Tool
image

Fire it up, you should see your sonos devices in the list:

If not, something is blocking SSDP/UPNP announcements, if they are there, well, one step at a time....

.... and of course I am the iOS guy. Know a comparable tool on iOS to get this accomplished.

Also (because let's throw more at this!!), I have eero routers but I have never had an issue with Sonos (in fact it behaves flawlessly).

Here is the screenshot...

not being familiar with this app, by what means is this discovering devices?, I ask as the tool I’ve shown uses the same discovery mechanism as the hub…

Ok. I think I have a kindle fire tablet at home. Let me fire it up and see if I can get the app from the amazon app store or google play.