Help with light automation based on motion time


#1

1) Give a description of the problem
Im attempting to automation the living room lights, but not sure where to start with how I want it to work. I would like for the lights to be able to turn on right when motion changes to active for the sensor, but if the motion was active for less than 1 minute turn off the light when motion goes inactive. If the motion was active for longer then 1 minute I would like it to keep the light on for 15 minutes then turn off if no motion. Would anyone know the best way to go about doing this?


#2

I’m sure @WCmore has a more elegant solution but I think you can do something like

If motion sensor changes to active
then
  turn on the lights
end if

if motion sensor changes to inactive
then
  if previousAge(motion sensor:motion)<60 seconds
  then
    turn off
  end if
end if

if motion sensor stays inactive for 15 minutes
then
  turn off
endif

#3

I would normally use two pistons to control this… One to just focus on the 15 minute timer, and one to regulate the lights…

That being said, the following should be a decent structure to start with:


Note:

With this method, if you are active at the 15 minute mark, you might extend the lights another 15 minutes…


Motion detection with different motion duration