aLf Posted November 30, 2007 Posted November 30, 2007 Help: I've got the following program which is not acting right... IF status GAR KPL H IS ON or status MBR KPL H IS ON or status APPLIANCE LINC IS ON and FROM SUNSET to 10:35PM (SAME DAY) and GARAGE CLOCK APPLIANCE LINC IS OFF THEN SET GARAGE CLOCK APPLIANCE LINC ON This seems to work during the time sunset to 10:35, but after 10:35 is shows a "TRUE" and will not turn off. I've tried anothe appliancelinc, same result. I have an inlinelinc that has an identical program and does it perfectly. It also shows "FALSE"? What am I doing wrong? Quote
Chris Jahn Posted November 30, 2007 Posted November 30, 2007 Use the 'Add And (...)' button to add some parentheses as follows: IF ( status GAR KPL H IS ON Or status MBR KPL H IS ON Or status APPLIANCE LINC IS ON ) and FROM SUNSET To 10:35PM (SAME DAY) and GARAGE CLOCK APPLIANCE LINC IS OFF THEN SET GARAGE CLOCK APPLIANCE LINC ON Quote
aLf Posted November 30, 2007 Author Posted November 30, 2007 Chris: Thanks. It works! Could you explain what the () do? Again thanks. TIm Quote
Chris Jahn Posted November 30, 2007 Posted November 30, 2007 The parentheses group the conditions the way you want them to be. eg. A or B or C and D and E - To be true: Either A or B must be true, or C/D/E all must be true - same as: A or B or (C and D and E) (A or B or C) and D and E - To be true: D, E, and One of A/B/C must be true, Quote
aLf Posted November 30, 2007 Author Posted November 30, 2007 Chris: When sunset came around today the items fired, but they flashed on and off, on and off. I had to remove the call for else. Take the Christmas lights. The program was: From sunset To 10:30PM IF Gate outlet is OFF Then Gate outlet ON ELSE Gate outlet OFF I would think that any time the gate outlet was turned on away from sunset to 10:30PM the program would turn it off. It did just that. But at sunset the gate outlet flashed on and off as the GUI showed the same. I removed the ELSE and the flashing stopped. I'll look tonihjt after 10:30 and see if, #1 it turned out and #2 if I try and turn it on, will ISY turn it out? What did I do wrong with my program? I must be missing something in the syntax. I'm still struggling with the logic of the ( ) issues as well. I'm not sure why the TRUE FALSES change with ( ). Tim Quote
aLf Posted November 30, 2007 Author Posted November 30, 2007 Chris: To clarify my questions on ( ), In the case I stated last night, I needed all the "or's" and all the "and's" to be TRUE, herefore, I'm not sure why the ( ) helped differentiate the call as true or false? Tim Quote
upstatemike Posted December 1, 2007 Posted December 1, 2007 Looking at your example, doesn't the state of gate determine if the program is true and therefore cause it to flip back and forth? What if you get rid of the else statement? ON PROGRAM: From sunset To 10:30PM IF Gate outlet is OFF Then Gate outlet ON ELSE do nothing OFF PROGRAM: From sunset To 10:30PM IF Gate outlet is ON Then do nothing ELSE Gate outlet OFF Quote
Chris Jahn Posted December 3, 2007 Posted December 3, 2007 Chris: To clarify my questions on ( ), In the case I stated last night, I needed all the "or's" and all the "and's" to be TRUE, herefore, I'm not sure why the ( ) helped differentiate the call as true or false? Tim I think you need the group of Or's to be true right? In other words at least one them being true. Otherwise in this case, you'd just use AND for every thing. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.