Time Delayed Trigger

Hi everyone,

I am trying to set up my Vera 3 for security. Basically, I have created 3 Scenes. Scene 1 is called “Security System on”, what it does is arm all of my D/W sensors. Scene 2 is called “Security System off”, what it does is it Bypasses all of the D/W sensors in Scene 1, however I also set up a trigger in this scene that will bypass if my unlock code is punched into the front door lock. Scene 3 is called “Break in”, what it does is sound a siren if any of my armed D/W sensors are triggered.

The issue that I am having is: I have Scene 1 (Security System On) running. When I enter in my unlock code on my front door lock and open the front door, Scene 3 (Break in) is still activated (Note: there is a D/W sensor on the Front Door). However, Scene 2 (Security System Off) is activated (as all of the D/W sensors go into Bypass mode).

What I am sure is happening is that the system is not fast enough to initiate Scene 2 (only when using the Unlock code as a trigger), thus the D/W sensor is still armed when I open the front door…which in turn initiates Scene 3.

Is there a way to delay the triggers (armed D/W sensors) in Scene 2…or am I going about this all wrong.

You could add a short delay to scene 3 and then check if the unlock code has been entered before starting the siren. See Delayed Actions.

You may also find the Simple Alarm plugin useful.

Hi RexBeckett, How would you add a short delay in LUUA in Scene 3 and then check if the unlock code has been entered before starting the siren? Pardon my ignorance I am a little green at this still, I did read the hyperlink that you provided, however I am unsure which of the 4 examples to use. I did try the second one:

local dID = 66
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”,“SetTarget”,{ newTargetValue=1 },dID)

function delayOff(dev)
local devno = tonumber(dev)
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”,“SetTarget”,{ newTargetValue=0},devno)

I used the siren’s ID in this scene in the main LUUA, however it still did not work.

Am I using the proper LUUA code, or would I have to add it to the trigger’s LUUA section?

I’m flying blind on this as I don’t have any Z-Wave locks or a siren. You may need to make some adjustments. The following code should be placed in a scene that is triggered by the security sensors. Place it on the main LUUP tab. There should be no device actions on either the DEVICE or ADVANCED tabs.

The code starts a five second timer which then calls the function checkLockUser(). This function checks if the lock is open and the last entered user code. If the lock is not open or the user code is not as specified, it will turn on the siren’s switch. I have not included anything to stop the siren.


function checkLockUser()
local dIDL = 123 – Device ID of DoorLock
local dIDS = 124 – Device ID of Siren
local goodUser = “xxxxx” – Allowed user code
local lockStatus = luup.variable_get(“urn:micasaverde-com:serviceId:DoorLock1”,“Status”,dIDL)
local lockUser = luup.variable_get(“urn:micasaverde-com:serviceId:DoorLock1”,“sl_UserCode”,dIDL)
if (lockStatus == “1”) or (lockUser ~= goodUser) then
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”,“SetTarget”,{ newTargetValue=1 },dIDS)

You will need to set the device IDs and Allowed user code to suit your system.

Would using PLEG solve this issue? If so, how would I implement it?