Garagedoor Sensor - How to create a sinful Scene

Hello,
I can open / close my garage door automatically via Vera Edge & a Fibaro Relay. Now I got a new garage door sensor.
I now want to close the garage door when it’s open for longer than 5 minutes.

My first scene had a logic like this:
TRIGGER: garage door sensor opened
DELAYED ACTION: close garage door

The result seemed good. Until I realized that when I closed the garage door myself, the garage door was openend by my scene after e.g. 4 minutes. Resulting in an open garage door which than was closed again after 5 minutes.

How can I click a scene like this in Vera Edge:

TRIGGER: garage door sensor opened for longer than 5 minutes
ACTION: close garage door

OR

TRIGGER: garage door sensor opened
DELAYED TRIGGER 5 Minutes: garage door sensor (still) opened
ACTION: close garage door

The easiest way will be checking if the garage door sensor is still open after a certain period of time (i.e. 5 minutes) and then, if it is still in open status, close the door.

I just wanted to bring up the dangers of automating your garage door closing.
Make sure you have all of the security measures on the door itself set up so if your car is parked under it it will not hit it.
Also make sure the sensor is not too low that the beam goes under the car when it is parked under the door.
I also recommend a garage door opener sub controller that abides by the UL325 standards.
I also recommend a camera in your garage make sure there is not obstruction under your garage door prior to closing it manually.

Just some thoughts.

I echo Jamr’s concerns, which is why I have mine set up to send me an alert every 30 minutes the door is still open. Can be annoying if I am putzing around in the garage, but I just ignore it. In fact if I get 4 notifications I know I have been in the garage too long. You can change yours to 5 minutes.

When my phone sends me the alert, I look at the garage cam to verify it is open and it is okay to close.

I control my garage door with a tilt sensor, zwave dry contact relay, the countdown timer app, the garage door app, and a few scenes. Once the sensor state closes, a scene just resets the timer to prevent the door from opening back up. I’ve also got a virtual switch the stops the timer manually if I want to keep the door open longer.

You could probably do something similar with PLEG, though. I just hadn’t discovered it yet when I put mine together. Suppose I should reconfigure it at some point.

Hello,
in the mean time I learned to program luup code. But I got a slight problem.

Here’s the code:

[code]local GarageOpen = luup.variable_get(“urn:micasaverde-com:serviceId:SecuritySensor1”, “Tripped”, 88)
local t = os.date(‘*t’)
local current_second = t.hour * 3600 + t.min * 60 + t.sec
local compare_second = current_second + 60 --set seconds to wait here

while current_second < compare_second do
luup.sleep(1000)
t = os.date(‘*t’)
current_second = t.hour * 3600 + t.min * 60 + t.sec
end

GarageOpen = luup.variable_get(“urn:micasaverde-com:serviceId:SecuritySensor1”, “Tripped”, 88)

if (GarageOpen == “1”) then
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, {newTargetValue = “1”}, 12)
end [/code]

Devie 88 is my tilt sensor, device 12 the switch to open-close the door.

I now got a problem with the Tripped variable and the sleep function. I realized quickly, that the Tripped variable will never be set to 10 unless the scene is finished (no matter if I wait 1 second or 1 hour). I think it’s because the sleep function really sets the whole system to sleep and not only this scene.

Does anyone has an idea how to program this differently?

I got it! ;D

And it’s easier than thought.

The solution

I created a scene that is triggered by the garage tilt sensor. I did not define any action but added this tiny bit of luup-code:

function CheckGarageDoor()
	GarageOpen = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", 88)

	if (GarageOpen == "1") then
		luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "1"}, 12)
	end	
end

luup.call_delay("CheckGarageDoor",300,"",1) --parameter 2 are the seconds to wait

Now, if the Garage is open for longer than 5 minutes it will be closed.

An alternative would be to replace

[code]GarageOpen = luup.variable_get(“urn:micasaverde-com:serviceId:SecuritySensor1”, “Tripped”, 88)

[/code]
with

GarageOpen = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1", "ArmedTripped", 88)
to only close the garage door when the tilt sensor is armed (which is configurable, e.g. in Mode NIGHT and VACATION)

It looks like you set your garage door switch to constant “on” … is that the way your garage door works or is it a momentary switch? Just curious …