pelle8 Posted April 10, 2014 Posted April 10, 2014 I have this program that doesn't seem to be working correctly. I want to be able to turn the garage lights on for motion anytime, when the garage door is closed. But, during the day, don't turn on the lights when the garage door is open. The logic seems to work fine at night, but it doesn't seem to work correctly during the day. The lights don't seem to turn off during the day after motion turns them on. Any thoughts or suggestions on this would be great. Thanks, John P. If ( Control 'GarageMotionSensor-Sensor' is switched On And Status 'IOLinc-GarageDoor-Sensor' is On And From Sunrise + 1 hour To Sunset - 1 hour (same day) ) Or ( Control 'GarageMotionSensor-Sensor' is switched On And From Sunset - 1 hour To Sunrise + 1 hour (next day) ) Then Set 'GarageLight' On Wait 2 minutes Set 'GarageLight' Off Else - No Actions - (To add one, press 'Action')
Michel Kohanim Posted April 10, 2014 Posted April 10, 2014 Hi pelle8, Please try making the else section into a different program with its own condition. With kind regards, Michel
pelle8 Posted April 10, 2014 Author Posted April 10, 2014 I am not sure what to do with the else statement that is suggested, but I think my issue is that the sensor status generates an event which causes the if clause to be re-evaluated. What if I use an integer variable for the sensor status (set by another program) so that an event isn't generated in this program when the garage door is opened after the lights turn on due to motion. If a program in the else area of my original program would be better, then any suggested text would be great. Thanks, John P.
Xathros Posted April 10, 2014 Posted April 10, 2014 Try splitting this into two programs as follows: If ( Control 'GarageMotionSensor-Sensor' is switched On And Status 'IOLinc-GarageDoor-Sensor' is On And From Sunrise + 1 hour To Sunset - 1 hour (same day) ) Or ( Control 'GarageMotionSensor-Sensor' is switched On And From Sunset - 1 hour To Sunrise + 1 hour (next day) ) Then Run Program GlightTimer (Then Path) Else - No Actions - (To add one, press 'Action') Program GlightTimer If Then Set 'GarageLight' On Wait 2 minutes Set 'GarageLight' Off Else - No Actions - (To add one, press 'Action') Hope this helps. -Xathros
pelle8 Posted April 10, 2014 Author Posted April 10, 2014 Thanks for the reply. Will your suggestion also cause the lights to stay on if motion is detected during the 2 minute wait? Also, how is this different than what is in my original program? I understand that the second one won't run by itself, but any event in the first one that evaluates true will cause the second program to run, which seems the same as what I currently have. I am sure I am missing something basic here, but I am new to the ISY. Thanks, John P.
Xathros Posted April 10, 2014 Posted April 10, 2014 Yes. The timer will restart every time the 2nd program is called even if it is already running. This is different because the first program can now evaluate false and not terminate the countdown in the then clause since the timer is now in a separate program. -Xathros
Recommended Posts