pjjameso Posted November 28, 2021 Posted November 28, 2021 Would like to have an if statement as such; IF $sAQI >= 50 And $sDEQ < $sAQI Then .... Is this possible? Testing indoor Air Quality whereby if indoor is greater than 50 and the outdoor Air Quality is less than the indoor, then turn on ventilator, else do nothing. Currently posting values from IFTTT/Portal
hart2hart Posted November 28, 2021 Posted November 28, 2021 As long as they are state variables like you named and indicated it will trigger on a change to either variable. Off the point and not a suggestion, I learned to program years ago so it’s funny to me seeing the short variable names. Mine would be named Indoor_Air_Quality_State.
MrBill Posted November 28, 2021 Posted November 28, 2021 31 minutes ago, pjjameso said: IF $sAQI >= 50 And $sDEQ < $sAQI You can write the If statement just as you have and anytime any of the variables change it will evaluate all conditions and possible run the THEN block, Warning tho, this is a the exact type of program where users get surprised by how often Else Run. You indicated "else do nothing" which is great, but keep in mind that anytime any of the values change or are updated either Then or Else is going to chosen to run, else.. nothing is perfect in this case. If those values update often you might want to add: IF $sAQI >= 50 And $sDEQ < $sAQI And Ventilator status is Off then Turn on ventilator.... Depending on what platform controls the ventilator this may cut down on extra traffic... i.e. the ISY telling the ventilator to turn on frequently when the ventilator is in fact already on. Note: if the outside air quality is irrelevant for triggering the routine... that is it's only a filter that might prevent the on trigger, then you might make DEQ an interger variable instead: IF $sAQI >= 50 And $iDEQ < $sAQI And Ventilator status is Off then Turn on ventilator.... by doing that the IF is only getting evaluated when sAQI changes, however the current outdoor can value DEQ is still used to determine whether to fire the routine. 2
larryllix Posted November 28, 2021 Posted November 28, 2021 Thank you to all.....it works with one or two state variables but not with two device controls / switched, and will always run Else.Two devices switched can never be True at the same time in ISY logic.Sent from my SM-G781W using Tapatalk
asbril Posted November 28, 2021 Posted November 28, 2021 20 minutes ago, larryllix said: Two devices switched can never be True at the same time in ISY logic. But I assume that you can have 2 similar programs, one for each switch ?
larryllix Posted November 28, 2021 Posted November 28, 2021 But I assume that you can have 2 similar programs, one for each switch ?Yes, definitely but only one program will trigger Then at any given time.With multitasking processing these days they may appear simultaneous to a human, though.In any one program, only one trigger will ever cause evaluation of the If section logic at any time. While one control/switched statement causes evaluation, any other control / switched statement will be False. Thus Status condition statements are born. Status can act like a combination of event trigger and static condition from the same condition line....provided the program is NOT disabled.Sent from my SM-G781W using Tapatalk 1
Recommended Posts