Sixburg Posted September 19, 2012 Posted September 19, 2012 All, I thought I had this figured out, but evidently I do not. I have an MS (2842) to activate lights in my kitchen. The MS and switch are linked via scene. I have a SIMPLE pair of body and condition programs to control activities. The cond program checks for activity on the MS: Kitchen Cond 1 If Control 'Main Floor / Kitchen Motion-Sensor' is switched On Then $Kitchen_State = 1 Else - No Actions - (To add one, press 'Action') Kitchen Body 1 If $Kitchen_State is 1 Then Wait 1 minute $Kitchen_State = 0 Else - No Actions - (To add one, press 'Action') This works just fine in terms of being able to track the state of the "Kitchen" and the MS turns on the light. However, it doesn't seem like continued motion seen by the MS is causing the COND program to re-evaluate. I would expect that... - $Kitchen_State would stay = 1 (and it does) - The BODY program would reevaluate the IF as TRUE (seems to be since activity on Kitchen Body is "running then" and status is True) - And that the WAIT statement would restart the 1 minute countdown each time the MS registered motion. What is happening is the light goes out and comes right back on even if I'm waving my hand in front of the MS. What gives? Thanks! -Lloyd
LeeG Posted September 19, 2012 Posted September 19, 2012 Unless the Motion Sensor is in Occupancy mode (Sensing mode) it will send only one Motion On command. The timeout interval has to expire before the Motion Sensor will send another Motion On command. In Occupancy mode (Sensing mode) the MS sends a Motion On command each time motion is sensed. Use the Red LED in the Motion Sensor to determine when it has detected motion. Although it does not send additional Motion On commands unless in Occupancy mode the timeout should be extended for each additional motion detected. That aspect of operation is all within the Motion Sensor itself. The ISY has no control over the extension of the timeout value.
Sixburg Posted September 19, 2012 Author Posted September 19, 2012 Hi Lee: The MS is in occupancy mode, sending On commands only, and has a time out of 30 seconds. I set the timeout at it's lowest so that it would send On commands at the fastest possible interval if it senses motion. By watching the LED I can see that the MS is registering movement and presumably sending additional On commands. By experiment I believe that my programs don't work because the Wait statement needs to be in the same program as the IF statement that tests for motion. In other words: If control ms is on then wait x mins set scene off else (empty) The additional On commands from the MS will trigger a test of this program and restart the wait statement. What I had done previously, which did not work, was to have 2 programs: one to test for the On condition of the MS and set a state variable flag =1, and an 2nd to test for that flag=1 and start the wait. It seems that even if motion is sensed the flag stays =1 and the wait statement just keeps on going without restarting. Let me know if I've diagnosed this correctly. Seems to work in testing. I'd also like to know if I should change the timeout on the MS. I assume I'm using this function properly given my programming set up. Thanks! -Lloyd
Xathros Posted September 19, 2012 Posted September 19, 2012 Lloyd- You are correct. I'm assuming your flag variable is a state variable. State vars can trigger an if and restart a wait but it has to change value for it to trigger. Simply re-setting the same value won't cause the program to re-trigger. You could test for s.Var > 0 in your second program and in your first program say s.Var =+1 on motion. This would give the added advantage of knowing if someone was sticking around (higher value) or just passing through (low value) kinda... -Xathros
LeeG Posted September 19, 2012 Posted September 19, 2012 The current implementation is fine. In this case you want the additional On commands to trigger the Program again, restarting the Wait with a new interval. In Occupancy mode and On Only commands the timeout interval should not matter. Each motion sensed should result in a Motion On message with the Program being triggered. The timeout value should be at its lowest value as it can affect how quickly Dusk/Dawn is identified but it should not affect Occupancy mode motion messages. The Event Viewer at Level 3 can be used to verify that each motion detected results in a Motion On message. From memory the State variable works like If Status. The variable value has to change to trigger the Program. Like pressing a device ON paddle twice in a row. The If Status triggers only once since the Status did not change with the second ON. The old technique should have worked using +=1 so the variable value would have been incremented rather than sitting a 1.
Sixburg Posted September 21, 2012 Author Posted September 21, 2012 Everyone, thanks for the inputs. Here's where I finally landed (it works for me and I can track and trigger off the state $vars!) in the event it could be helpful to anyone else. This very same structure is used throughout my house where an MS is used to trigger lighting... Kitchen Body 0 - Idle If $Kitchen_State is 0 Then Set Scene 'Scenes / Kitchen' Fade Down In Scene 'Main Floor / Kitchen Motion-Sensor' Set 'Main Floor / Kitchen KeyPad - Main' 55% (On Level) In Scene 'Main Floor / Kitchen Motion-Sensor' Set 'Main Floor / Kitchen Main' 55% (On Level) Else - No Actions - (To add one, press 'Action') Kitchen Body 2 - On (Note there is no Kitchen Body 1 since motion is handled in the Kitchen Cond 1 program) If $Kitchen_State is 2 Then Stop program 'Kitchen Cond 1 - Motion' In Scene 'Main Floor / Kitchen Motion-Sensor' Set 'Main Floor / Kitchen KeyPad - Main' 100% (On Level) In Scene 'Main Floor / Kitchen Motion-Sensor' Set 'Main Floor / Kitchen Main' 100% (On Level) Run Program 'Kitchen Cond 1 - Motion' (Then Path) Else - No Actions - (To add one, press 'Action') Kitchen Body 3 - Off If $Kitchen_State is 3 Then Set Scene 'Scenes / Kitchen' Fast Off Stop program 'Kitchen Cond 1 - Motion' In Scene 'Main Floor / Kitchen Motion-Sensor' Set 'Main Floor / Kitchen KeyPad - Main' 0% (On Level) In Scene 'Main Floor / Kitchen Motion-Sensor' Set 'Main Floor / Kitchen Main' 0% (On Level) $Kitchen_State = 0 Else - No Actions - (To add one, press 'Action') Kitchen Body 4 - FastOff If $Kitchen_State is 4 Then Set Scene 'Scenes / Kitchen' Fast Off Stop program 'Kitchen Cond 1 - Motion' In Scene 'Main Floor / Kitchen Motion-Sensor' Set 'Main Floor / Kitchen KeyPad - Main' 0% (On Level) In Scene 'Main Floor / Kitchen Motion-Sensor' Set 'Main Floor / Kitchen Main' 0% (On Level) Wait 15 minutes $Kitchen_State = 0 Else - No Actions - (To add one, press 'Action') Kitchen Cond 1 - Motion If Control 'Main Floor / Kitchen Motion-Sensor' is switched On Then $Kitchen_State = 1 Wait 3 minutes $Kitchen_State = 0 Else - No Actions - (To add one, press 'Action') Kitchen Cond 2 - On If Control 'Main Floor / Kitchen Main' is switched On Or Control 'Main Floor / Kitchen KeyPad - Main' is switched On Then $Kitchen_State = 2 Else - No Actions - (To add one, press 'Action') Kitchen Cond 3 - Off If Control 'Main Floor / Kitchen KeyPad - Main' is switched Off Or Control 'Main Floor / Kitchen Main' is switched Off Then $Kitchen_State = 3 Else - No Actions - (To add one, press 'Action') Kitchen Cond 4 - FastOff If Control 'Main Floor / Kitchen Main' is switched Fast Off Or Control 'Main Floor / Kitchen KeyPad - Main' is switched Fast Off Then $Garage_State = 4 Else - No Actions - (To add one, press 'Action') Kitchen Motion Light Level If Control 'Main Floor / Kitchen Motion-Sensor' is switched On And $Kitchen_State is 0 Then In Scene 'Main Floor / Kitchen Motion-Sensor' Set 'Main Floor / Kitchen Main' 55% (On Level) In Scene 'Main Floor / Kitchen Motion-Sensor' Set 'Main Floor / Kitchen KeyPad - Main' 55% (On Level) Else - No Actions - (To add one, press 'Action')
Recommended Posts