Help needed: why SHUFFLE is not working

Hi everyone. I’m trying to put up a scene that runs when I get home. Basically my goal is to play a certain Sonos playlist in a random order.

The problem is that when my Sonos powers up, this is not working. If the Sonos was already on, then it works as expected.

[code]local SONOS_SWITCH = 28
local SWITCH_SID = “urn:upnp-org:serviceId:SwitchPower1”

– Function to
function Musica()
local SONOS_DEV = 73
local SONOS_SID = “urn:micasaverde-com:serviceId:Sonos1”
– force Sonos plugin to check state
luup.call_action( SONOS_SID, “SetCheckStateRate”, {rate=“1”}, SONOS_DEV)
– gives half a second for state check to be made
luup.sleep(500)
– sets playmode to SHUFFLE so that the playlist being used does not play always on the same order
luup.call_action(“urn:upnp-org:serviceId:AVTransport”, “SetPlayMode”, {InstanceID=“0”, NewPlayMode=“SHUFFLE”}, SONOS_DEV)
luup.call_action(SONOS_SID, “PlayURI”, {URIToPlay=“SQ:ChegarCasa”, Volume=“50”}, SONOS_DEV)
– turns off Sonos plug in State Check
luup.call_action(LS_SID, “SetCheckStateRate”, {rate=“0”}, SONOS_DEV)
end

– Turn Sonos power switch on
luup.call_action(SWITCH_SID, “SetTarget”, {newTargetValue = “1”}, SONOS_SWITCH)
– Gives 45 seconds for Sonos to boot up and then calls the Musica() function
luup.call_delay(“Musica”, 45, “”)
return true
[/code]

The problem seems to be somewhere here:

-- sets playmode to SHUFFLE so that the playlist being used does not play always on the same order luup.call_action("urn:upnp-org:serviceId:AVTransport", "SetPlayMode", {InstanceID="0", NewPlayMode="SHUFFLE"}, SONOS_DEV) luup.call_action(SONOS_SID, "PlayURI", {URIToPlay="SQ:ChegarCasa", Volume="50"}, SONOS_DEV)

I have no clue why this fails after boot up.

I found a way to solve this! Please check my post at:
http://forum.micasaverde.com/index.php/topic,35880.0.html