Turn on lights - 2 Contact Sensors and/or Motion

light
motion

#1

1) Give a description of the problem
I am trying to wrap my head around how to turn on two cree bulbs in my basement stairs if any of the following conditions are true
Contact Sensor 1 - Open
Contact Sensor 2 - Open
or
Motion Sensor senses motion

Then Turn off if the Motion sensor does not report motion for X minutes

Example - I may open the basement door simply to check something on the stairs - turn on light with door open, close door. If nothing happens for X minutes turn off lights
I may go down into the basement open door turn on lights, and close the door behind me and putz around in the basement which will trigger motion sensor - keep the light on until motion is not reported for X minutes.
I may open the exterior basement door and would want the same behavior

I am not sure exactly where to start - hoping someone else has done similar and has an example. I did look in the examples topic - unless I missed it I didnt find one :frowning:


#2

heres a quick snippet. this may also help you flush out more of the use case as you start with this version.

if any of contact sensor 1, contact sensor 2 contact changes to open
   or
   motion sensor motion changes to active
   with cree 1 and cree 2
      turn on
    end with
end if
if motion sensor motion changes to inactive
   with cree 1 and cree 2 (set TCP to never)
      wait 1 minute
      turn off
   end with
end if

#3

I will give that a shot tonight when I get back to the house … THANKS :beer:


#4

:tropical_drink:


#5

So here we go with what I ended up with … made a bit of a tweak - the light stays on until both doors are closed and motion stops for 2m

@bangali Thanks again for helping my mental (case) block!


#6

sure thing. only thing i would recommend is change the first changes to to is

otherwise you are mixing conditions and triggers and this piston under certain conditions will not do what you expect it to. :slight_smile: