Keep It Simple - Garage door open too long

Hey all! been trying to wrap my head around all this custom LUA code in the forums but i’m having a hard time. Could someone lend a hand if they can?

My problem is this. I have a door sensor that I mounted on my garage door. I simply want to be notified if I left the house and left the garage door open. Basically

If Garage Door is open and Last Trip (i think) is greater than 5 mins alert me.

I have tried to do it via a scene:

Schedule: 1min
Trigger: Door sensor open and armed.

All it does it email me every min. Here is some extra LUA code i tried. Please help :slight_smile:

local deviceNo = 37
local period = 1

local SS_SID = “urn:micasaverde-com:serviceId:SecuritySensor1”

local armed = luup.variable_get(SS_SID, “Armed”, deviceNo) or “0”
if armed == “1” then
local tripped = luup.variable_get(SS_SID, “Tripped”, deviceNo) or “0”
if tripped == “0” then
luup.variable_set(SS_SID, “TripPeriod”, “0”, deviceNo)
else
local tripPeriod = luup.variable_get(SS_SID, “TripPeriod”, deviceNo) or 0
tripPeriod = tonumber(tripPeriod)
tripPeriod = tripPeriod + 1
luup.variable_set(SS_SID, “TripPeriod”, tripPeriod, deviceNo)
if tripPeriod == period then
return true
end
end
end
return false

You might take a look at the following post:

http://forum.micasaverde.com/index.php/topic,47495.msg314324.html#msg314324