[Released] Rule Machine 3.0


How exactly does the random delay work. For instance if I put in a 20 second delay and then click the random delay will it randomly delay between 1-20 seconds?


Is this what you mean because this doesn't work either.



IF (Mode is Day) Repeat every 0:00:05.


Well here is my last attempt.
Lights turn on and that's it.
I've tried lots of combinations to try and get this work.


I would have done the exact same thing as @bobbles, why?
Simply because I was assuming that the "Select Conditions" was in fact an IF.
IF Mode is Day THEN do the following actions.

What I find strange is that you have to repeat the condition inside the action section. Why? Isn't that the purpose of the "Select Conditions" section?


You missed the prelude to this. He was trying to create a while-loop.

Back up a moment to basic Rule Machine logic.

You can have a Rule or a Trigger. A Rule tests some conditions with a logic rule, and decides to either do Actions for True or Actions for False, depending on the outcome of the logic rule. A trigger just takes some event and does some actions when that event happens. Whatever one does with Actions happens within this framework.

Within actions one can introduce yet more conditional logic should that make sense for the use case. It would be easy to get confused at this point between the foregoing framework and what one does with actions. I'd say that introducing conditional actions is an advanced concept, and probably best used once one has a full grasp of how RM is working.


Let's start over. What are you trying to get to work?

Consider this simple trigger:

This is going to toggle that light on and off 10 times, then stop.

Now look at this one:

This one is going to go on repeating as long at the Front Door is closed. Once the Front Door is open when it does the every 5 second look at it, it will stop repeating. See below:


I did find a bug in the repeat logic that would explain why you are not repeating. This will be fixed in the next release.


I do have a good try at getting things to work before I post on here and whatever i tried I could not get the repeat action to work. It's the best way of learning as far as I'm concerned.
Glad you have found a bug which could have contributed to this.


Just for information this is what I'm trying to achieve.
A light to turn on and off between a certain time when we are away. In this case every hour.
Hopefully this should work after the next hot fix.
Thanks again.


Cool. You should add some randomness to it. I'll see if I can get something with similar structure to work.


Here's some randomness. :smile:
Also I have added another light so that it looks like someone has moved through the hall to the WC.
Reading the initial post I'm assuming that as soon as Random 30:00 matures the next 3 delays all start running at the same time.
If this works OK it will rationalise 5 rules into 1. Happy days. :smile:


One more thing, do we really need to add "stop on truth change".
Isn't that the goal of the Private Boolean to stop the action when the "truth change" (I read that somewhere), or maybe this doesn't apply to trigger.

Sorry for all the questions but I'm trying to grab the hole concept of how the RM works and so far, it's a bit confusing.
My hubitat is on its way and I think I gonna have a lot of testing to do :slight_smile:


@bobbles did not need that in the one he had first above, with the conditional action. In the later one, he does need it. Here's why:

He's starting his repetition if Mode is Away. Once it starts it's going to run forever. So he needs someway to stop it. Truth changing in this case would be time becoming 23:45.

There is a flaw in his logic however: Probably he only wants this to happen between those hours and when he is away. If he is home at Sunset, Mode will not be Away and the rest of those actions will not happen, even if he leaves (by then the action has already run). Even if he was away at Sunset, if he returns that won't stop the repetition, because the IF has already run, and won't be run again.

So, an exercise left to the reader is how should this rule be setup so that it does the light while he is away between Sunset and 23:45?? Hint: It does not entail having an IF-THEN in the actions.


Was it that after the repeat time it wasn't checking the logic? Then going to false


No, it had to do with ending a repetition, but not clearing a flag to skip repeated actions (cleared by End Repetition) when the rule was run again.


Define the rule as: -
Time is between Sunset and 23:45
Mode is away.

That would do the trick wouldn't it?


@bobbles Please add WC to the acronyms page. :wink:


Good point.
WC = Bog. Karzie. Thunderbox. :smile:
The list will just keep growing.


Is 'spend a penny' still a thing?