Sonos Luup Code: How to always play second song in Sonos playlist during scene?

Hi! I’m trying to figure out how to play a specific song when I hit a trigger. I know how to play a shuffled Sonos playlist in scene, but not always a specific song.

Any help would be appreciated.

Also, is there some kind of master list of Sonos luup actions that work with the plug-in [i.e. SetURIToPlay, Next, SetPlayMode, etc…]?

[quote=“thecodas, post:1, topic:193215”]Hi! I’m trying to figure out how to play a specific song when I hit a trigger. I know how to play a shuffled Sonos playlist in scene, but not always a specific song.

Any help would be appreciated.

Also, is there some kind of master list of Sonos luup actions that work with the plug-in [i.e. SetURIToPlay, Next, SetPlayMode, etc…]?[/quote]
This is a great question. Did you ever get an answer? There is only 6,235 post on Sonos to read through. If you are lucky, in about 3 weeks you may find the answer.
Tom

Use the url

Go into your sonos app and select the individual track you want to play. Once you’ve done that, enter the following URL in a browser on the LAN where the Vera is located (replacing Vera-IP with the actual IP address);

http://Vera-IP:3480/data_request?id=user_data2&output_format=xml

In the output find the definition for the Sonos device you just played the track you select earlier. You should find a definition for the currentURI and there should be a string representing the path to the track in question. Something like;

You can cut and paste the string into Lua code, such as;
luup.call_action(“urn:micasaverde-com:serviceId:Sonos1”, “PlayURI”, {URIToPlay=“x-file-cifs://192.168.1.254/Music/iTunes/iTunes%20Media/Music/Pearl%20and%20Dean/Asteroid.m4a”, Volume=20}, 112)

The IP address in the path in this example is a USB mounted path off my router where I store all my music so its available across the LAN. I use this to announce when I switch the home cinema on. :slight_smile: