Is it possible to include AND statements in a trigger event? I know I can in an action. I'm trying to create a trigger that behaves like:
"Front Doorbell reports activity = active AND Front Doorbell Switch is on"
Is it possible to include AND statements in a trigger event? I know I can in an action. I'm trying to create a trigger that behaves like:
"Front Doorbell reports activity = active AND Front Doorbell Switch is on"
No. Triggers are instantanous. Use a Required Expression instead.
EDIT: More explaination: Since no two things can happen at exactly the same time, so an AND won't ever fire.
Triggers are always events and conditions are always states.
Motion becomes active is an event. Motion is active is a state.
As Slate says, you can't have AND triggers because the chances of two events happening exactly simultaneously are all but zero.
ETA... The setup in your screenshot looks fine in terms of logical construction -- motion becomes active is the trigger and virtual sw/ being on is the condition tied to it.
I don't know what actions you have planned for this rule, but consider how often that trigger event may happen -- some sensors can report "active" activity as a bit of a flood of reports... If that could possibly happen here, think through how you may need to prevent this rule from re-firing over & over in a short period of time.
FWIW, there is a heading in the Rule 5.1 documentation that addresses this exact question. Multiple people have encouraged you to read this several times in the past, and this question seems like a great reason to repeat this suggestion in hopes it may help. (And the answer to another question you once had, possibly one of the first times this was suggested, is right below that. )
Thanks for pointing that out.
I expect you will want to take the doorbell activity out of the required expression.
Think of the Required Expression conditions as the state things are in before any trigger fires.
From your original explanation of what you are trying to setup:
The first of the two is an event, describing the event that should trigger the rule to run, being that the doorbell reports a change in the state of the "activity" attribute from "inactive" to a state of "active".
The second is a condition that needs to be met in order for this state change to trigger the rule, i.e. you only care about the change in the "activity" state when the doorbell switch is "on", if it is off, you don't want your rule to fire.
Your screenshot shows you have a Required Expression with the doorbell activity needing to be active. I don't think this is what you want as a required state in order for the rule to fire. The choice of the event of the doorbell reporting a state of active (normally) indicates that the state has changed to this value, implying it was not active already.
I find it helpful to illustrate with an example.
"The door opened" is an event, and can be used as a trigger.
"The door is open" is a state, and can be used as a condition within actions, or as a required expression.
I see your point having the activity = active as a required expression is redundant. I've updated my rule accordingly.
-Thanks
It's not so much that it is redundant, it will be a situation that will not arise and would mean your rule would not actually trigger.
Your updated rule looks correct, btw
Thanks. It's working as expected.
I'm not trying to be nit-picky about words here, but the concern isn't that they are redundant (they're not), the issue is that it's a failed logical construction. If you don't understand that, you risk making this same mistake again in the future.
"FD reports activity = active" is not the same thing as "FD activity = active". The former is an event, and the latter is a state. By using that particular state as the Reqd Expression, it prevents the rule from firing when that particular trigger event initially occurs.
Thanks I'll keep that in mind.