Garage Door Code issues

Its working except the message is not playing between 1 and 5 seconds
Any motion in the garage or just outside the garage (both have flags) will reset the timer.
Its basically a timer with motion sensors to close the door at night when we take out the trash or whatever.
I wanted a warning just before it closes but it doesnt work, see line 43
 
36.    WHEN Motion Outside Front Garage SECURE
        AND IF DARK
        AND IF Garage Motion SECURE
        AND IF Garage Door NOT READY
            THEN Front Motion Flag ON FOR 5 MINUTES
            THEN Garage Motion Flag ON FOR 5 MINUTES
            THEN SAY GARAGE DOOR CLOSE IN FIVE MINUTES
37.    WHEN Motion Outside Front Garage NOT READY
        AND IF DARK
            THEN SET Front Motion Flag TO 1
38.    WHEN Garage Motion NOT READY
        AND IF DARK
            THEN SET Garage Motion Flag TO 1
39.    WHEN Front Motion Flag OFF
        AND IF Garage Motion Flag OFF
        AND IF Garage Door NOT READY
        AND IF DARK
            THEN Garage Door Flag OFF FOR 20 SECONDS
            THEN Front Motion Flag OFF FOR 20 SECONDS
            THEN Garage Door Flag OFF
            THEN Front Motion Flag OFF
40.    WHEN Front Motion Flag OFF
        AND IF DARK
        AND IF Garage Door NOT READY
        AND IF Garage Door Flag OFF
        AND IF Garage Motion Flag OFF
            THEN Garage Door Controller Relay ON FOR 1 SECOND
41.    WHEN Garage Door Controller Relay ON
            THEN Relay Control ON FOR 1 SECOND
42.    WHEN Relay Control OFF
            THEN Garage Door Controller Relay OFF
43.    WHEN Garage Door NOT READY
        AND IF Garage Motion Flag TIMER IS LESS THAN 0:00:05
        AND IF Garage Motion Flag TIMER IS GREATER THAN 0:00:01
            THEN SAY GARAGE DOOR CLOSE NOW
 
 
The only time it's checking for RULE 43, is the MOMENT when the Garage Door becomes not ready. So, if you garage door opened (e.g. not ready) and the timers were between :01 and :05, then it would say the message.
 
I do think #39 also has some issues. You are setting the Garage Door Flag OFF for 20 seconds, then setting it OFF. I believe the second THEN statement would actually execute before the 20 seconds is up; I don't believe the Elk waits for the completion of the timing before executing the next THEN statement.
 
EDIT: Take all that with a grain of salt. I just realized this was in HAI forum. I'm not versed with the HAI panels and don't know how they perform compared to the ELK.
 
You sure it only checks the moment the door is not ready? Thats not the case if I use a "AND IF Garage Door NOT READY"
Im not sure I really need line 39
How about modifying the message line to say this:
 
43.    WHEN Garage Motion Flag ON
        AND IF Garage Motion Flag TIMER IS LESS THAN 0:00:05
        AND IF Garage Motion Flag TIMER IS GREATER THAN 0:00:01
            THEN SAY GARAGE DOOR CLOSE NOW

 
 
 
This was my earlier code before I started changing things around
It repeated the message about 30 times and drove me crazy (it might of been the (Pause) (Pause) at the end of message instead of ending the message)
 
36.    WHEN Motion Outside Front Garage SECURE
        AND IF DARK
        AND IF Garage Door NOT READY
            THEN Front Motion Flag ON FOR 5 MINUTES
            THEN Garage Motion Flag ON FOR 5 MINUTES
            THEN SAY GARAGE DOOR CLOSE IN FIVE MINUTES
37.    WHEN Motion Outside Front Garage NOT READY
        AND IF DARK
            THEN SET Front Motion Flag TO 1
            THEN SET Garage Motion Flag TO 1
38.    WHEN Front Motion Flag OFF
        AND IF DARK
        AND IF Garage Door NOT READY
            THEN Garage Door Flag OFF FOR 40 SECONDS
            THEN Front Motion Flag OFF FOR 40 SECONDS
39.    WHEN Front Motion Flag OFF
        AND IF DARK
        AND IF Garage Door NOT READY
        AND IF Garage Door Flag OFF
        AND IF Garage Motion Flag OFF
            THEN SAY GARAGE DOOR CLOSE NOW (Pause) (Pause)
            THEN Garage Door Controller Relay ON FOR 1 SECOND
40.    WHEN Garage Door Controller Relay ON
            THEN Relay Control ON FOR 1 SECOND
41.    WHEN Relay Control OFF
            THEN Garage Door Controller Relay OFF
42.    WHEN Garage Motion Flag ON
        AND IF Garage Motion Flag TIMER IS LESS THAN 0:00:10
            THEN SAY GARAGE DOOR CLOSE IN TEN SECONDS
 
 
Im doing the same thing during the day but using a 30 minute timer and a time clock (to set a range) plus the motions as a safety feature and to reset the timers (except when away)
 
30.    WHEN AWAY
        AND IF Garage Door NOT READY
            THEN Garage Door Flag ON FOR 40 SECONDS
            THEN Garage Motion Flag ON FOR 40 SECONDS
31.    WHEN AWAY
        AND IF Garage Door NOT READY
        AND IF Garage Door Flag OFF
        AND IF Garage Motion Flag OFF
            THEN SAY GARAGE DOOR CLOSE NOW
            THEN Garage Door Controller Relay ON FOR 1 SECOND
            THEN E-MAIL MESSAGE #9:[Garage Door is closi…] TO: [email protected]    Su…
32.    WHEN Motion Outside Front Garage SECURE
        AND IF TIME CLOCK 3 ENABLED
        AND IF Garage Door NOT READY
            THEN Front Motion Flag ON FOR 30 MINUTES
            THEN Garage Motion Flag ON FOR 30 MINUTES
            THEN SAY GARAGE DOOR CLOSE IN THIRTY MINUTES
33.    WHEN Motion Outside Front Garage NOT READY
        AND IF TIME CLOCK 3 ENABLED
        AND IF Garage Door NOT READY
            THEN SET Front Motion Flag TO 1
            THEN SET Garage Motion Flag TO 1
34.    WHEN Front Motion Flag OFF
        AND IF TIME CLOCK 3 ENABLED
        AND IF Garage Door NOT READY
            THEN Garage Door Flag OFF FOR 40 SECONDS
            THEN Garage Motion Flag OFF FOR 40 SECONDS
35.    WHEN Front Motion Flag OFF
        AND IF TIME CLOCK 3 ENABLED
        AND IF Garage Door NOT READY
        AND IF Garage Door Flag OFF
        AND IF Garage Motion Flag OFF
            THEN SAY GARAGE DOOR CLOSE NOW
            THEN Garage Door Controller Relay ON FOR 1 SECOND
            THEN E-MAIL MESSAGE #9:[Garage Door is closi…] TO: [email protected]    Su…
 
 
You sure it only checks the moment the door is not ready?
Thats not the case if I use a "AND IF Garage Door NOT READY"
Yes.

Triggers only trigger when there is a change.
They are not a condition that is checked for.
 
So when a zone CHANGES to NOT READY, that is a trigger, but a zone BEING NOT READY is not.
The zone would have to transition back to SECURE and then NOT READY again to trigger.
 
The same thing with flags.
A flag turns ON only once. 
You'd have to turn it OFF, or SET it to 0, and then turn it ON again to trigger a block of code.

The AND IF statements are conditionals NOT triggers.
Their status only gets checked for after the block of code is initiated by a trigger.



How about modifying the message line to say this:
43. WHEN Garage Motion Flag ON
AND IF Garage Motion Flag TIMER IS LESS THAN 0:00:05
AND IF Garage Motion Flag TIMER IS GREATER THAN 0:00:01
THEN SAY GARAGE DOOR CLOSE NOW

That block will only execute the moment the motion flag turns on AND the timer is between 5 and 1.
 
39. WHEN Front Motion Flag OFF
AND IF Garage Motion Flag OFF
AND IF Garage Door NOT READY
AND IF DARK
THEN Garage Door Flag OFF FOR 20 SECONDS
THEN Front Motion Flag OFF FOR 20 SECONDS
THEN Garage Door Flag OFF
THEN Front Motion Flag OFF
40. WHEN Front Motion Flag OFF
AND IF DARK
AND IF Garage Door NOT READY
AND IF Garage Door Flag OFF
AND IF Garage Motion Flag OFF
THEN Garage Door Controller Relay ON FOR 1 SECOND
Ok
In block 39:
You turn the flags off for 20 seconds then immediately turn the off permanently.
If you just want them off delete the 20 second lines.
Is that what you intended?

Block 40 has the same trigger and conditions as 39 except for the garage door off flag.
Since it appears block 39 is the only block that turns off the garage flag, you could just trigger block 40 with WHEN Garage Door Flag OFF?

If you want a warning 5 seconds before close, then trigger off of WHEN Garage Motion Timer Flag IS EQUAL TO 5.
 
I didnt realize triggers only happen when an event is changed like from garage door secure to garage door not ready.
This should be much better, I think....
Motion flags are reset to 5 minutes if door still open and motion inside or just outside of garage (Im assuming if a flag is at 3 minutes it will reset to 5)
 
36.    WHEN Garage Door NOT READY
        AND IF DARK
            THEN Front Motion Flag ON FOR 5 MINUTES
            THEN Garage Motion Flag ON FOR 5 MINUTES
            THEN SAY GARAGE DOOR CLOSE IN FIVE MINUTES
37.    WHEN Motion Outside Front Garage NOT READY
        AND IF DARK
            THEN SET Front Motion Flag TO 1
38.    WHEN Garage Motion NOT READY
        AND IF DARK
            THEN SET Garage Motion Flag TO 1
39.    WHEN Garage Motion NOT READY
    WHEN Motion Outside Front Garage NOT READY
        AND IF Garage Door NOT READY
        AND IF DARK
            THEN Front Motion Flag ON FOR 5 MINUTES
            THEN Garage Motion Flag ON FOR 5 MINUTES
40.    WHEN Front Motion Flag OFF
        AND IF DARK
        AND IF Garage Door NOT READY
        AND IF Garage Door Flag OFF
        AND IF Garage Motion Flag OFF
            THEN Garage Door Flag ON FOR 10 SECONDS
            THEN SAY GARAGE DOOR CLOSE IN TEN SECONDS
41.    WHEN Garage Door Flag OFF
        AND IF DARK
        AND IF Garage Door NOT READY
        AND IF Front Motion Flag OFF
        AND IF Garage Motion Flag OFF
            THEN Garage Door Controller Relay ON FOR 1 SECOND
42.    WHEN Garage Door Controller Relay ON
            THEN Relay Control ON FOR 1 SECOND
43.    WHEN Relay Control OFF
            THEN Garage Door Controller Relay OFF
 
 
Think of it written this way:
 
WHEN Garage Door (becomes) NOT READY
 
WHEN Garage Door (becomes) SECURE
 
WHEN Front Motion Flag (turns) OFF
 
 
36.    WHEN Garage Door NOT READY
        AND IF DARK
            THEN Front Motion Flag ON FOR 5 MINUTES
            THEN Garage Motion Flag ON FOR 5 MINUTES
            THEN SAY GARAGE DOOR CLOSE IN FIVE MINUTES
This will say "Garage Door Close in 5 Minutes" EVERYTIME the door opens and it is dark.
Is that what you want to happen?
Why are you turning the motion flags on when the door opens?
 
 
37.    WHEN Motion Outside Front Garage NOT READY
        AND IF DARK
            THEN SET Front Motion Flag TO 1
38.    WHEN Garage Motion NOT READY
        AND IF DARK
            THEN SET Garage Motion Flag TO 1
These lines turn the flags on permanently.
Do you have other logic to turn them off?
If the garage door is open, these lines appear to be immediately over ridden by block 39, turning both flags on for 5 mins.
 
39.    WHEN Garage Motion NOT READY
    WHEN Motion Outside Front Garage NOT READY
        AND IF Garage Door NOT READY
        AND IF DARK
            THEN Front Motion Flag ON FOR 5 MINUTES
            THEN Garage Motion Flag ON FOR 5 MINUTES
 
40.    WHEN Front Motion Flag OFF
        AND IF DARK
        AND IF Garage Door NOT READY
        AND IF Garage Door Flag OFF
        AND IF Garage Motion Flag OFF
            THEN Garage Door Flag ON FOR 10 SECONDS
            THEN SAY GARAGE DOOR CLOSE IN TEN SECONDS
Why do you have the "AND IF Garage Door Flag OFF" conditional here?
The only way for this block to be executed a second time would be for the Front Motion Flag to be restarted and then turn off again.
The only way the Front Motion Flag turns on is permanently or for 5 minutes, which would mean this block won't execute for 5 minutes and the Garage Door Flag will have already timed out.
So everytime this block executes the Garage Door Flag will be OFF, checking for it is redundant.
 
41.    WHEN Garage Door Flag OFF
        AND IF DARK
        AND IF Garage Door NOT READY
        AND IF Front Motion Flag OFF
        AND IF Garage Motion Flag OFF
            THEN Garage Door Controller Relay ON FOR 1 SECOND
42.    WHEN Garage Door Controller Relay ON
            THEN Relay Control ON FOR 1 SECOND
43.    WHEN Relay Control OFF
            THEN Garage Door Controller Relay OFF
I assume you are setting the Relay Control Flag ON and then turning the relay off when the flag times out as a fail-safe to turn the relay off.
This line automatically turns the relay off after 1 second.
"THEN Garage Door Controller Relay ON FOR 1 SECOND"
 
 
Deafbykhorns said:
Those would "or" triggers?
I was using those statements as individual examples
 
But yes, if they were stacked they would all trigger whatever block follwoed if any ONE of the trigegrs was true, just like your block 39 above.
 
I want the motion flag clock to reset back to 5 minutes everytime the sensors trip during the 5 minute count down.
I think line 39 should be set to secure after 37&38 set the flag to 1
Basically, the motions are safety devices to stop the door from closing.
Line 40 checking for flag should be removed
The 15 second garage door flag was to simply say message one time to warn of door closing. I did have the motion secure doing this but found it to be annoying when tripped several times during the count down.
42&43 are fail safe

It seemed to work when testing and flags reset but that may of been pot luck.
I do have a couple lines not shown that turn on some lights with the same motions
 
Deafbykhorns said:
I want the motion flag clock to reset back to 5 minutes everytime the sensors trip during the 5 minute count down.
I think line 39 should be set to secure after 37&38 set the flag to 1
 
 
The way it is written right now, if the garage door is open then 37 and 38 are redundant.
The flag would be set to a value of 1 then 5 minutes counter immediately after.
 
This would set the flag to a value of 1, essentially on permanently, and then start the 5 minute timer once either motion detector stopped detecting.
Essentially, when all motion stops, set a 5 minute delay timer.
 

37.    WHEN Motion Outside Front Garage NOT READY
        AND IF DARK
            THEN SET Front Motion Flag TO 1
38.    WHEN Garage Motion NOT READY
        AND IF DARK
            THEN SET Garage Motion Flag TO 1
39.    WHEN Garage Motion SECURE
    WHEN Motion Outside Front Garage SECURE
        AND IF Garage Door NOT READY
        AND IF DARK
            THEN Front Motion Flag ON FOR 5 MINUTES
            THEN Garage Motion Flag ON FOR 5 MINUTES

 
 
 
Block 39 is two nested triggers.  Think of it rewritten like this:

Code:
39.  WHEN Garage Motion SECURE
            AND IF Garage Door NOT READY
            AND IF DARK
                THEN Front Motion Flag ON FOR 5 MINUTES
                THEN Garage Motion Flag ON FOR 5 MINUTES
40.  WHEN Motion Outside Front Garage SECURE
            AND IF Garage Door NOT READY
            AND IF DARK
                THEN Front Motion Flag ON FOR 5 MINUTES
                THEN Garage Motion Flag ON FOR 5 MINUTES
 
By nested, you mean that both of them need to happen in order for the block to execute?
 
Once I understood the mechanics of the trigger it made it all clear. I really appreciate the lesson, thank you! Setting the flag to 1 was a method I read in another forum, this method makes much more sense. The KISS method is the way to go!
 
My next programming lesson will be increment/decrement flags as a counter. Im going to use this method to keep track of door openings and turning on certain lights.
Will start a new post.
 
Thanks again
 
No.
Nested triggers save programming lines by executing the same series of actions by multiple independent triggers.
In your block 39, all of the conditionals will be checked when either of the triggers occurs, if the conditionals pass then the action statements will execute.
I simply rewrote your block 39 into two separate blocks to illustrate to you how the controller sees the code and acts on it.
You block 39 is written the most efficiently if the conditions you want to evaluate and the actions you want to take are truly identical.

In your block 39 there is essentially an unwritten"OR" between the two trigger statements.

I do the same thing with doors and windows. ;)
 
Back
Top