Motion Sensor (Security light) with latch
As asked by CPRail1, how do we make a motion controlled light that can be latched on? http://forum.universal-devices.com/viewtopic.php?f=27&t=11795
Here's how. While there may be several ways to do this, first let's confirm a few things in the Motion Sensor, Item #2842-222. Note that this code can be similarly used with the Wireless Open/Close Sensor Item# 2843-222.
Settings; [x] Sensing Mode [ ] On Only Mode [x] Night mode
Jumpers; The only one that matters is #5 1 [Open] Sensitivity 2 [Open] Disable LED 3 [Open] Night-Only mode 4 [Open] On-Only mode 5 [Closed] Remote management
First, I got mine working with a program.
Motion Detection; If Control 'Motion-Sensor' is switched On Then Set Scene 'MotionResponder On Wait 10 seconds Set Scene 'MotionResponder Off Else - No Actions - (To add one, press 'Action')
Now we'll break it up so that a variable (controlled by a button) determines whether the light stays or times out.
Here are the rules;
- If person has moved into the area, the light will turn on.
- If a switch is turned on when it is already on, stay on. To do this, set a variable [Ignore_Motion_Detection] to 1.
- When the motion program times out, check the variable to see whether to leave the light on or not. Then reset the variable.
This takes three programs. One to watch the switch, one for motion startup rules and one for motion timeout rules.
First, make a variable "Ignore_Motion_Detection". Leave it zero, it will be modified under program control.
Program 1: Watch the switch
Motion_Fade_Disable; If ;If switch is turned on WHILE the light is already on... Control 'Security Switch' is switched On And Status 'Security Switch' is not Off Then $Ignore_Motion_Detection = 1 Else - No Actions - (To add one, press 'Action')
Program 2: Start motion activity
Motion Detection Entry; If ;What to do when motion is detected Control 'Security Switch' is switched On Then Set Scene 'Security Light' On Wait 3 minutes Run Program 'Motion Detection Exit' (If) Else - No Actions - (To add one, press 'Action')
Program 3: Start motion cleanup
Motion Detection Exit; If $Ignore_Motion_Detection is 0 Then Set Scene 'Security Light' Off Else ;Leave light on, but reset the flag so it turns off next time. $Ignore_Motion_Detection = 0
Please let me know if you find any anomalies or can improve functionality.