Can an ELK Rule Cancel Another ELK Rule?

slowmo

Member
Can an Elk Rule Cancel another ELK Rule?

Is there a way to cancel a rule through a command such an OUTPUT
For example:

WHENEVER MOTION DOWNSTAIRS HALL
AND IT'S DARK
THEN TURN ON OFFICE LIGHT FOR 3 MINUTES

This rule works because it turns on my office light just long enough so I can run in and get something and run back out. If you are asking "why", the answer is the light switch is behind a cabinet, so it's just not about being lazy, although that factored into the decision.


If I am staying in my office longer than 3 minutes I will use the ELKRM to turn on the office light. However, if anyone else activates the DOWNSTAIRS MOTION Sensor the above rule will turn off the office light after 3 minutes. I've used an OUTPUT counter to add time but eventually the same thing happens.

Thus, is there a way to write a rule that would cancel out another rule? Can this "hypothetical" rule become activated by another OUTPUT or FKEY or UPB Switch?

Thanks,

Scott
 
It's late so I'm not of the right state of mind to work this through 100%, but the short answer is Yes. You'll use outputs to help make it happen.

Something along the lines of Whenever Motion Downstairs Hall AND It's Dark AND Output 55 is off THEN turn on Office Light for 3 Minutes. Then, when you manually turn on the office light, you can do a task like Turn On Output 55. Along with a rule that says "Whenever Output 55 Turns on, then turn on office light".

Thinking further, you'd rather do "Whenever motion downstairs hall AND it's dark, then turn on output 56 for 3 minutes. Whenever Output 56 Turns Of AND Output 55 is OFF then Turn off office Light. Also, Whenever Output 56 Turns On, Turn On Office Light.
And for your override, Whenever Task "Turn On Office Light" is run, Turn On Output 55 AND turn on office light. Whenever Task TurnOffOfficeLight is run, turn off Output 55 and turn off office light.

There's some trial and error here, but that's close... The idea is to set a flag for when you want the light to stay on, then have the rule that turns the light off automatically respect that flag.
 
Using (virtual) outputs is what I do as well, I basically treat them as BOOLEAN variables (in case you are familiar with programming in general).
 
Like what those guys said.

The fundamental thing for you is keeping your rules that turn the light on separate from those that turn the light off.

Once a rule starts to run, I don't know of a way to end it, so using a rule that states "turn light on for x minutes" will leave you stuck with that result once it starts running.

Lots of people use outputs as variables (on/off) but it can often times work better to use counters. With counters you don't just get a binary 0/1(on/off) but any number you want. It can allow the use of just one variable (the counter) instead of multiple variables (outputs) to achieve the same result.
 
Dan,
Can you provide me with more details?

Work2Play and Lou,
I will try your suggestions, I need to digest them first and with a little luck and random key hitting I should get it to work.

Thanks all,
Scott
 
Dan is talking about what I was talking about. Turning an output on is like "1" and turning it off is like "0". It is a roundabout way of doing binary code. A rule sets it to "on" or "off" based on something like pushing a button or detecting motion. A second rule references that state (on or off) in its "whenever" section to determine whether it will move onto the "then" section or not.
 
I don't own an Elk yet so I'm just guessing here...but... couldn't your rule check to see if the light is off. The rule only turns on the light (for 3 minutes) if it is already off? That way when you turn the light on via ELKRM and someone walks into the room, the rule sees that the light is on and does nothing.
 
Lots of people use outputs as variables (on/off) but it can often times work better to use counters. . .
True, but a good reason to use outputs is that you can directly set them from a keypad. If you use outputs in the range below 64, you can give them descriptive names, e.g. "Lights Out Inhibit" or "Announce Entries".
 
Back
Top