philgood Posted April 6, 2011 Posted April 6, 2011 Well, here's the story. I have a 2420M (Rev 2.0) watching the front walkway and a front porch light that turns on to 30% at sundown (separate program that works consistently) and off at sunrise (another separate program) controlled by a 2477D. I want the front porch light to turn on to 100% for 10 minutes when the motion sensor is activated and then revert back to 30%. Here is the program that I wrote that does not work. If Status 'Front Door Walkway-Sensor is On And From Sunset To Sunrise (next day) Then Set 'Front Porch Light' On Wait 10 minute Set 'Front Porch Light' 30% Else -No Actions - I can control the Front Porch Light manually and I see the 2420M turning on, so I assume the hardware is working properly. Thanks!
j0dan Posted April 6, 2011 Posted April 6, 2011 Hi Phil. During the Wait 10 minute piece, if the status on your Sensor turns off, the program will stop. See http://www.universal-devices.com/mwiki/index.php?title=ISY-99i/ISY-26_INSTEON:Scope,_Precedence_and_Execution_Order#Statement_Execution_Order A few ideas from a fellow noob: Change the timeout on the motion sensor to at least 10 minutes. You could also use that timeout to turn off the lights. After turning it on, start another program that just has a Wait and turn off command. (This may cause problems if you turned the lights on or off while the program was running.) I'm not sure if using Control instead of Status would change anything.
oberkc Posted April 6, 2011 Posted April 6, 2011 I'm not sure if using Control instead of Status would change anything I think this would avoid the problem of of the sensor time-out. This sounds like a good idea to me. Here is the program that I wrote that does not work. You may help with troubleshooting by describing your symptoms. How does it "not work"? Does it not turn on? Does it not turn off at dawn (do you want it to)? Does it not revert to 30% after ten minutes? I see two areas of concern with your program, and j0dan has hit upon one: if your motion sensor status changes to off before the ten-minute wait, then the program will cease execution of the "then" statement and begin execution of the blank "else" statement. I expect changing "status" to "control" will solve this problem. The second area of concern I see is if motion is sensed within ten minutes of sunrise. If your progam is in the ten-minute wait period when sunrise occurs, the program conditions will trigger and become false, and your "else" statement will cease execution before turning the light back to 30%. Do you intend to keep the porch light on all day at 30%? Do you have another program which turns it on (30%) at sunset and off at sunrise? There are relatively painless ways to solve your problems. I have found good value in looking at the wiki, and specifically, the write-up about motion sensors: http://www.universal-devices.com/mwiki/index.php?title=ISY-99i/ISY-26_INSTEON:Using_X-10_Motion_Sensors If you care to add a bit of detail regarding what you expect to happen that is not, I am sure someone here can offer a solution. Please include what you want to happen to the porch light at sunrise and sunset (do you want the porch light to turn off and on, respectively?)
oberkc Posted April 6, 2011 Posted April 6, 2011 I'm not sure if using Control instead of Status would change anything I think this would avoid the problem of of the sensor time-out. This sounds like a good idea to me. Here is the program that I wrote that does not work. You may help with troubleshooting by describing your symptoms. How does it "not work"? Does it not turn on? Does it not turn off at dawn (do you want it to)? Does it not revert to 30% after ten minutes? I see two areas of concern with your program, and j0dan has hit upon one: if your motion sensor status changes to off before the ten-minute wait, then the program will cease execution of the "then" statement and begin execution of the blank "else" statement. I expect changing "status" to "control" will solve this problem. The second area of concern I see is if motion is sensed within ten minutes of sunrise. If your progam is in the ten-minute wait period when sunrise occurs, the program conditions will trigger and become false, and your "else" statement will cease execution before turning the light back to 30%. Do you intend to keep the porch light on all day at 30%? Do you have another program which turns it on (30%) at sunset and off at sunrise? There are relatively painless ways to solve your problems. I have found good value in looking at the wiki, and specifically, the write-up about motion sensors: http://www.universal-devices.com/mwiki/index.php?title=ISY-99i/ISY-26_INSTEON:Using_X-10_Motion_Sensors If you care to add a bit of detail regarding what you expect to happen that is not, I am sure someone here can offer a solution. Please include what you want to happen to the porch light at sunrise and sunset (do you want the porch light to turn off and on, respectively?)
philgood Posted April 6, 2011 Author Posted April 6, 2011 The Front Porch Light is not reverting back to the 30% even after rewriting the program to follow the design found in the supplied wiki. Front Porch Brighten from PIR: If Status 'Front Door Walkway - Sensor' is On and Status 'Front Porch Light' is 30% Then Set 'Front Porch Light' On Else -No Action Front Porch Timer: If Status 'Front Door Walkway-Sensor' is On Then Wait 10 minutes Set 'Front Porch Light' 30% Else -No Action There are two other programs that turn the light to 30% at sunset and another that turn it off at sunrise. Porch Light on at Dusk: If Time is Sunset Then Set 'Front Porch Light' 30% Else -No Action Front Porch off at Dawn: If Time is Sunrise Then Set 'Front porch Light' Off Else -No Action I hope that completes the picture and that my modifications (following the Wiki) are at least moving in the right direction. Thanks to all, phil
oberkc Posted April 6, 2011 Posted April 6, 2011 OK, so the light brightens (suggesting that the program executes) but does not dim back (suggesting that the program halts execution). I note that your program still relies on motion sensor "status" rather than "control". I think changing to "control" will (as suggested by J0rdan) will solve most of your problems. I expect that you will still have a potential problem at sunrise. I will provide more detailed program suggestions when I get more time.
LeeG Posted April 6, 2011 Posted April 6, 2011 Philgood The ISY Programming model is different from other programming languages. When the WAIT is executed the IF is subject to reevaluation. At the end of 10 minutes the motion sensor is likely no longer On and for sure the porch light is no longer at 30%. This means that at the end of the 10 minute wait the If will be false and the program is terminated as there is no else side. The solution often used for this type of problem is to put the Then logic including the WAIT into a second program where the second programs If is not affected by the change in conditions. The Wiki has a good explanation of what situations result in the If statement be reevaluated. Lee
LeeG Posted April 6, 2011 Posted April 6, 2011 Philgood The ISY Programming model is different from other programming languages. When the WAIT is executed the IF is subject to reevaluation. At the end of 10 minutes the motion sensor is likely no longer On and for sure the porch light is no longer at 30%. This means that at the end of the 10 minute wait the If will be false and the program is terminated as there is no else side. The solution often used for this type of problem is to put the Then logic including the WAIT into a second program where the second programs If is not affected by the change in conditions. The Wiki has a good explanation of what situations result in the If statement being reevaluated. Lee
oberkc Posted April 7, 2011 Posted April 7, 2011 Without explanation of the difference between control and status, I suggest the following changes to your program: If control 'Front Door Walkway - Sensor' is switched On and Status 'Front Porch Light' is 30% Then Run timer program (then path) Else -No Action Eliminate the second program and keep the third and fourth: If Time is Sunset Then Set 'Front Porch Light' 30% Else -No Action If Time is Sunrise Then Set 'Front porch Light' Off Else -No Action Create a program folder, where the conditions are: if From sunset to sunrise (next day) Then run the programs in this folder In this program folder create the "timer program" referenced in the first program: if then Set 'Front Porch Light' On Wait 10 minutes Set 'Front Porch Light' 30% else One problem may occur....if the front porch light is manually controllable, this whole scheme can fall apart if someone comes along and dims or brightens your light. For example, if someone comes along and dims your light to something less than 30%. All of a sudden, your program will never evaluate as true (until manually set to 30% or next sunset). If such a possibility concerns you, you may consider an alternative to your first program: If control 'Front Door Walkway - Sensor' is switched On and Status 'Front Porch Light' is not off Then run timer program (then path) Else -No Action I hope this works out for you.
Recommended Posts