Rule Machine® Introduction

Thanks for the suggestions. They were very helpful.

I finally wrapped my brain around the WC "stays" capability in RM (using the cancel capability). Now, I'm trying to figure out how to implement a WC piston in RM that uses a "changed in the last n minutes" condition. The logic is:

Something Happens
AND
Motion changed in the last 45 minutes
Then do it

Is there a way to do that in one triggered rule?

I think a rule with the Private Boolean of a trigger would work, e.g.

Rule 1
If motion, set Rule 2 PB TRUE
Delay 45 minutes, set FALSE Rule 2 PB [cancel]

Triggered Rule 2
Something happens
AND
Private Boolean TRUE
Then do it

Is there a simpler way?

1 Like

I had to do it with PB. My blinds trip my motion sensors. I actually need a rule and an "action". The trigger fires when the the blinds change setting the PB for the motion rule. It also runs an "action" that has within it a delay of a few seconds and setting the PB back to true. That's the only way that I'be been able to figure out how to do it.

1 Like

I think this would work, but you don't need a condition of PB true in the second rule. If PB is false, the rule will do nothing by default.

You do need to enable the PB restriction in the second rule though.

1 Like

When doing this I find it easier for my brain to just look at RULE1 in RULE2.

Rule 1
If motion
Delay 45 minutes[cancel]

Triggered Rule 2
Something happens
AND
RULE 1 TRUE
Then do it

That really makes no sense because rule 1 is true if motion is active. Your cancel only applies to the action. The rule is still true immediately. So, you don't accomplish anything by breaking it up. Basically, you would get the same functionality if they were in the same rule.

1 Like

Because the rule goes false as soon as motion stops right? It's just the actions that are delayed.

**edit...re-read....you said this already :rofl:

1 Like

Rule Machine allows arbitrarily complex rules to be defined, with parentheses used to group conditions into sub-rules. To use this feature of sub-rules in parentheses, you must first turn on the "Advanced Rule input" option, at the beginning of the Define Rule page........... I for the life of me can not find where I activate Advanced Rule Input. Please help.

Sorry, obsolete documentation. You no longer have to do that. Sub-rules are available on the Which Condition pull down menu:

the built in capabilities in hubitat are limited compared to rule mchine in smartthings.. where is the github for the full version of rule machine for hubitat..

thanks

??

You can only access what is built in. It is not an open source project.

You didn't even ask a question or give examples of what here, so I am not sure how we could even answer it.

I would start a new thread with what you are trying to do, what devices you are using, and see if people have suggestions.

2 Likes

Hubitat's Rule Machine is the Rule Machine that was originally written for ST. The founders got so tired of ST problems that they created their own hub. :slight_smile: However, it has undergone significant changes since then, perhaps the most notable being Rule 4.0, released about a year ago. (Another change is that it is now a closed-source part of the Hubitat platform. If the license for the old code allows, you could probably port it yourself, but I think you'll end up liking the latest Hubitat version better once you figure it out--as with the older versions, there is some learning to do.) If you mean webCoRE, that's an entirely different app, though a port is also maintained for Hubitat (some people used to have problems with it here and I probably wouldn't recommend starting there, but the current version seems to work well for most people).

I would echo the suggestion above to make a thread about a specific automation you are trying to create. Many people in the community, just like ST, are happy to assist. I'd also suggest reading the docs for the latest Rule version, which contain a lot of examples. And don't feel tempted to head straight for RM; Hubitat has lots of built-in apps designed to create common automations without the need to create your own rules (or apps). Best of luck!

3 Likes

RM Feature Request:

Ok, assuming I'm not missing something obvious (very possible), It would be great if there was an additional Trigger Mode called changed from [X] to [Y] in the RM, Simple Rules, and Notifications Apps.

This would be very useful for House Mode changes in particular - 2 scenarios that I would personally use this trigger mode in are as follows:

  1. Mode Changes from [Night] to [Home] - (or Day if you use that Mode) I currently use a fairly crude workaround (a time boundary) to implement actions when this happens, as this Mode change time happens later on the Weekend than it does on weekdays. eg

  1. Mode Changes from [Away] to [Home] - (or Day if you use that Mode) I'd like to be more precise in the way I send Notifications for Mode changes. eg I don't care about [Night] to [Home], but I do like notifications that the [Home] to [Away] and vice versa changes are taking place. This more of a change to the Notifications App than RM, but worth mentioning as I would use this changed from [X] to [Y] trigger a lot in it too.

There are already some things that have a changed to type state (eg XYZ Presence "Arrives") but I think adding the ability to use precise "changed from to" triggers would add even more power to an already powerful rule ecosystem.

It might, (and I could be talking out of my hat here), even make rules, like my Mode change eg above, use less overheads due to a reduction in rule complexity.

I want to say this has been talked about. From what I remember someone suggested setting up a rule that looks like this

Trigger: Mode Changes
Action:
Set Global Variable to Mode -> Delay 5 min

The way the global variable would be whatever the last mode was for 5 min. This is also a bit crude.

What I do is I have a rule for setting the house to HOME from SLEEP and a rule for setting the house to HOME from AWAY. Both of these rules pause themselves when done.

When I enter Sleep or Home I resume the rule that will be needed

And that is what I'd like to avoid - acting on state changes would have to be the most powerful part of Automation, and being able to act on precise "from to" changes just adds an additional precision tool to the toolkit.

This may be of interest

1 Like

Hmm, interesting indeed - personally I'd settle for an extra trigger mode in the built-in apps. As frustrating as I find the RM UI, I do like its power and this would be the icing on the cake for me.

Once again, this is simply pushing conditional actions and other functionality into triggers where they don't belong. The idea misses that a trigger is something caused by a primitive event, not the computational consequence of conditional logic and state maintenance.

If you want to be notified of Home to Away, as suggested you'd have to maintain a current mode variable, and test that with a conditional action following a trigger on Away. This is exactly what your proposed extension would have to do.

Notice that when the event 'Mode becomes Away' happens, at that point in time the previous mode is not known, even by the hub. So something would have to remember it. That something could be done with a simple rule as suggested above.

1 Like

Ah ok, I assumed that HE tracked and logged state changes like Home Assistant does (and Reactor on Vera).

Device events are kept in the database, and prior events can be looked up (not in RM, but in an app). I don't know if it is possible to look at past location events (mode change is a location event). In any case, RM (and other built-in apps) do not have past event lookup features.

Hubitat's computational model is stateless. One can create state information through code, but it's not what the hub is designed to do.