This article will cover some examples of rules that do not work as expected, giving an explanation of the problem and how it can be resolved.
Rules with “AND” time elements
Scenario 1: The outdoor flood light should come on when the outdoor motion is tripped and it is after sunset.
WHENEVER Outdoor Motion (Zn 1) BECOMES NOT SECURE
AND THE TIME IS LATER THAN SUNSET
THEN TURN Outdoor Light [1(A1)] ON FOR 5 MINS
Scenario 2: An LED indicator connected to output 7 should come on when the back door is opened between 8pm and 9am .
WHENEVER Back Door (Zn 2) BECOMES NOT SECURE
AND TIME OF DAY IS LATER THAN 8:00PM
AND TIME OF DAY IS EARLIER THAN 9:00AM
THEN TURN LED-Back (Out 7) ON
Problem: The first rule will work as expected until midnight . The second rule will not work at all. This is due to the fact that the system evaluates the “AND” time statements from midnight to midnight. This means that “later than sunset” is the period of time from after sunset to midnight . The second rule does not work, because within the midnight to midnight period, a time that is after 8:00PM and before 9:00AM does not exist. This period of time spans across two days, therefore the “AND” statements can never both be true and the rule will never fire.
Solution: To overcome this problem, two rules can be written. One rule will cover the period of time before midnight , while the other rule will cover the period of time after midnight .
WHENEVER Back Door (Zn 2) BECOMES NOT SECURE
AND TIME OF DAY IS LATER THAN 8:00PM
THEN TURN LED-Back (Out 7) ON
WHENEVER Back Door (Zn 2) BECOMES NOT SECURE
AND TIME OF DAY IS EARLIER THAN 9:00AM
THEN TURN LED-Back (Out 7) ON
For scenario 1, a rule could be written that will turn the light on when the motion sensor is tripped and it is dark outside. This would overcome the issue with the rule not working after midnight .
WHENEVER Outdoor Motion (Zn 1) BECOMES NOT SECURE
AND IT IS DARK OUTSIDE
THEN TURN Outdoor Light [1(A1)] ON FOR 5 MINS
“WHENEVER” is the trigger
Scenario: The control is partitioned into 4 separate areas. Area 1 is a lobby between 3 separate offices. When all three offices (Areas 2, 3, and 4) are armed to away mode, the lobby (Area 1) should automatically arm.
WHENEVER Office 1 (Area 2) IS ARMED AWAY
AND Office 2 (Area 3) IS ARMED AWAY
AND Office 3 (Area 4) IS ARMED AWAY
THEN ARM AREA(S) 1 TO AWAY IMMEDIATELY
Problem: This rule will not work all the time. It will only work if Area 2 is armed after Areas 3 and 4. If area 2 is armed before Areas 3 or 4, the rule will not fire because the AND statements are not true at the time that the trigger (the WHENEVER statement) occurs.
Solution: A separate rule must be written with each area as the trigger to accommodate for the different orders in which the areas may be armed. In this example, in addition to the rule above, the following two rules would also be needed.
WHENEVER Office 2 (Area 3) IS ARMED AWAY
AND Office 1 (Area 2) IS ARMED AWAY
AND Office 3 (Area 4) IS ARMED AWAY
THEN ARM AREA(S) 1 TO AWAY IMMEDIATELY
WHENEVER Office 3 (Area 4) IS ARMED AWAY
AND Office 1 (Area 2) IS ARMED AWAY
AND Office 2 (Area 3) IS ARMED AWAY
THEN ARM AREA(S) 1 TO AWAY IMMEDIATELY