[Released] Rule Machine 3.0

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
AND
Mode is away.

That would do the trick wouldn't it?

@bobbles Please add WC to the acronyms page. :wink:
https://community.hubitat.com/t/common-acronyms-and-abbreviations-wiki/13745

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

3 Likes

Is 'spend a penny' still a thing?

Yes, this is correct.

WooHoo!!!!!!!

It is important to realize that conditions in Actions are not like Conditions in Rules. A condition in an action is evaluated when the action runs. It has no subscription to events, so its state changing doesn't cause anything.

Only Conditions in a Rule have subscriptions to events. Only events happening to these Conditions cause Rule evaluation, which in turn causes Actions for True or Actions for False to run.

In this case, this rule is going to be evaluated upon these events: Time becomes Sunset, Time becomes 23:50, and Mode changes. If it evaluates to true (time between and mode is Away), then it's going to run Actions for True. If it evaluates to false, the repetition started in Actions for True is going to stop (and Actions for False will run). So the repetition will begin when it becomes (or is) Away between Sunset and 23:50, and it will stop when Mode becomes other than Away or 23:50, whichever happens first.

6 Likes

Will the actions within the repetition still complete if it becomes false while a timer for one of the lights to turn off is counting down?
i.e.
Light has turn on
Timer to turn off starts.
Rule becomes false.
Timer expires.
Light should turn off. Will this happen?

Yes, as long as the delay does not have Cancel on Truth Change.

Brilliant. Thanks.
This is looking better all the time.

This is what i missed I didn't realize this and thought that as long as the main rule was in true or false (whatever the conditional action was in) this is what would now be followed. All good information :slight_smile:

I'm beginning to grasp some concepts here (I think)

Logic behind a simple condition/action(true):
1-Condition to evaluate (let's assumed the "State" is False)
2-Wait for the "State" to become True (Truth Change)
3-Run the Action
4-Wait for the "State" to become False (Truth Change)
(Which means, do not re-execute the same Action over and over even though
the Condition(1) is still True)
5-Go back to 2

I think for you guys, "State" means "Private Boolean", but I prefer "State"

Am I getting somewhere?

Private Boolean is yet another thing entirely, and in and of itself has nothing to do with rule evaluation or truth, or truth state.

Private Boolean is a variable that can be true or false. It starts out true. Rules can set it, including the rule it belongs to. The rule it belongs to can test it as a Condition or Trigger Event, or in a conditional action. The rule it belongs to can use it as a Restriction, so that the rule can be disabled by it. It has many possible uses. However, it's value (true or false) has nothing to do with the Rule Truth of a rule (also true or false).

Ok, got it. Private Boolean is like a switch that can be tested almost everywhere. Good.
Is it changing value automatically under certain condition or must we change it ourselves.

BTW, @bravenel thanks for all your help. Really appreciated!!

It does not change automatically on its own (at least not in any way I know of).

It only changes when it is set by a rule. Any rule can have an action to set it, including the one it belongs to.