Here’s generally how my systems works to suspend scenes while the “Party Mode” is on. You can implement a Party Mode flag either using a virtual device or a global variable. In my examples, I will use a global variable. There are two scenes that control the state of the Party Mode flag; one scene named “Party Start” the other name “Party’s Over.” The purpose of the Party Start scene is to just set the Party Mode flag on. My Party Start scene has no commands, events, or timers, just one line of Luup code.
global_party_mode_flag = 1
For convenience, you could add commands to the Party Start scene that turns on lights you ordinarily run during a party.
The Party’s Over scene has no commands, events or flags either, just a few lines of code. The first line turns the party mode off, and the conditional runs the Bedtime scene if that scene attempted to run but was stopped due to party mode being on.
global_party_mode_flag = 0
if (global_bedtime_hold == 1) then
luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","RunScene",{ SceneNum="32" }, 0)
end
The only modification you should need to make to the above code is changing the SceneNum from 32 (which is my system’s number for the Bedtime scene) to the scene number of you want to control.
Next, modify the scene that controls devices such as lights or thermostats that you want to suspend while the party is on. For me, that scene is named Bedtime (scene number 32), and it turns off various lights and sets the thermostats to the nighttime temperature. Bedtime is triggered by timers and runs in the evening at various times depending on the day of the week. In the Luup tab, the Bedtime scene has the following code.
if ( global_party_mode_flag == 1 ) then
global_bedtime_hold = 1
return false
else
global_bedtime_hold = 0
return true
end
Returning false from the Luup code prevents the commands in that scene from running, returning true tells Vera to go ahead and run the commands.
Just to clean things up, every morning at sunrise I set the party mode and bedtime hold flags to off. The Luup code in the Sunrise scene looks like this:
global_party_mode_flag = 0
global_bedtime_hold = 0
The Sunrise scene has commands that turn off all the same lights as the Bedtime scene (plus some dusk to dawn lights) so no need to run Bedtime again. I have a Morning scene that sets the thermostat to a comfortable wake up temperature so no need to mess with the thermostat.
This solution relies on Vera controlling the thermostat temperatures rather than using the built in thermostat programs. I have yet to hear a compelling argument why using Vera to control the temperature is a bad idea.
If there is a power failure or you power cycle the Vera (especially during a party), the values set in the global variables will be lost (as if they were set back to off). If you are in an area with frequent power failures, you probably already have your equipment on UPSs.