As i can see it you can only add mulitple triggers as and OR and there is no option to add multiple triggers with and AND requirement. Is this what is the function of required expression is for?
How do i create a trigger for the below 1 AND 2 points to be true:
Temp for xyz device to be =<27
Motion to be detected on any of the selection devices
if 1 AND 2 are TRUE then, trigger
The temperature can be your required expression. There are other ways to do it, but that is one.
Re triggers.... Think of these as the events you want to have happen in order for the rule to... Well, trigger . Your temperature condition is not so much a trigger, I expect, but rather, you only want the rule to trigger when the temperature is above X.
Now that I say that, do you want to only trigger on motion if the temperature is above that level, or also when the temperature becomes high?
Another way to think of it is the temperature being above a certain value is a state, so you can use that in conditional statements like if the temperature is > X, whereas the temperature moving past X, that is an event, so could be used as a trigger. But the temperature moving past that point and motion being detected at exactly the same time is not really something you want as the trigger for a rule... You either want motion when the temperature is high, or motion or the temperature becoming high. If that makes sense...
Is it possible to create a more complex trigger by linking to conditional triggers with an AND or make one large conditional trigger?
e.g trigger if all of the following =TRUE
Temp on xyz is =>27 =TRUE or FALSE
(AND OR value should be available here)
motion on xyz =active =TRUE or FALSE
(AND OR value should be available here)
motion on xyz = inactive for > 15mins =TRUE or FALSE
(AND OR value should be available here)
Ok, I think you have this one setup ok, as long as you are happy for the rule to fire if, for example, devices 1 and 2 are active, then device 3 becomes active, or any combination of that scenario. If you are happy for the rule to fire whenever any of them detect motion, regardless of the state of the other sensors, then what you have posted previously will do this, I believe. There are options to combine their collective detection into a single active or inactive, if you want to treat them as a group.
These would be required expressions or conditional triggers, like @JB10 and I described, though I am not 100% sure how best to achieve the >15 mins, though it has come up recently, so hopefully there is a recent solution for that.
One thing to note, at least in the way you have described these two conditions with an AND...
If the temperature was 30 and motion was detected in sensors 1, 2 or 3, but sensors 4, 5 and 6 have not yet been inactive for 15 minutes, the rule will not trigger. Once 4, 5 and 6 have been inactive, the rule will require sensors 1, 2 or 3 to become active for the rule to trigger. I'm wondering whether you actually need the inactivity condition... What are you trying to achieve with this? My earlier comment about combining sensors 1, 2 and 3 may also play into how you want this to work.
I can not see anywhere to add >15 min inactive in expression or conditions.
i would like to auto turn on aircon down stairs (which turns off upstairs room aircon) if:
There is no activity on any device upstairs (device 3,4,and 5 for >15mins)
and
Temp on downstairs sensors is =>27deg
and
motion is detected on any of the downstairs motion sensors (device 1,2 or 3)
and
house mode is not in away mode
I might need to leave you with others to chime in for now, getting ready for some visitors tonight.
I expect you will need a combination of triggers and conditions for both the motion sensor groups. Personally I would think you could just turn on the downstairs a/c the temperature is high and motion is detected..
The temperature you can add as a required expression.
For the inactive motion I think you'll need a second rule to track them and set a boolean hub variable (or set the first rule's private boolean directly).
First Rule
Required Expression
Temperature of Dev1, Dev2, Dev3 all >= 27.0
MotionInactive is True
Second Rule
Trigger Events
Dev4, Dev5, Dev6 all motion inactive and stay that way for 0:15:00
Actions to Run
Set MotionInactive True
Wait for Event: Dev4, Dev5, Dev6 any motion active
Set MotionInactive False
I don’t understand why something simple has become so complex to do. Why not allow AND in the trigger rule and a time value in the selection which would make this simple
In “Reactor” third party rule engine in Vera it is so easy and logic. You can set multiple and values in a boxed group or also have an or value
E.g
Trigger =
Trigger group 1
Temp => 27deg
And
Motion active on either device 1,2 or 3
And
No motion active on all devices 4,5 or 6 for
And
Mode is NOT Away mode
15min
OR
Individual trigger
Temp is >=27deg
Which would trigger the rule if all group 1 =true
OR
If temp reaches 27deg+
I don't know anything about Reactor (nor Vera) so I looked it up. It seems that what you want to do wasn't so simple in Vera so someone decided to write a plug-in to allow it to happen.
I'm not sure it's fair to say that since a third party plug-in for Vera could do this, Hubitat should do it natively. Perhaps one of the community developers will see this and write or help you write an app to give you what you want. In the meantime, the community is here to help you figure out how to get these complex situations working.
Triggers in Hubitat are based off events. If there is no event, there is no trigger. Required Expressions, conditional triggers, and conditional if/then actions all provide the flexibility necessary for your rules. It's just figuring out how to define it within the Rule system engine.
Based on the above, your request is tricky. Inactive greater than 15 minutes is generally an expression. You need an event of inactive to start the counter. Without the event, Hubitat would view this as an expression that needs to be evaluated. This could be done in the actions of your rule, but not in the triggers or required expression.
However, there is away around it using Hub variables like @pseudonym suggested. The other way could be creating an motion aggregation zone with an Activity Timeout of 15 minutes (Zone Motion Controller | Hubitat Documentation). This would create a virtual motion device that only goes inactive after the Activity Timeout. Your m-Zone inactive could be used as a required expression with the temperature can help with the rule.
Required Expressions:
Temperature equal to or greater than 27
m-Zone inactive
Mode is not Away
Triggers:
Motion active on any of the device 1,2,3
If you wanted a trigger on the individual device reaching a certain temperature, just create a second rule and define it how you want. It is perfectly fine to have multiple rules working together rather than one large complex rule.
Probably the same as others have posted, however maybe the way I look at things will "click" for you.
For me it was knowing the fact that the Hub does NOTHING unless there is a trigger. The trigger could be:
An trigger occurring from "Select Trigger Events"
Internally when some time related trigger occurred.
For your "AND" goal, you must trigger on both (or more) triggers.
Then in the "Create Conditions" section you can test if the other requirements are true by using an IF statement.
For "Define Required Expression" sequence;
Any of the defined triggers go true.
The hub checks if the "Required Expression" is true.
If so then the Hub moves on the the "Create Conditions" condition
If Not then the Hub ends actions at this point.
Triggers can only be events. Conditions can only be states.
A change in state is an event. e.g., Temp > X is a state. Temp increases by Y or becomes greater than Z is an event.
When I create a rule, I start with the primary event that should really kick everything off - that's my first (and often only) trigger. You can have more than one trigger, but only with "OR" -- they can't be associated by "AND" since the likelihood of multiple events happening exactly simultaneously is zilch.
Using conditions (either as Req'd Expression, or inside the rule, or both) and defining event-based actions then enables you to hone down how the rule executes.
Aside from all that, rules are free. Using multiple rules to do accomplish something complex is often easier and more efficient than trying to cram everything in one rule. There are no prizes for gnarliest rule.