Rules Help - motion sensor to turn lights off after x

taskman

Member
Hi,

I have been looking around for quite some time now so it is time to ask.

Using Insteon w/ISY 99i and Elk M1 Gold

Trying to set a rule or rules so if anyone left a light on and there is nobody in that room, the lights should be turned off.
If there is motion, then it should wait until no motion is sensed, then maybe wait a few minutes and turn the light(s) off.

What will it look like if there are 4 sets of lights, each with (3-way insteons) (so 2 switches) and 1 with 3 switches.
I have a scene setup for the entire room so I was thinking to make the off action on the scene

I was thinking it should look at the motion every x minutes and if motion is sensed, return the clock back to start and start ticking down.
Of course this would only be effective if the (any) lights are on.

Thanks for any help
 
It has been long time since I did something similar, but lets try.

In logical terms, you should have a rule that whenever the light from Room A is ON, and Sensor 1 is triggered, you turn an output On (logical output) for X minutes. If the output is on already, the effect is that the count down timer will be reset to X minutes again. You need to create another copy of this rule for each sensor in Room A.

Then you have another rule that whenever your output is turned Off and the light in Room A is On, the turn the light in Room A Off.
 
One way to do this with the ELK(in shorthand). Output Z can be turned on/off manually to use a longer time(60 min) for the case where you are using the room and motionless. I also added a section that will enable the longer timer if you turn the lights on manually soon after they are turned off by the timer.

Whenever (motion) is insecure (restart the longer timer if Z is on and motion)
and output Z is on
Then turn output X on for 60min, restart if running

Whenever (motion) is insecure (restart the shorter timer if Z is off and motion)
and output Z if off
then turn output X on for 10min, restart if running

Whenever output X turns off (when X expires, turn off, start 30 sec timer for manual override)
then turn light off
turn output Y on for 30 sec

Whenever (X lighting) is turned on (manually trigger 6hr of longer time if turning light on within 30 sec of auto-off)
and output Y is on
and output Z is off
then turn on output Z for 6 hours

Whenever (X lighting) is turned on (start the longer timer if Z is on)
and output Z is on
then turn on output X for 60min

Whenever (X lighting) is turned on (start the shorter timer if Z is off)
and output Z is off
then turn on output X for 10min


EDIT: Writing more complete rules. Untested, but closer to a working version
 
Have you tried the rules in this post?

It is a simple idea:

1) When you sense motion, start a timer. Turn off the lights when the timer expires. Unless you have other rules dealing with an off event, no need to worry if the lights are already off

2) Some way to override if you are in the room. Doesn't really matter what you want to do. Maybe if you turn the lights back on manually within 30 sec of the auto-off, etc. Just something like that.

The rules I posted aren't actually rules, they are a concept I created for this thread. The actual rules depend on a specific implementation. It was just an example of a logical thought. Looking again I didn't really write all the items I intended to show, but you should get the general idea. I was assuming the original poster can customize it to his particular situation or he will reply if he needs an exact set of rules written. I'll modify it to actually work.
 
I was curious to learn if Taskman had tried the rules in the other post. It does what he had requested.
 
One way to do this with the ELK(in shorthand). Output Z can be turned on/off manually to use a longer time(60 min) for the case where you are using the room and motionless. I also added a section that will enable the longer timer if you turn the lights on manually soon after they are turned off by the timer.

Whenever (motion) is insecure (restart the longer timer if Z is on and motion)
and output Z is on
Then turn output X on for 60min, restart if running

Whenever (motion) is insecure (restart the shorter timer if Z is off and motion)
and output Z if off
then turn output X on for 10min, restart if running

Whenever output X turns off (when X expires, turn off, start 30 sec timer for manual override)
then turn light off
turn output Y on for 30 sec

Whenever (X lighting) is turned on (manually trigger 6hr of longer time if turning light on within 30 sec of auto-off)
and output Y is on
and output Z is off
then turn on output Z for 6 hours

Whenever (X lighting) is turned on (start the longer timer if Z is on)
and output Z is on
then turn on output X for 60min

Whenever (X lighting) is turned on (start the shorter timer if Z is off)
and output Z is off
then turn on output X for 10min


EDIT: Writing more complete rules. Untested, but closer to a working version


Hi,

That was a great help.....

For now I have the one room with 4 sets of lights with 3-ways on each and combined as an ALL Room scene.
It is easy to activate the ALL for the Off. Is there a way to write it so if any of the lights are on, it would ignore the output so no counting would start until one of the switches is left on after x minutes?

Thanks
 
One way to do this with the ELK(in shorthand). Output Z can be turned on/off manually to use a longer time(60 min) for the case where you are using the room and motionless. I also added a section that will enable the longer timer if you turn the lights on manually soon after they are turned off by the timer.

Whenever (motion) is insecure (restart the longer timer if Z is on and motion)
and output Z is on
Then turn output X on for 60min, restart if running

Whenever (motion) is insecure (restart the shorter timer if Z is off and motion)
and output Z if off
then turn output X on for 10min, restart if running

Whenever output X turns off (when X expires, turn off, start 30 sec timer for manual override)
then turn light off
turn output Y on for 30 sec

Whenever (X lighting) is turned on (manually trigger 6hr of longer time if turning light on within 30 sec of auto-off)
and output Y is on
and output Z is off
then turn on output Z for 6 hours

Whenever (X lighting) is turned on (start the longer timer if Z is on)
and output Z is on
then turn on output X for 60min

Whenever (X lighting) is turned on (start the shorter timer if Z is off)
and output Z is off
then turn on output X for 10min


EDIT: Writing more complete rules. Untested, but closer to a working version

Okay so as I am reading this I adapted this rule to my scenario writing it out in rp text as well, but I am guess I am not seeing something (or it wasn't included). This rule set deals only with shutting off the light after a variable time limit with a manual override mode, but does not deal with turning on the light. Is this correct?

I am trying to create what you have here with the ability to also activate the light at various times of the early evening/night/early morning when motion is detected in the room. The problem I am having is that for whatever reason my coding does not allow the light to stay on even when motion is constantly detected. I have the timer set to reset when the sensor becomes not secure, but it doesn't seem to work.

Here is your coding updated with my zones/outputs and written in RP text:
WHENEVER Living R. Motion (Zn 3) BECOMES NOT SECURE
AND Output 40 STATE IS ON
THEN TURN Output 20 ON FOR 60 MINS, RESTART TIMER IF RUNNING

WHENEVER Living R. Motion (Zn 3) BECOMES NOT SECURE
AND Output 40 STATE IS OFF
THEN TURN Output 20 ON FOR 10 MINS, RESTART TIMER IF RUNNING

WHENEVER Output 20 STATE IS TURNED OFF
THEN SET Living Room - C (10 (A10)) OFF, FADE RATE = 3
THEN TURN Output 30 ON FOR 30 SECS

WHENEVER Living Room - C (10 (A10)) IS TURNED ON BY SOME EXTERNAL DEVICE
AND Output 30 STATE IS ON
AND Output 40 STATE IS OFF
THEN TURN Output 40 ON FOR 6 HRS

WHENEVER Living Room - C (10 (A10)) IS TURNED ON BY SOME EXTERNAL DEVICE
AND Output 40 STATE IS ON
THEN TURN Output 20 ON FOR 60 MINS

WHENEVER Living Room - C (10 (A10)) IS TURNED ON BY SOME EXTERNAL DEVICE
AND Output 40 STATE IS OFF
THEN TURN Output 20 ON FOR 10 MINS



And here is my current coding (without your stuff added yet)
WHENEVER Living R. Motion (Zn 3) BECOMES NOT SECURE
AND THE TIME IS LATER THAN 20 MINUTES BEFORE SUNSET
AND TIME OF DAY IS EARLIER THAN 10:00 PM
AND Living Room - C [10 (A10)] IS SET AT A LEVEL LESS THAN 25%
THEN TURN Output 20 ON FOR 5 MINS, RESTART TIMER IF RUNNING
THEN SET Living Room - C [10 (A10)] TO 75% BRIGHT, FADE RATE = 3

WHENEVER Living R. Motion (Zn 3) BECOMES NOT SECURE
AND TIME OF DAY IS LATER THAN 10:00 PM
AND Living Room - C [10 (A10)] IS SET AT A LEVEL LESS THAN 25%
THEN TURN Output 20 ON FOR 5 MINS, RESTART TIMER IF RUNNING
THEN SET Living Room - C [10 (A10)] TO 25% BRIGHT, FADE RATE = 3

WHENEVER Living R. Motion (Zn 3) BECOMES NOT SECURE
AND TIME OF DAY IS EARLIER THAN 4:00 AM
AND Living Room - C [10 (A10)] IS SET AT A LEVEL LESS THAN 25%
THEN TURN Output 20 ON FOR 5 MINS, RESTART TIMER IF RUNNING
THEN SET Living Room - C [10 (A10)] TO 25% BRIGHT, FADE RATE = 3

WHENEVER Living R. Motion (Zn 3) BECOMES NOT SECURE
AND TIME OF DAY IS LATER THAN 4:00 AM
AND THE TIME IS EARLIER THAN AT SUNRISE
AND Living Room - C [10 (A10)] IS SET AT A LEVEL LESS THAN 25%
THEN TURN Output 20 ON FOR 5 MINS, RESTART TIMER IF RUNNING
THEN SET Living Room - C [10 (A10)] TO 40% BRIGHT, FADE RATE = 3

WHENEVER Living R. Motion (Zn 3) BECOMES NOT SECURE
AND THE TIME IS LATER THAN AT SUNRISE
AND TIME OF DAY IS EARLIER THAN 10:00 PM
THEN TURN Output 20 ON FOR 10 MINS, RESTART TIMER IF RUNNING

WHENEVER Output 20 STATE IS TURNED OFF
THEN TURN Living Room - C [10 (A10)] OFF, FADE RATE = 3


Any help putting these together would be appreciated. Thank you
 
Well I think I have it solved. This utilizes seems to correctly control the lights when and where I want. If anyone has any suggestions, please let me know. Here is the coding that I have come up with:

WHENEVER Living R. Motion (Zn 3) BECOMES NOT SECURE
AND Output 90 STATE IS ON
THEN TURN Output 70 ON FOR 30 MINS, RESTART TIMER IF RUNNING

WHENEVER Living R. Motion (Zn 3) BECOMES NOT SECURE
AND Output 90 STATE IS OFF
THEN TURN Output 70 ON FOR 10 MINS, RESTART TIMER IF RUNNING

WHENEVER Output 70 STATE IS TURNED ON
AND TIME OF DAY IS EARLIER THAN 4:00 AM
THEN SET Living R - C [10 (A10)] TO 25% BRIGHT, FADE RATE = 3

WHENEVER Output 70 STATE IS TURNED ON
AND TIME OF DAY IS LATER THAN 4:00 AM
AND THE TIME IS EARLIER THAN AT SUNRISE
THEN SET Living R - C [10 (A10)] TO 40% BRIGHT, FADE RATE = 3

WHENEVER Output 70 STATE IS TURNED ON
AND THE TIME IS LATER THAN 20 MINUTES BEFORE SUNSET
AND TIME OF DAY IS EARLIER THAN 10:00 PM
THEN SET Living R - C [10 (A10)] TO 75% BRIGHT, FADE RATE = 3

WHENEVER Output 70 STATE IS TURNED ON
AND TIME OF DAY IS LATER THAN 10:00 PM
THEN SET Living R - C [10 (A10)] TO 25% BRIGHT, FADE RATE = 3

WHENEVER Output 70 STATE IS TURNED OFF
THEN SET Living R - C [10 (A10)] OFF, FADE RATE = 3
THEN TURN Output 80 ON FOR 30 SECS

WHENEVER Living R - C [10 (A10)] IS TURNED ON BY SOME EXTERNAL DEVICE
AND Output 80 STATE IS ON
AND Output 90 STATE IS OFF
THEN TURN Output 90 ON FOR 30 MINS, RESTART TIMER IF RUNNING

WHENEVER Living R - C [10 (A10)] IS TURNED ON BY SOME EXTERNAL DEVICE
AND Output 80 STATE IS OFF
AND Output 90 STATE IS ON
THEN TURN Output 70 ON FOR 20 MINS, RESTART TIMER IF RUNNING

WHENEVER Living R - C [10 (A10)] IS TURNED ON BY SOME EXTERNAL DEVICE
AND Output 80 STATE IS OFF
AND Output 90 STATE IS OFF
THEN TURN Output 70 ON FOR 10 MINS, RESTART TIMER IF RUNNING

WHENEVER Living R - C [10 (A10)] IS TURNED OFF BY SOME EXTERNAL DEVICE
THEN TURN OUTPUT 90 OFF
 
Back
Top