calberrt Posted September 25, 2015 Posted September 25, 2015 Hi Guys, My programs are working flawlessly thanks to those on this forum. My next step is to add a bit of logic and I cant seem to think it through. See it's still warm here in Canada (not sure for how much longer) and when I let the dog out, we don't always close the sliding door, we may just leave the screen door blocking the entrance. Now my program work flawlessly when I let the dog out to open and close the door the first time Backyard Lights Night - [iD 0018][Parent 0060] If From 9:15:01PM To Sunrise + 15 minutes (next day) And ( Control 'Sliding Door Open' is switched On And $Dog_Out is 0 ) Then Set 'Backyard Keypad' On Set Scene 'Main Floor / Landscape Lights On' On Wait 15 seconds $Dog_Out = 1 Else - No Actions - (To add one, press 'Action') and then works flawlessly when the door is opened and closed again to let the dog in Backyard Lights Night Off - [iD 0019][Parent 0060] If From 9:15:01PM To Sunrise + 15 minutes (next day) And ( Control 'Sliding Door Open' is switched On And $Dog_Out is 1 ) Then Wait 20 seconds Set 'Backyard Keypad' Off Set Scene 'Main Floor / Landscape Lights On' Off Wait 15 seconds $Dog_Out = 0 Else - No Actions - (To add one, press 'Action') Effectively what I would like to do is add in some logic that says If the sliding door is left open for a certain amount of time, say 10 minutes and then is closed, have the lights turn off. Right now, if this happens based on the above programming, I would be required to open and close the door again before the lights will turn off. How can i modify/re-write my program to make this happen? Any help would be greatly appreaciated Thanks all! calberrt
larryllix Posted September 26, 2015 Posted September 26, 2015 (edited) I am not exactly sure how you want the two logics to combine. These lines of code may be able to be added in to your existing programs as they are later events than your code executes for. If From 9:15:01PM To Sunrise + 15 minutes (next day) And ( Control 'Sliding Door Open' is switched On And Control 'Sliding Door Open' is NOT switched Off ) Then Wait 10 minutes Enable program 'screen door only' Wait 10 minutes Disable program 'screen door only' Else - No Actions - (To add one, press 'Action') Program 'screen door only' (disabled) If Control 'Sliding Door Open' is switched Off Then Set Lights Off, dog is in, etc. Disable program 'screen door only' Edited September 26, 2015 by larryllix
Recommended Posts