Iām still learning how to best set up small ācomplexā rules and could use some feedback on this one here. Itās not working 100% of the time and Iām having a hard time seeing in the logs why that might be the case. I donāt think the problem is with a Lutron Shades and Hubitat so that is leading me to believe that I still need to work on how to conditionally write my rules.
Goal: IF we are not both not home and the guest āswitchā is off, THEN close the shades and turn off the fan.
Iām still struggling to figure out the differentiation of predicate and trigger.
I should mention that the presence indicator is working as expected. When the shades do not go down I look at our presence and it does show that we are indeed away. I also double check the rule and see that the predicate rules are highlighted as true.
I suspect that the āAliciaās Presence, Danās Presenceā predicate condition is conflicting with the āleavesā trigger. Try removing them from the predicate to see if it helps.
They are quite different. Most rules probably do not have or need predicate conditions, so I wouldn't start by thinking of them first (even though they are at the top of the UI). A trigger is something that makes your rule actions run. So if you didn't have a predicate condition defined in your rule, your actions would run any time either of your sensors leaves.
Using a predicate will stop trigger events from actually triggering the rule when the predicate evaluates to false. A predicate becoming true or false will not cause anything to happen on its own. So in your rule as written, your actions will run any time either presence sensor leaves if both were already not present and that other switch is off. As you can imagine, this doesn't really make sense and is unlikely to ever happen (the times it does work are probably explained by the fact that sometimes the last sensor going away causes the rule to realize the predicate is false first, while other times it sees that the trigger event matches first--i..e, Sebastien's guess above).
So I'd second Silvva's idea above, though you don't need to get rid of both parts of the predicate condition. The Guest Switch would do just as well in either place. If you wanted to leave just that in the predicate, you could do something like:
Predicate:Guest switch off
Triggers:Presence 1, Presence 2 any leaves
Actions:
IF (Presence 1, Presence 2 all away) THEN
Off: Fan, Shade 1, Shade 2
END-IF
For the sake of completeness, the other way (and the only way you could do this in Rule 4.x) would look like:
Triggers:Presence 1, Presence 2 any leaves
Actions:
IF (Presence 1, Presence 2 all away AND Guest Switch is off) THEN
Off: Fan, Shade 1, Shade 2
END-IF
Thanks for everyone's replies! I ended up trying @bertabcd1234's example and tested it out and it has worked as expected so thank you for that. I do have one more example that I am struggling with:
IF Temperature is greater than 75, turn on fan. But only do so between the hours of 8am-8pm and only when there is someone in the house.
I already have a rule that turns off the fan when someone leaves, so this rules involves turning that fan back on, but under specific conditions.
Any thoughts would be helpful as I am not sure where to start on this one.