Is there a way to use the scene GUI/Advanced tab to set various settings, and then have that exported to Luup code?
I have several scenes that are exactly the same except for one setting.
It would be easier to manage these if I just had to copy/paste several lines of common code.
Using Luup to call a scene from within another scene messes up timing and I’ve had some failures.
I couldn’t figure out how to do this with the variable container or multiswitch.
What I want to do is:
Common tasks:
group all sonos devices, set a master, set volume levels, turn on stereos, set zone settings, set input and volume settings
So, if you develop the common scene, add this to your luup panel (remember to Save Luup on the bottom).
It seems that perhaps your Sonos is still responding to the first instructions, so to make it more reliable, you can place a delay like this:
function DeferredScene()
luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1”, “RunScene”, {SceneNum=9}, 0)
end
luup.call_delay(“DeferredScene”, 15)
This will wait 15seconds before executing the eluup.call_action. Try tweaking the delay to minimize the time and still make sure you get both instructions through as quickly as tolerable to your patience.
there are other ways if you are not happy with this.
A technique I use with MultiSwitch is to have a single scene with multiple triggers - one for each button. Each trigger sets a global variable using code in Luup event. The main code in the LUUP tab uses the variable as required and then sets it to nil. For example:
Trigger 1 Luup event:
sayText = "Button one clicked."
return true
Trigger 2 Luup event:
sayText = "Button two clicked."
return true
Main scene LUUP:
if (sayText == nil) then sayText = "No button pressed." end
luup.call_action("urn:micasaverde-com:serviceId:Sonos1","Say",{Text=sayText, Language="en", Volume=50},105)
sayText = nil