An old post, still long, not sure if anyone is using these rules. However I updated and streamlined the garage door keypad handler routines using RM 5.0. These rules are designed for the z-wave keypad described above, and a z-wave garage door opener add-on such as the GO-CONTROL or similar.
This update corrected/improved the following:
- Resolved notification routines to remove duplicate reporting
- Refined refresh logic to prevent state errors where keypad and/or garage door was stuck between states and not responding.
- Added RM 5.0 predicate conditions to streamline error checking for the tamper state.
- Consolidated multiple rules and conditional statements to streamline rule flow.
- Added a wait handler which re-triggered z-wave opener if opener is on a wait delay. The Go-Control z-wave garage door controller does not send a new command to the garage door opener within 30 seconds of a previous command to allow the door to complete an opening/closing evolution. The GARAGE DOOR CHECK rule now checks for that state (not opening or closing), and tries 3 attempts to resend the command to open/close the garage door (10 seconds apart).
While the RM4.1 version worked fine most of the time, but still occasionally would get stuck between states, this version is running smoothly for a couple weeks with no issues.
Detailed Rules
The rule sets consist of hub state variables and 7 total rules divided into 4 rules handling the keypad, and 3 rules handling the garage door notifications. Each set (keypad and reporting) is independent of the other. Notifications are triggered by a change in garage door state (open/close/etc), and the keypad handler is triggered by the keypad.
The only link between the two sets of rules are 3 common hub variables which passes the code-name (person who unlocked the keypad), whether a valid keypad entry was made (KeypadValid) and whether a keypad report was made (KeypadReport), to the notification routine. That report (that "person" is opening/closing the garage door) is only made if the door was opened via keypad, and is not otherwise executed.
Rules follow with both screen-shots and text / descriptions:
HUB VARIABLES: (disregard variables in the screen-shot not described below).
Dave Reports / Paula Reports: BOOLEANs with switch connectors to turn door reports on or off
GarageDoor: STRING to capture ‘door’ which reports current status of door (open/opening/closed/closing)
KeypadReport: BOOLEAN flag to indicate when initial (opening/closing) report has been sent
KeypadTamper: BOOLEAN with switch connector to indicate that Keypad has been reset and
master code (default) entered. Disables keypad. Switch connector provides a method to
reset from dashboard, or manually set as a method to disable the keypad.
KeypadValid: BOOLEAN with contact connector to indicate a valid entry on the keypad.
Contact connector not used.
LastName: STRING to capture name (code name) of individual who entered valid entry on the keypad.
Used in reporting.
KEYPAD ROUTINES
Keypad Lock and Refresh Independent routine which ensures KEYPAD device locks after 3 seconds. Keypad auto-locks when opened through the device with a code unless opened digitally (through the Habitat Device), in which it will remain unlocked. This captures the unlock action and triggers a delayed lock, also triggers a 5 sec delayed keypad refresh. Includes manual switch option to manually activate, however with revised routines this is no longer required.
Trigger Events:
Garage Keypad unlocked
Keypad Refresh(off) turns on
Actions:
Lock: Garage Keypad --> delayed: 0:00:03
Refresh: Garage Keypad --> delayed: 0:00:05
Notes:
Locks keypad after 3 seconds,
and refreshes after 5 seconds,
if unlocked with timeout or if manual switch Keypad Refresh turned ON.
Keypad Check: Primary keypad handler routine.
PREDICATE CONDITIONS:
KeypadTamper(off) is off(T) [TRUE]
TRIGGER EVENTS:
Garage Keypad unlocked
ACTIONS:
IF (Last Event Device lastCodeName = master code(F) [FALSE]) THEN
Set KeypadTamper to true
Set KeypadValid to false
Notify Dave’s iPhone: 'Keypad Tamper Activated.'
ELSE
Set KeypadValid to true
Set KeypadReport to false
Set LastName to Garage Keypad lastCodeName(Toni)
Run Actions: Garage Door Actions
Run Actions: Garage Door Actions Check --> delayed: 0:00:07
END-IF
NOTES:
Only runs if KeypadTamper is OFF (switch connector to KeypadTamper boolean hub variable).
Triggered when Garage Keypad is unlocked:
IF lock code entered is ‘master code’:
Set hub variable KeypadTamper to TRUE if lock code entered is 'master code'.
'master code' is reported when ANY code is entered after a full keypad reset.
Once set, must be manually cleared by the connector switch and will disable
any further running of this rule through the predicate condition.
Also sets KeypadValid to FALSE
ELSE:
Set KeypadValid to TRUE: Flag to indicate a valid keypad entry was made
Set KeypadReport to FALSE: Flag to indicate when the keypad
opening/closing report is made.
Capture LastName (only link to reporting routine though Hub Variable)
Run Garage Door Actions
Run Garage Door Check after 7 seconds. There is an approx 5 sec notification delay by the GO-CONTROL garage door controller with a warning beep and flashing light before sending the open/close command to the garage door. This delay accounts for the notification prior to checking garage door movement through the next rule.
Garage Door Actions
Actions:
IF (Garage Door closed TRUE) Garage open: Garage Door
IF (Garage Door open FALSE) Garage close: Garage Door
Notes:
This App is called, not triggered.
Open Garage Door if garage door is CLOSED
Close Garage Door if garage door is OPEN
Garage Door Actions Check
Actions:
IF (NOT Garage Door opening(T) AND
NOT Garage Door closing(T) [TRUE]) THEN
Refresh: Garage Keypad
refresh() on Garage Door
Repeat 3 times every 0:00:10 (stopable)
Run Actions: Garage Door Actions
Wait for event: Garage Door changed --> timeout: 0:00:07
IF (Garage Door opening(F) OR
Garage Door closing(F) [FALSE]) THEN
Stop Repeating Actions
END-IF
END-REP
END-IF
Notes:
If garage door is not opening or closing, then refresh the keypad and the garage door sensor.
Then repeat 3 times every 10 seconds (30 secs total), rerun garage door actions,
wait until garage door opening or closing (timeout after 7 seconds).
Exit repeat if garage door opening/closing.
GARAGE DOOR REPORTING RULES
Garage Door Status: Primary reporting rule, Triggered by a change in the Garage Door state (reported by remote garage door tilt sensor to the z-wave garage door controller, part of the controller package).
Trigger Events:
Garage Door changed
Actions:
Set GarageDoor to Garage Door door(closed)
Run Actions: Garage Door Report and Refresh
Notes:
Sets Hub variable GarageDoor to Garage Door status (door) when it changes,
then run Garage Door Report and Refresh
Garage Door Report and Refresh: Primary garage door reporting routine. Called by Garage Door Status.
Actions:
Run Actions: Garage Door Report
IF (Variable KeypadValid(false) = false(T) [TRUE]) THEN
Lock: Garage Keypad
Refresh: Garage Keypad
IF (Variable Dave Reports(true) = true TRUE) Notify Dave’s iPhone: '%time% Garage Keypad refreshed.'
ELSE-IF (Variable KeypadReport(true) = false(F) [FALSE]) THEN
Set KeypadReport to true
ELSE
Set KeypadValid to false
END-IF
Notes:
Run by GARAGE DOOR STATUS
Report garage door
If a Keypad Entry was not made (KeypadValid = FALSE):
Lock Keypad
Refresh Keypad
Send a refresh report
ELSE IF KeypadReport is FALSE (KeypadValid flag is TRUE):
Set KeypadReport to TRUE - 1st time through keypad report was made
ELSE Set KeypadValid flag to FALSE - 2nd time through reset KeypadValid flag
Garage Door Report: Makes actual Garage door report, includes switches to turn off reporting. Devices are programmed directly into the report code, with the separate routine makes it easier to update/change devices. Two included here, easy to add more. While the "keypad refresh" report is made just to my device through the previous routine, that was primarily for troubleshooting the previous issues. All open/closed (opening/closing) reports are made through this rule.
Actions:
IF (Variable KeypadReport(true) = false(F) AND
Variable KeypadValid(false) = true(F) [FALSE]) THEN
IF (Variable Dave Reports(true) = true TRUE) Notify Dave’s iPhone: '%time% %LastName% is %GarageDoor% the Garage Door.'
IF (Variable Paula Reports(true) = true TRUE) Notify Paula’s iPhone: '%time% %LastName% is %GarageDoor% the Garage Door.'
ELSE
IF (Variable Dave Reports(true) = true TRUE) Notify Dave’s iPhone: '%time% the Garage Door is %GarageDoor%.'
IF (Variable Paula Reports(true) = true TRUE) Notify Paula’s iPhone: '%time% the Garage Door is %GarageDoor%.'
END-IF
Notes:
App is called. Delays and setting global variables happen prior to calling the app.
Hub Variables:
GarageDoor - set to status
LastName - set to who unlocked the keypad
KeypadReport - determines whether a Keypad Report was made to make either a keypad report, or a door status report.
Notifies with Name if KeypadValid indicates a code was entered which triggered the action, otherwise reports the door status (open or closed / opening or closing).
UPDATE 12/2/21: I found that the garage door state was sometimes getting stuck in the OPENING/CLOSING state and not reporting OPEN/CLOSED. I updated the GARAGE DOOR ACTIONS CHECK routine which now checks and corrects this.
Changes
GARAGE DOOR ACTIONS CHECK
No triggers - app is called.
IF (NOT Garage Door opening(T) AND
NOT Garage Door closing(T) [TRUE]) THEN
Refresh: Garage Keypad
Refresh: Garage Door
Repeat 3 times every 0:00:10 (stopable)
Run Actions: Garage Door Actions
Wait for event: Garage Door changed --> timeout: 0:00:07
IF (Garage Door opening(F) OR
Garage Door closing(F) [FALSE]) THEN
Stop Repeating Actions
END-IF
END-REP
ELSE-IF (Garage Door opening(F) OR
Garage Door closing(F) [FALSE]) THEN
Wait for event: Garage Door changed --> timeout: 0:00:10
IF (Garage Door opening(F) OR
Garage Door closing(F) [FALSE]) THEN
Refresh: Garage Keypad
Refresh: Garage Door
END-IF
END-IF








