Steigs Posted November 21, 2012 Posted November 21, 2012 Greetings fellow ISy'ers, I have a program that runs the HVAC fans to just circulate air every couple hours. With the cooler weather I wanted to automatically disable the program, so I added a line for temperature: If Time is 2:00:00AM Or Time is 4:00:00AM Or Time is 6:00:00AM Or Time is 8:00:00AM Or Time is 10:00:00AM Or Time is 12:00:00AM Or Time is 2:00:00PM Or Time is 4:00:00PM Or Time is 6:00:00PM Or Time is 8:00:00PM Or Time is 10:00:00PM Or Time is 12:00:00PM And Status 'HVAC / Downstairs / Downstairs' > 80° (Temperature) And Status 'HVAC / Downstairs / Downstairs' is Fan Auto And Elk Area 'Compound' 'Armed State' is Disarmed Then Run Program 'AutoCirc' (Then Path) Else - No Actions - (To add one, press 'Action') The program continues to flag true and execute as it did before. I assumed it would stop once it reads a temp lower than 80 degrees. Am I misinterpreting how that temperature status should function? The AutoCirc routine has no evaluations and can only be called by this program.
LeeG Posted November 21, 2012 Posted November 21, 2012 The If conditions need parens to correct the "order of precedence". Also the temp check will prevent execution at 80 and below, rather than below 80. If the check should be below 80 then ">= 80" is needed. If ( Time is 2:00:00AM Or Time is 4:00:00AM Or Time is 6:00:00AM Or Time is 8:00:00AM Or Time is 10:00:00AM Or Time is 12:00:00AM Or Time is 2:00:00PM Or Time is 4:00:00PM Or Time is 6:00:00PM Or Time is 8:00:00PM Or Time is 10:00:00PM Or Time is 12:00:00PM ) And Status 'HVAC / Downstairs / Downstairs' > 80° (Temperature) And Status 'HVAC / Downstairs / Downstairs' is Fan Auto And Elk Area 'Compound' 'Armed State' is Disarmed Then Run Program 'AutoCirc' (Then Path) Else - No Actions - (To add one, press 'Action')
Steigs Posted November 21, 2012 Author Posted November 21, 2012 Modified, thanks Lee. Just so I can get my head around it, can you explain how the ISY interprets the difference?
LeeG Posted November 21, 2012 Posted November 21, 2012 Take a look at the UDI Wiki, it has a good explanation on order of precedence. Order of precedence has to do with the default order and scope of evaluating ANDs and ORs. Without the parens the upper most ORs were being evaluated without being ANDed to the lower ANDed statements. Made the If true for most of the times because they were not ANDed with the last three conditions. By putting parens around the ORed statements all of them are now ANDed with the last three statements. Feel free to post back if the Wiki does not clear it up. Just trying to avoid duplicate posting of information.
Recommended Posts