When activating a scene or device, can I specify when to turn the it off?

Hello!

Long time lurker, first time poster. I’m about to pull the trigger on a Vera 2, but I have a question.
When activating a scene, or changing the setting on a device, is it possible to have the UI prompt the user when to turn the scene, or the device off?

Here’s what I’d like to do:

  • Trane TZ43 clone thermostat is running its own schedule, independent of Vera.
  • I wake up and it’s a bit chilly, so I access Vera (through a web interface or an Android client) and set my desired temperature to 70 degrees.
  • Vera asks me how long to hold the new temperature for. I use a set of up and down buttons to specify 9:00 AM.
    i. Alternately, I hit a “permanent hold” button without specifying the time
  • Vera sets the thermostat to “Hold” at 70 degrees
  • At 9:30, vera sets the thermostat back to schedule mode.

This way, since I HAVE to choose a time for the “temporary hold” to end, I won’t accidentally leave my house with the heater set at 70 degrees and cranking all day. Instead, Vera will make sure that it’s toasty warm when I’m getting ready to leave, and turn the heat down shortly after I’m gone without me having to remember to push a button for an “away” scene or logging into Findvera.

A bit of background: My current thermostat, a Honeywell Prestige, does this automatically. I think it’s a fantastic feature, and I hate that I’m losing it on the Trane / RCS stats. Unfortunately, the Prestige has NO support for automation or computer control. :frowning:

Im not familiar with modifying the UI; however, using scenes you could make it all work.

I do something like what you are talking about with a thing I call “Party Mode.” When I turn Party Mode on (which is nothing more than a virtual on/off switch), my Vera suspends its normal schedule of turning lights off and setting the thermostat for night temperature. When I run the scene “Party’s Over” normal operations resume. If Vera missed its scheduled evening light and thermostat scenes, it runs those right away, otherwise Vera waits until the normally scheduled time. No matter what, every morning at sunrise, Party Mode is turned off so that light and thermostat schedules can resume.

What you are looking for is similar, perhaps the only difference is you want to suspend the schedule until a certain time. A “Hold for Two Hours” scene may be easier to create and may accomplish a similar goal.

@Guard:

Your solutions seems pretty easy and useful. How exactly works your party mode? I mean, how do you suspend the normal schedule?

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.

The problem with using a global variable like described is that the variable is lost should Vera reboot. Unfortunately, Vera will reboot for problems not associated with power failures!

Check into using a “Virtual Device” to hold the variable. The Virtual device value will hold across reboots.

(Do a forum search on “Virtual Device”. There are several threads on how to set it up, and how to use it.)

I have several Modes on my Vera: Here they are and what they do when the mode is on:
Party Mode: Suspend HVAC and Lights Off scenes at night.
Guest Mode: Run the second floor HVAC at more comfortable temps for over night guests.
Holiday Mode: Turn modules and outlets used just for Christmas on and off with the Sunset, Bedtime and Sunrise scenes.
Pool Mode: Turn lights around the pool on and off with the Sunset, Bedtime and Sunrise scenes.

I’ve used both global variables and virtual devices with these Modes, both have worked well me; however I have heard of people with reboot issues. Virtual devices work much better in those situations.

The code changes to use virtual devices are not too bad either. To set a mode ON use:

luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="1" },30)

Change the 30 to your virtual device number, change the 1 to a 0 to turn a mode OFF.

To get the current mode value use:

local global_party_mode_flag = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1","Status",30)
Again, change the 30 to your device number.

Adding “local” in front of the variable declaration sets the visibility of that variable to just that scene. You might choose different variable names to avoid confusion (ones that are not prefixed with global).

@Guard.

Thanks a lot for your very detailed information. It will be of great help. I just came back to home (couple of days away…) I’ll setup it in the next days and post my feedback.