List Sonos Favorites in SmartApp


(Mars Tanumihardja) #1

Hi ST Community,

Based on The Sonos Mood Music SmartApp, I was able to get a list of recent tracks played on a Sonos device:

private getRecentTracks() {
	log.trace "getRecentTracks"

	// Query for recent tracks
	def states = sonos.statesSince("trackData", new Date(0), [max:20])
	def dataMaps = states.collect{it.jsonValue}
    
	def count = Math.min(20, Math.max(2, trackCount))
	dataMaps.take(count)
}

Is there a way to get a list of the saved Sonos Favorites or a list of Playlists?

Cheers,

  • mars -