Lighting on with motion


#1

How do I setup a piston to turn on a light when motion is detected and if motion is detected for one minute or longer to leave the light on for 5 minutes, if motion is still detected leave the light on if not turn it off


#2

If you search around for lighting pistons you will find many examples but what you are looking for is pretty simple:

If motion sensor changes to active        <-- trigger
then
  with light
     turn on
  end with
end if
if motion sensor stays inactive for 5 minutes       <-- trigger
then
  with light
    turn off
  end with
end if

#3

Switching the delays in the middle of processing is not so easy with motion sensors. You could be in a room vacuuming (for example), and there will still be moments when the sensor is inactive.

In a nutshell, the likelihood that the first minute will “stay active for the entire duration” is very slim.
(it depends on the sensitivity & placement of your sensor, as well as the device handler’s timeout period)

I think you will have better success if you think of an alternative way to switch the delays to a longer duration. (for example, when the door is closed, as seen here)