[Released] Rule 4.0

That's easy... the answer is @homeauto2112 !!! :rofl::joy::stuck_out_tongue_winking_eye:

@homeauto2112 - in all seriousness, thank you for all of your hard work converting your rules to 4.0 and helping find bugs along the way. Your effort is truly appreciated by me and the community!

5 Likes

I have to play more, but when setting up precense or motion sensors. I canā€™t find the options to select all inactive or active or all precense. I can only get it to work with any.

There is a bug right now (fix coming soon) with presence in a trigger event. "All" is only a choice for a condition, in a conditional action. It's not meaningful for a trigger event.

I assume that any issues in RM 4.0 has nothing to do with RM 3.0 so it is ok to update hub and my rules in 3.0 will work as usual right?

1 Like

I wonder if Bruce really has "original" RM rules running (and by "original", I mean the ST version)?

Correct, and there were a few bug fixes in 3.0. See the release notes: Hub Update 2.1.2

The following Rule 3.0 notifies me every 30 minutes, when my gate is left open for 30 minutes. When the gate is closed, the delay and repeat stop.
How would I do the same in 4.0?

The "original" ST version was never released on Hubitat. It had undergone substantial development by the time that Hubitat Elevation was released. That said, most of my rules are pre Rule-2.5, so in some sense are descendants of the original.

Trigger Event: Gate changed
Actions, IF gate open -THEN
your actions
ELSE
Cancel Delayed actions
Stop Repeating actions
END-IF

1 Like

Thank you very much for the props. Itā€™s a great community to be a part of and contribute towards!!

2 Likes

First rule 4.0 I tried to create needed presence and found this myself a bit ago. Came here to see what I could find on it. Guess I'll wait for the hotfix. :smile: I think I'm going to like RM 4.0.

I hate to harp on something, but I still have a question on "nested" if statements. Will this action work? It allowed me to save it and it appears correct to me...but obviously if it won't I'll come up with something else.

This is the conversion of 2 RM 3.0 rules into one 4.0 Rule. If we can also add nested IF's, that will reduce my "rules" by an even larger number.

Yes, you can nest IF-THENs to your heart's content.

3 Likes

Thanks @bravenel. And is that the right way to do it, have one END-IF for the nested IF then an ELSE-IF for the top level IF? It is nice that it indents itself automatically without having to do it manually.

IF-THEN, ELSE-IF... ELSE, END-IF all need to be matched up into a single block. Within any segment of that block, you can have other IF-THEN-ELSE-ENDIF blocks. ELSE-IF and ELSE are optional, and there can be as many ELSE-IFs as you want but only one ELSE. There must be an END-IF to close the block.

And the screenshot i posted looks right?

It looks fine except for my bug with the indents for Delay Per Mode being off.

Well, I meant more my rule than your code. I only have control over one out of two of those. :stuck_out_tongue: Thanks!!!

Currently in RM 3 if we do not close and "if" statement with an "end if" it works fine. Now with nested rules is it mandatory to use a "end if" for each "if' ??

Yes. Otherwise it won't know where one stops and the other continues! The auto-indentation shows the nesting.