This object is in archive! 

Rule to turn off light when no motion - after light has been turned on by wall switch

Thomas shared this question 8 years ago
Need Answer

Hi,


I am trying to build a rule that turns off the light when no motion in the room after 5 min.


The light is turned on manually by a Z-Wave wall switch - and not by the motion sensor. So the motion sensor are only used to "keep light alive".


Can anybody help me here?


Thomas

Replies (4)

photo
2

Hi Thomas,

Maybe this rule will help you :) It's not the same, but it keeps alive a virtual switch for one hour and reverts back if no movement has been detected.


Maybe if you replace WHEN FIBARO ANY with WHEN WALLSWITCH ANY and IF FIBARO MOTION with IF WALLSWITCH ON. This rule is timerestricted but that can be removed.

c12f3eff5af83d1d59fd97d84566f027

photo
1

Hi Thomas,

I have done pretty much the same thing: Lights go on by a switch (in my case, a door sensor), and stays on for X minutes after last movement.


I'll try to explain the basics, and try to upload rules later. Here goes:


Firstly, you'll need a CountDown timer, which can be changed by external factors. Start by creating a WHEN using a Schedule which is set to Every Minute.


Inside this CountDown timer, you need to have a variable, e.g. "TimerMinutes". You'll want to initialize the variable, and have an initial IF TimerMinutes <= 1, then SET VARIABLE TimerMinutes to 1. As the variable will have no value after a boot/system restart, this sets the variable to known state, allowing us to use the Decrement function later..

Next, you have another IF TimerMinutes = 2, you SET TimerMinutes to 1, and switch off the lights.

The last IF will test IF TimerMinutes > 2 then DECREMENT TimerMinutes.


The next rule(s) will be used to turn on the light and set the length of the timer.

WHEN <switch> pressed (or in my case, DoorSwitch activated), SET variable TimeMinutes to 4 and switch on the lights.

(This will switch OFF the light after 2 minutes if there is no more movement)


Lastly, you'll want a rule for the motion sensor, where you SET VARIABLE MotionTimer to 7, thus making sure the light isn't switched OFF by the Timer rule for 5 minutes.


The effect of the above mentioned rules, is that the motion sensor should NOT turn on the light, but that if the light is turned on using a Switch, it will make sure the light is turned off, but only after there is no more movemement.


Hope this helps.

Best regards,

Robert

photo
1

I would suggest you to

split into two rules. Why? I think the WHEN statement for that would have to be

something like;


WHEN Motion Sensor Any


JOIN


IF Motion AND Switch On

THEN


SET intensity to 100


ELSE


Wait 180 seconds


SET Intensity to 0


Which could be tricky since the switch ON and Motion would have to be

active at the same time in order to turn ON the light. See attached rules as

suggestion.

photo
1

Thomas,


I have enclosed the three rules (I'm doing a lot more in the rules than I'm showing here; I've removed the extra stuff for clarity). My reason for breaking up the desired functionality into a separate Countdown Timer and separate controls to change the timeout value, is that this approach opens for more versatility.

Leave a Comment
 
Attach a file