I created a rule that when jack or barbara arrives, set the thermostat to 76 but if one of them is already home, don't change the temperature. Unfortunately, the rule I made does not work. Take a look at this:
What did I miss?
I created a rule that when jack or barbara arrives, set the thermostat to 76 but if one of them is already home, don't change the temperature. Unfortunately, the rule I made does not work. Take a look at this:
Did your screenshot cut off the “exit if” command, or is it omitted from the rule?
This would be the perfect rule to use a conditional trigger. An example rule is provided below.
There are two presence sensors in this rule:
The rule is triggered when either presence sensor arrives, but only when BOTH are not present.
The problem with your rule is that the trigger is causing the first action to be true. If the trigger is Jack arrives, when the IF is evaluated, Jack will be present. There is no way to get to the ELSE in your rule.
This is where I use [RELEASE] Combined Presence to help. I've got a virtual presence that is "Somebody is Home" that serves as a master type presence device to trigger based on first arrival or last departure. It works really well for my needs.
I made this rule:
My wife is gone, and I took my dogs for a walk. When I came back, the thermostat should have changed to 76 but it didn't.
Please turn on logging for that rule:
Events
Triggers
Actions
And then post a screenshot of the log (when the Rule runs).
Thanks!
Please see my post below. You're correct. Using a conditional trigger does not work. However, using a Required Expression does work. I've attached logs and a sample rule.
I can reproduce your observation that the previous rule I posted doesn't work, and can offer a solution that I have confirmed to work.
First off, as you indicated, the conditional trigger doesn't because the condition is evaluated after the trigger. Here are logs showing it doesn't work:
So I re-did the rule using a Required Expression. This is the new rule:
This rule works as expected because the required expression is evaluated SIMULTANEOUSLY with the trigger. And here are logs showing it to work as expected:
As your rule is written the following happens.
Scenario #1 No One Is Home
Barbara arrives and triggers the rule
The actions check if Barbara or Jack are home, and since she is , the rule exits
Scenario #2 Jack has been home for hours
Barbara arrives and triggers the rule
The actions check if Barbara or Jack are home, and since they are, the rule exits
=======================================================
I think that just changing the "OR" in the actions to "AND" would solve the problem
Scenario #1 No One Is Home
Barbara arrives and triggers the rule
The action checks to see if both Barbara and Jack are home, which isn't true, so it continues to the ELSE portion and sets the temperature to 76
Scenario #2 Jack has been home for hours
Barbara arrives and triggers the rule
The action checks to see if both Barbara and Jack are home, which is true, so the rule exits.
=======================================================
I like to make this type of rule simpler by breaking the logic apart.
E.g., you want when someone initially comes home to set tstat.
I do almost the exact same as @JB10 noted above. I have a Virtual Presense Sensor named "Someone Home" that is set to present when someone comes home. It is managed by a [RELEASE] Combined Presence rule that ORs our actual Presence Sensors:
This would allow me to write your rule in a clear and simple fashion:
Another advantage is that while "Someone Home" is used in several different rules, but the logic that defines who counts as someone is in one place.
Further, I notice you are using HD+ for presense. That's the other reason to use Combined Presence -- it lets you merge multiple presence inputs. "John" is actually another Virtual Presense Sensor and it is merged from 3 actual presence devices (one being HD+).