how to manage stopping a scene delay

Hello,

I’ve got a problem, it’s a bit difficult to explain, but i think it’s essantial to use correctly veraLite Scene as a house alarm.
I want to activate my alarm with some windows sensors armed immediately and my main door armed after 2 minutes.
Unfortunately if i need to deactivate my alarm 1 min only after activated it, the scene still continu and my door is going to be armed 1 min after…
I’ve already create a virtual switch, and thanks to it i can avoid to activate my siren…but my door sensor remain armed. If someone knows how to stop immediately a action during a scene…?

many thanks in advance :slight_smile:

You can’t cancel a in progress scene (unless you reboot).

You could use PLEG to custom design your alarm logic, or try the “Simple Alarm” plugin in the app store.

http://forum.micasaverde.com/index.php?topic=23942.0

Consider adding a Zwave door lock. If you are looking to arm your system when leaving the house, a single button push on the lock could lock the door, arm any sensors, lower the thermostat, and turn off lights to name a few. Upon your return, enter the 4 digit code and everything is back to the way you like it.

When I want to have a timer loop that I might want to abort, I do something like the following:

function TimeUnlockFrontDoor(stuff)
  if gFDCount > 1 then
    gFDCount = gFDCount - 1
    if gFDCount == 0 then
      -- Do whatever you wanted to do when the time expires
    else
      luup.call_timer("TimeUnlockFrontDoor", 1, "1m", "", "")
    end
  end
end

When I want to initiate the timer (for 10 minutes) for the first time:

if gFDCount == 0 then
  gFDCount = 10
  luup.call_timer("TimeUnlockFrontDoor", 1, "1m", "", "")
end

So the timer loop checks every minute to see if it should continue, stop, or trigger.

When I want to abort the timer, I simply set the gFDCount global variable to 0. If I want to reset the timer back to 10 minutes (while the timer is running), just set gFDCount = 10 again.

I initially set gFDCount = 0 in the LUUP startup code, to avoid dealing with a null value.

This does a check every minute. You could make the check more often like every 10 seconds by multiplying everything by 6, and using “10” for the timer duration.

If you need multiple timer loops like above, be sure to use a unique global for each one.