Hi everyone,
I’m new to all this so be gentle
I purchased an Edge about 3 weeks ago now, and my initial task was to keep the wife happy and create an alarm system. So i thought i’d try the Simple Alarm plugin. Whilst it works on the whole, there were some features i felt it would benefit from to make it more like a standard alarm and increase the WAF!
Such as:
[ul][li]Sound the indoor siren, On and Off with 1 second intervals for both state, whilst the countdown timer is running for both arming the alarm and entry detection through the front door[/li]
[li]Add code to run the “intrusion” function when the front door is opened, allowing ‘n’ seconds to disarm the alarm, before sounds all sirens and running the “panic” function[/li]
[li]Similar to above, however instead, if any other sensor (i.e. not the front door) is tripped, run the “panic” function immediately[/li][/ul]
As I have an Everspring indoor siren, the “beep, beep” option does not seem possible via a single signal to the device, i.e. it’s only capable of ON or OFF commands. Therefore i hunted through the LUA code for the plugin and tried to reverse engineer it and understand where i needed to edit to acheive the features above.
The below shows a snippet of code for part of the countdown timer function which runs when you arm the alarm, or when it detects the front door sensor being tripped…
[code]function updateRemaining()
local dueTimestamp = readVariableOrInit(Device,SERVICE_ID, “DueTimestamp”, “”)
local remaining = tonumber(dueTimestamp) - os.time()
if (remaining < 0) then remaining = 0 end
setIfChanged(SERVICE_ID, “Remaining”, remaining, Device)
–Sounds indoor siren whilst away or incoming delay is in progress
luup.call_delay( ‘TurnOnSirenIndoor’, 2 )
luup.call_delay( ‘TurnOffSirenIndoor’, 1 )
return remaining > 0
end
function TurnOnSirenIndoor()
luup.call_action(SID_SwitchPower1, “SetTarget”, {newTargetValue = “1”}, 28)
end
function TurnOffSirenIndoor()
luup.call_action(SID_SwitchPower1, “SetTarget”, {newTargetValue = “0”}, 28)
end[/code]
To summarise, the above works out the stop time for the counter minus the current time, giving you the “countdown” and then whilst it is greater than 0 it calls the Siren ON function with a delay of 2 seconds and then the OFF function with a 1 second delay. I chose these delay times, as it gives the nicest “Beep Beep” effect. This then loops until the countdown timer is finished and at which point either arms the alarm, or runs the panic function.
To clarify - i wrote the two SirenIndoor functions and added them to loop above them, however the timer was part of the plugin already.
My issue is that i’m finding it all really really slow and delayed. For example my wife disarmed the alarm this afternoon, and the indoor siren remained ON for “alledgedly” 2 minutes before turning OFF again. Annoyingly my Edge seems to also have lost any logs/alerts from prior to the disarm trigger taking place too - which makes it even harder to diagnose.
Is there a better way of doing this? Or is Z Wave and/or Vera Edge, simply incapable of sending ON/OFF signals and acting on them as fast as I desire?
I would really appreciate some advice with this, as the wife just wanted a standard alarm, however i like the idea that this system in theory gives me a lot more options for future automation and such, and until i get it working - i’m going to continue getting ear ache! The full lua file is attached if it helps understand what is going on.
Many thanks in advance.