Counters / Timers

nov0798

Active Member
Can someone please explain Counters and Timers? I appear to be a little confused on what they do, and how to use them. Basically I want to send a text message to my cell phone if the garage door has been left open after the house has been armed, and the door has remained open past a certain amount of time. This would allow the house to be armed, able to get in the car, put the baby in the carseat, back out and shut the door. I have tried rules that I thought would work , but they dont. I was able to get one to work, but had no timer so as soon as the house armed, it would send a text to the phone immidiately. Any help would be great.

Brian
 
Can someone please explain Counters and Timers? I appear to be a little confused on what they do, and how to use them. Basically I want to send a text message to my cell phone if the garage door has been left open after the house has been armed, and the door has remained open past a certain amount of time. This would allow the house to be armed, able to get in the car, put the baby in the carseat, back out and shut the door. I have tried rules that I thought would work , but they dont. I was able to get one to work, but had no timer so as soon as the house armed, it would send a text to the phone immidiately. Any help would be great.

Brian
Explaining timers and counters in a paragraph is too much for me right now. But I can help with a rule. Try this....

1. Whenever [garage door] becomes not secure
then turn output [100] on for [3] minutes

2. Whenever output [100] turns off
and Area 1 armed state = armed
then Dial [phone] and annouce [message]
 
COUNTERS hold numerical values. There are 64 counters in the M1. You can change their values, and you can use ("test" or examine) the values in the Counters to take further actions.

As for setting a Counter, using "THEN" in a rule, you can --
- set a counter to a specific value
- increment a counter by some amount
- decrement a counter by some amount
- toggle its value between zero and one
- set a counter to the value of a temperature sensor

As for "testing" a Counter, using "WHENEVER" in a rule, you can --
- find out if it is equal to, or greater than or less than, some value
- find out if it matches a Custom Setting value
- use the above conditions to trigger M1 actions within a rule

The allowed values in a Counter can range from 0 to 65535.

TIMERS. The M1 does not have "timers" per se, but Outputs can be turned on or off for a specified time, and Lighting can be turned on for a specified time, using a rule. When you need a timing function, it is typical to use an unused Output (one having no associated hardware) for this purpose.
 
How do you use these?

TIMERS. Sandpiper's "timer" example is a typical solution to your garage door requirement. Note that Output 100 in the example would not be a physical output -- and that's the whole point. The M1 provides for 208 Outputs but, in general, our residential systems have considerably less than 100 Outputs installed. The M1 Outputs that have no installed hardware are still available in rules to be used as timers, or as simple on/off signals. When you use Outputs in this way, be sure to keep records of their functions so you don't mistakenly use them for more than one purpose simultaneously.

COUNTERS. Two examples.

1. Measuring the run time of an attic fan.
[codebox]WHENEVER EVERY 1 MINUTE
AND AtticFanSensor (Zn 12) IS NOT SECURE
THEN ADD 1 TO AttFanRunTime (Counter 8)[/codebox]

Counter 8 has the number of minutes that the fan was on. Unfortunately you cannot inspect Counters directly from a keypad, but with rules you can show the value in the display. Also, your HA software can retrieve the values.

2. Perform a task 3 times only. Generically:
- Set a Counter to the value of 3
- Whenever the task runs, decrement the Counter by 1
- Have the task include an "AND" function that checks for the Counter to be greater than zero.

On the fourth attempt, the task will be suppressed because this AND will fail.
 
OK so Im still a little confused, SORRY!. You state that the M1 doesnt have timers per se. If not then what are the things labeled "timers" in RP? I guess I need to see more examples of rules to completely understand. I know ELK had a newsletter or something that had a bunch of rules listed to do things, but I cant seem to find them anymore. I know this will be one of those things like, OH I GET IT NOW, once I completely understand. I have searched the ELK literature for more laymans explinations, but have come up with nothing. Sorry to be a dumb a**, but Im just not getting it. I think I understand the output thing, but would never have thought to use an output as a timer :(
Thanks for any help
 
what are the things labeled "timers" in RP?
Where do you see "timers" in RP?

I have searched the ELK literature for more laymans explinations, but have come up with nothing.
Try spending some time exploring the rules on your own, to see what options are available. Investigate the various choices in the WHENEVER, AND and THEN menus. You don't have to save your exploratory rules, but it is probably the best learning experience.

I think I understand the output thing, but would never have thought to use an output as a timer
Don't be discouraged. Maybe this is a "programmer's trick," and it does seem strange. Although it is not intuitive, this is why we share.
 
Timers!

Go to RP > AUTOMATION > CUSTOM SETTINGS > click the box under the TYPE column
0=Number
1=Timer
2=Time Of Day

Is this not what it seems?
 
Timers!

Go to RP > AUTOMATION > CUSTOM SETTINGS > click the box under the TYPE column
0=Number
1=Timer
2=Time Of Day

Is this not what it seems?
These are not actually "timers;" they are values that you can use in rules for timing, with the same result as having the time value within the rule itself.

See: THEN > Turn Output On/Off > For Custom Setting Time

But it comes down to the same thing -- you control lighting and output timings based on settings in the rules, whether the time amount is embedded in the rule itself, or taken from a Custom Setting. The only way I know to understand this is to spend time with the rules options.
 
Thanks for the feedback. Im not sure I can just "play" with rules, if I dont understand what Im playing with(that doesnt sound right).
 
Anyone know why this rule wont work?

WHENEVER GARAGE DOOR [ZN28] BECOMES NOT SECURE
AND MAIN HOUSE [AREA1] ARM STATE = ARMED
THEN SET GARAGE DOOR [COUNTER1] TO 120

WHENEVER EVERY 1 SECONDS
AND GARAGE DOOR [ZONE28] IS NOT SECURE
THE SUBTRACT 1 FROM GARAGE DOOR [COUNTER1]

WHENEVER GARAGE DOOR [COUNTER1] CHANGES TO 0
AND GARAGE DOOR [ZONE28] IS NOT SECURE
THEN SEND EMAIL MESSAGE 8 TO XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Anyone know why this rule wont work?

WHENEVER GARAGE DOOR [ZN28] BECOMES NOT SECURE
AND MAIN HOUSE [AREA1] ARM STATE = ARMED
THEN SET GARAGE DOOR [COUNTER1] TO 120

WHENEVER EVERY 1 SECONDS
AND GARAGE DOOR [ZONE28] IS NOT SECURE
THE SUBTRACT 1 FROM GARAGE DOOR [COUNTER1]

WHENEVER GARAGE DOOR [COUNTER1] CHANGES TO 0
AND GARAGE DOOR [ZONE28] IS NOT SECURE
THEN SEND EMAIL MESSAGE 8 TO XXXXXXXXXXXXXXXXXXXXXXXXXX

As mentioned above you don't want to use counters as timers, you want to use phantom outputs.

WHENEVER GARAGE DOOR [ZN28] BECOMES NOT SECURE
AND MAIN HOUSE [AREA1] ARM STATE = ARMED
THEN TURN OUTPUT 100 ON FOR 2 MINS

WHENEVER OUTPUT 100 STATE IS TURNED OFF
AND GARAGE DOOR [ZONE28] IS NOT SECURE
THEN SEND EMAIL MESSAGE 8 TO XXXXXXXXXXXXXXXXXXXXXXXXX
 
The funny thing is, this rule was given to me from an ELK technician.
Just found out the rule does work, just backwards. If the house has been armed, and the garage door is opened, then it sends an email 2 minutes after the door has been opened.
I want it to send an email if the door has been left open 2 minutes after the initial arming.
I will try the output thing, it just doesnt seem to make sense?
 
The funny thing is, this rule was given to me from an ELK technician.
Just found out the rule does work, just backwards. If the house has been armed, and the garage door is opened, then it sends an email 2 minutes after the door has been opened.
I want it to send an email if the door has been left open 2 minutes after the initial arming.
I will try the output thing, it just doesnt seem to make sense?

Yes, the system must be armed before the garage door is opened with the rule written this way, as the event you are triggering on is the garage door opening. The rule I use actually just triggers the timer on armed away, irregardless of the state of the garage door at that time. Using the output is more efficient than using the counter as the system does not have to check every second. You also might want to just tell the system to close the garage door when the output timer expires on top of sending the email.

WHENEVER MAIN HOUSE [AREA1] ARM STATE = ARMED
THEN TURN OUTPUT 100 ON FOR 2 MINS

WHENEVER OUTPUT 100 STATE IS TURNED OFF
AND GARAGE DOOR [ZONE28] IS NOT SECURE
THEN SEND EMAIL MESSAGE 8 TO XXXXXXXXXXXXXXXXXXXXXXXXX
 
The funny thing is, this rule was given to me from an ELK technician.
Just found out the rule does work, just backwards. If the house has been armed, and the garage door is opened, then it sends an email 2 minutes after the door has been opened.
I want it to send an email if the door has been left open 2 minutes after the initial arming.
I will try the output thing, it just doesnt seem to make sense?
The Elk technician probably did not fully understand what you wanted. Try this:

WHENEVER MAIN HOUSE [AREA1] ARM STATE BECOMES ARMED
AND GARAGE DOOR [ZONE28] IS NOT SECURE
THEN SET GARAGE DOOR [COUNTER1] TO 120

WHENEVER EVERY 1 SECONDS
AND GARAGE DOOR [ZONE28] IS NOT SECURE
THEN SUBTRACT 1 FROM GARAGE DOOR [COUNTER1]

WHENEVER GARAGE DOOR [COUNTER1] CHANGES TO 0
AND GARAGE DOOR [ZONE28] IS NOT SECURE
THEN SEND EMAIL MESSAGE 8 TO XXXXXXXXXXXXXXXXXXXXXXXXXX

This should work the same as the rule with the phantom output that I posted earlier.
 
Thats the same rule I was using, and it doesnt work properly. I ended up using the phantom output method, and it works perfectly. Oh well! So when would you use a counter or a timer?
 
Back
Top