Jump to content
C4 Forums | Control4

Motion,timer, and lights trigger


Recommended Posts

I have a motion detector in my master bedroom. I want to program automatic bathroom lights: Between 9pm and 7am if motion is detected in Master Bed then turn on bath night scene (lights on at 10%). However if the light is already on Bath scene (full power) then stop as someone is getting ready for a night shift. That person will use the key pad dimmer to turn off the lights. If the scene gets triggered then I only want it active for 15 min. What I'm having a hard time figuring out is if the person finishes early, they will trigger the motion as they go back to bed and the scene will stay on longer then desired or if my wife gets up and it waiting to use the bathroom then it will trigger another motion sense and then it will trigger a 3rd motion sense as I go back to bed then a 4th when she goes back. What is the best way to program that part. We also have a motion soon to be occupancy in the private water closet within the bathroom and if I'm reading then I don't want everything turning off. There is no motion detector in the bathroom proper. 

Is AND or OR programming allowed in C4?

When motion in Master Bed detected

if between 9pm and 7am

     if Master Bath scene active {full light are on stop programming} 

          stop

     if master bath night scene is not activated

          turn on master bath night scene

          turn on Master bath night timer 15min

          if Water Closet motion triggered (or occupancy true)

               reset Master bath night timer 15min {will this reset and restart the timer or just reset the timer to 15?}

          when Master bath night timer expires

          turn  off master bath light

    if master bath night scene is activated {from previous master bed motion and timer should be already running}

               if Water Closet motion triggered (or occupancy true)

               reset Master bath night timer 15min {will this reset and restart the timer or just reset the timer to 15?}

          when Master bath night timer expires

          turn  off master bath light

I think where my coding fails is if we have multiple motion events within the 15min timer but the second person just goes in to brush teeth and doesn't enter the WC, that person will have less time. I don't think I can have it so it deciphers whether the second motion is returning to bed or second person walking to bathroom. 

If someone has a better idea or can help I would appreciate it

Link to comment
Share on other sites


The attached script should work.  I'm not 100% positive, as I haven't tested it live, but I don't see why it wouldn't.  It at least gets you at least 90% of the way there.  There are two separate scrips you'll need - one for "when the motion is sensed in the bedroom" and one for "when the timer expires".

Let me know how it goes

Note: Motion Sensor Open means it is sensing motion and Motion Sensor Closed means it is not.

bathroom timer.jpg

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.