Conditionals in Rule Machine

I have to admit that though I was a programmer most of my life, I can't figure out how to do conditionals in Rule Machine. It just doesn't make sense. The pseudo code for what I want to do is:

If (CERTAIN_SWITCH == on) THEN {
TURN OFF ANOTHER_SWITCH
WAIT 2 MINUTES
TURN ON ANOTHER_SWITCH
} ELSE {
TURN ON ANOTHER_SWITCH
WAIT 2 MINUTES
TURN OFF ANOTHER_SWITCH
}
END IF

I mean, I've coded in Fortran, C, C++, JAVA, etc. etc. etc. and I just can't get the GUI to allow me to do this. I have looked for a tutorial. And man would I have love to pop open a file in vi and go to town.

Anyway, can anyone point me in the right direction? I seem to get stopped in "there's nothing I can do from this screen" mode every time.

Thanks in advance for helping this decrepit old programmer.
Jay W

Seems like you may just have issues figuring out how to use the GUI. In that case, perhaps a video would be helpful. Here is one that's a couple years old now and for Rule 4.0, but the Rule 5.1 (current version) interface isn't that different with regards to conditional actions, so it will still be applicable:

I'd also suggest trying again with a new rule if you haven't already--just in case you got the one you're working on now into some weird state that messed up the display.

Good luck!

2 Likes

YES! That video was very helpful. What was hanging me up was the distinction between defining conditions and defining actions. Kind of odd syntax. But after watching the video, I got it. Was able to finally do this sort of complex rule.

Many thanks to you for taking the time to reply.
Jay W

2 Likes

No birds have been harmed in this rule.

1 Like

Correct. Only annoyed. :wink: "Sunshine" is retractable awning controlled through a BOND interface. Weirdly, when it's "on" it's retracted, when it's "off" it's extended. So we turn the sunshine on/off for two minutes several times a day to keep them from building a nest under the awning cover. Every spring we go though this and I finally got around to automating the bird annoyance system.

1 Like

That's a cool idea. And a great use of automation.