[Released] Rule Machine 3.0

2 posts were split to a new topic: Keen Vents not reporting temperature

Found a bug (I believe)

Rule is setup to turn on a light in my kitchen at midnight, then it delays a fade action for two hours.

When it triggers the fade action it does this:

app:12172019-05-08 02:00:00.314 amerrorgroovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.lang.Integer#div. Cannot resolve which method to invoke for [null] due to overlapping prototypes between: [class java.lang.Character] [class java.lang.Number] (dimFade)

Could this be the same issue I see with my sunrise rule that is in the next patch?

8 posts were split to a new topic: Rule not logging correctly, missing ENDIF not working right

How to make a simple rule :

  • If Light ( Switch, Contact … ) STAY ( triger ) : on ( or off, open, close ... ) for x minutes, second THEN do something … with Cancel on truth change.
    Thanks.

Here is a simple rule. If the garage door is left open for 5 minutes, it will send a message. If it closes within that time, it won't do anything at all.

1 Like

@bravenel a while ago i wanted a conditional action repeat but I had set up wrong as i was told the actions IFs done get evaluated so esentaly it would run forever. So stop on truth change had to be the main conditions truth change correct?

but in the documentation it says this

A Repeat Actions, like any action, can have a condition specified. If the condition is false, the Repeat Actions block of actions will not be executed. If the condition becomes false during repetition, the repetition will be stopped (not in the case of Repeat a selected number of times). This provides three features well known to computer programmers; A while-loop, a for-loop and repeat-until loop. The while-loop runs only if the condition is true, and stops if it is false. A for-loop runs for a fixed number of times, but if a condition exists, it will only start that iteration if the condition is true; the condition is not retested during iteration. A repeat-until loop runs until a condition becomes true, running at least once.

While loop - repeat while the condition is true:

IF (condition) Repeat Actions
     some actions...
End Repetition

which to me states otherwise that if the IF (condition) changes to false it stop. no mention having to tick stop on truth change eather. Is it that whatever the condition is it would have to also be a condition in the main part of the rule even if its not in the rule defined.

The confusion is around which type of conditional action to use.

For while loop, use Simple Conditional Action, not IF-THEN.

Like this:

Right! ok that would be why. It's not clear what the difference is between them (currently reading the docs so it may become clear) what is the difference, is it one is evaluated all the time one not?

16 posts were split to a new topic: How does Repeat Actions work

A Repeat Actions works by running the same action for each repetition, starting with the Repeat Actions action. For a Simple Conditional Action, the condition is part of that action, so it is tested on each repetition. If it is true, execution continues. If it is false, the actions until End Repetition are skipped.

In contrast to that, IF-THEN is it's own action, and a Repeat Actions after that is a simple Repeat Actions, with no condition attached.

Simple Conditional Actions attach the condition to an action. You can see this when you create one, in the way the UI prompts you. You can see it in the result, where the condition is on the same line as the action. You can read about it in the documentation: Rule Machine - Hubitat Documentation.

1 Like

Sorry for such a basic question, but I’m missing how to do delayed off in RM 3.0 like the 2.5 example here.

Exactly the same way. The Delay is attached to the Switch Off action.

1 Like

So if my action for True is switch on, true should also continue off with a delay?

2 Likes

thanks for the explanation i can see it now. So would this work?

if in party turn on and whilst its ON repeat.

Aw is this what a nested IF is? So no?

I find the new IF THEN functionality extremely useful, thanks for bringing this to us!

However, I have now quickly found that it would also be really helpful to be able to nest these. Are there any plans for adding support for nested IF THENs in the future?

Not any time soon.

So if my example is a nest then this should be a work around

Speaking of IF THEN, I found what I think is a bug yesterday with inserting a new IF THEN before another IF THEN in a rule.

Consider this rule:
image

Then try to change this rule so that the first action is inside its own IF THEN. Inserting the IF THEN before the action is working as it should:

image

But, I now cannot insert the END IF. The option is not there:

image

The way around this is to first delete the existing ENDIF, then I can insert the first ENDIF, followed by the second ENDIF:

image

Don't worry about what this rule does. I just used some random actions to cobble together an example that would illustrate the bug.

@bravenel I just found the same thing with my rule i moved the IF to the top and i couldn't add a END IF until i deleted the other one at the bottom.