Rule Machine Issue when there is a malformed conditional statement

This looks like a bug.

The rule in the editor correctly evaluates the last condition as true, but in the logs it shows it is not executing the "THEN" Fan speed set to low.

I am running v2.3.3.140

I don’t think that’s a bug but I’m reading on my phone so may be wrong….

Take out the first of your End-If’s… If it the first statement is false and the next statement is false, that first End-If stops the last statement being evaluated, so even if it’s true it’s skipped.

I’d also possibly edit the first bit and pop parentheses around the temperature statement.

Edit - I’m misreading it lol. I’ll look at it on the big screen and edit this.

1 Like

You have edited the rule and now have two ELSE statements if the 1st IF is not true. They should be a Else IF and a Else or two ELSE IFs.

2 Likes

Your conditional actions are malformed. You can only have one ELSE per IF THEN. If the expression on the IF THEN or any (optional) ELSE-IFs is false and there is an ELSE, then the ELSE section will run. It catches all other cases. Only zero or one sections inside an IF THEN (the IF THEN, the ELSE-IF, or the ELSE) will be run per execution. Adding a second ELSE block results in un-reachable actions since something before it would necessarily have matched already (if nothing else, the first ELSE).

From your rule, it seems like you want to make these ELSE-IFs, rather than ELSEs with a nested IF THEN. That should work how you want, unless I'm not guessing correctly about what you want the rule to do.

2 Likes

Y'all are exactly right. A malformed IF THEN... There is no ELSE IF, so I need to rearrange this. That's what I get for staying up too late. Apparently at 2:30AM the IF THEN ELSE ELSE makes sense! I nested the second else back a bit. I think that will work.

1 Like

But there is. :smiley:

That being said, what you have now should work, too!

oh really? Let me see...

Why don't I see the ELSE-IF ?

If I recall right, it only shows up as an action when there's already an open IF-THEN action. If you already have IF-THEN-END...an ELSE IF THEN action wouldn't make sense.

1 Like

Yeah, you have to be in the middle of creating a conditional action. (It can still make sense to add one if you aren't, given that actions can be cut/copied and pasted or moved, but I suppose RM is trying to save unsuspecting users from themselves by doing this.)

3 Likes

You're right. As I am composing the thing it's not valid almost until the very end. I don't think it makes a lot of sense to try to restrict these commands until complete. In any case, it's all fixed up now.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.