Why is this IF statement not working?

Am I missing something? Why is it false when it should be true for the first if statement
DeepinScreenshot_select-area_20220107133553

Right now, this is running (F and F or T and T). The first False, plus AND, makes the whole statement evaluate as FALSE

Sounds like you want to add some parentheses, so that it evaluates like this: ((F and F) or (T and T))

4 Likes

I'm not a boolean logic expert, but I think this is effectively an Order of Operations problem. Parenthesis might help.

As @dkilgore90 said.

S.

1 Like

Thank you, fixed

DeepinScreenshot_select-area_20220107135246

3 Likes

You can simplify this a lot as well by adding nesting IF blocks. You are testing each status up to four times, when you can do it only once for each variable. For example,

IF( Power Status L1 open THEN
   IF( Power Status L2 open
      Set Power Status to 'Off'
   ELSE
      Set Power Status to 'Degraded'
   END-IF
ELSE
   IF( Power Status L2 open
      Set Power Status to 'Degraded'
   ELSE
      Set Power Status to 'On'
   END-IF
END-IF
2 Likes

I like that, that's what I changed it to. Thank you!

Download the Hubitat app