What is the best way to know what Hubitat can and can't do

This is a brief introduction to these two topics.

Rules come in four flavors: Rule, Trigger, Triggered Rule and Action.

A Rule has conditions, a rule, and actions.
A Trigger has trigger events, and actions.
A Triggered Rule has trigger events, conditions, a rule, and actions.
Actions are just actions, and can only be used when another type of rule uses them as part of its actions.

Conditions are tested under a logical rule. One special capability for a condition is Rule Truth. This means the current Rule Truth for another Rule, or for more than one. The tested condition is for true or false. If more than one Rule is specified, the condition can be for any of them being true (or false) or all of them being true (or false). This mechanism allows a Rule to reference the state of another Rule as part of its logic. Another possible condition is Private Boolean (see below).

Trigger events are not tested, they just happen. For example, a contact opens, bang --> do the action. Two special capabilities for a trigger event is Other Triggers and Rule Truth. Other Triggers simply means if some other named Trigger fires, that event fires this Trigger. Rule Truth fires this Trigger is some other Rule(s) becomes true or false. These allow you to chain multiple sets of actions off one Rule or Trigger, without having to redefine the trigger events or condition/rule logic. Another possible trigger event is Private Boolean (see below).

Actions are the things that a Rule, Trigger, or Triggered Rule do when they fire. These can be defined as stand-alone Actions, for use in multiple other Rules, Triggers or Triggered Rules. Sometimes this is desirable in order to introduce various delays in actions. One set of actions could be delayed one minute, and another set delayed 3 minutes. Both could be fired by one Rule or Trigger.

Other actions involving rules are the ability to cause a Rule to be evaluated, that is, its conditions to be tested without having had to have changed state; or, to cause the actions of another rule or trigger to be run. Another available action is to set the Private Boolean.

These mechanisms are used as building blocks to stitch the logic of rules, the events of triggers, and actions together into arbitrarily complex logic structures. You can do crazy things (don't) like infinite loops, or cascading actions. But the flexibility allows you to solve arbitrarily complex automation problems. These take thought, and careful reasoning out of what will happen.

Private Boolean is a flag that each rule possesses. It starts out as true, and can be set to true or false by the rule (or trigger) in its actions, or by other rules. It is possible to set the Private Boolean of another rule in the actions of any rule. Finally, it is possible to disable a rule with its Private Boolean being set to false. This means that one rule can control another rule, whether it runs or not.

Here's an example. Suppose you have a rule that you only want to run immediately after a very specific event (such as leaving home). But the way the rule wants to be setup involves conditions that might become true or false at any time, not just then. What you do is make it so that the rule is disabled by its Private Boolean, and both the true and false actions of the rule will set its own Private Boolean to false. So, generally, this rule is going to be disabled, and it will become disabled once it runs once. Now, some other rule, one that detects that you've left home in this example, sets the Private Boolean to true, allowing its conditions to be tested, but to be tested only once, right then. I use a pair like this to alert me if we leave home and leave a garage door open. One rule tests the condition of any garage door being open, but is ordinarily disabled by its Private Boolean. Another rule runs upon everyone leaving, and delays it's actions by one minute. It's actions set the Private Boolean of the garage door checking rule to true, and then cause that rule to be evaluated (setting Private Boolean will always come before evaluating the rule). Presto, if one of the doors is open, I get an alert. But all of the other times that garage door rule would be true (any garage door open), it doesn't run.

That's it for this mini-tutorial. I'll be happy to answer questions as they arise.

6 Likes