How would I do: while there is motion,keep lights on?


#1

1) Give a description of the problem
Whats an efficient routine to monitor a motion sensor and if there is still motion within a couple of minutes, keep the lights on.
As a user I want the light to turn on if I enter the kitchen at night for 10 minutes and reset timer to 10 min if there is still motion within these 10 minutes. then turn off

How would I best do that ? eg with if, while or for loop?

thanks chris


#2

I have found that just putting the wait in the turn off trigger is enough to get the job done. For me when the trigger on happens it runs the piston but then if there is a re-trigger in that wait period it starts the timer over again. See below for how mine works for me. Some additional conditions that massage it into when I want it to run but otherwise the concept is there.


#3

I am a fan of this method:

IF Sensor's motion changes to on
    Then Turn on light
END IF

IF Sensor's motion stays off for 10 minutes
    Then Turn off light
END IF