Rule with AND instead of OR

I created a couple of rules that automatically switch my Honeywell wifi thermostat from Heat to Cool, or vice versa, if the temp goes over/under certain thresholds. (gave plenty of buffer to prevent flip flopping)

One thing I would like to do though is integrate the weather into the rule for turning on Cool so that it doesn't attempt to turn to Cool mode if it's below 60 outside, which can damage the A/C compressor. I'd also like to maybe add a calendar check as I typically cover the A/C unit between October and March.

However it seems all the rules in Hubitat use "OR" logic. Is there any way to use "AND" logic to make sure multiple conditions are met before an event is triggered?

Triggers are "events," essentially momentary and durationless. Any trigger matching what you have selected will cause your "Actions to run" section to execute. This is why they are all tied together with "OR," an English approximation of the fact that any of them will cause the actions to run. Because they are events (momentary), not conditions (states), it doesn't make sense that there could be triggers like "door opened and switch off."

What you want to do is trigger based on whatever events you need, then use conditionals in your action to achieve the effect you want--running something if something is true, and maybe running something else (or nothing at all) if other conditions are true or in all other cases. Conditionals are IF statements, and you can combine multiple single conditions to make arbitrarily complex conditionals.

It's hard to give specific advice without seeing what you have now, but hopefully this helps you get on the right track! There are lots of example rules you can find with conditionals, and the docs are a good read (even if they're oriented a bit towards Rule 3.0 upgraders) if you haven't seen them yet.

1 Like

You cannot have AND in a trigger because that would be almost impossible for 2 triggers to occur simultaneously. You will need to pick one trigger, like temperature outside becomes < 60 degrees, then use IF-Thens in the Actions to achieve what you want.

EDIT: Oops, @bertabcd1234 beat me to the answer and his is more in-depth.

1 Like

More than one explanation is never a bad idea. :slight_smile:

1 Like

So like this?

rule

Nope I screwed that up. I see how to do it right now....

image

That looks like a good start, or possibly a good end if it's exactly what you want. :slight_smile: The "Trigger Events" are what make your "Select Actions to Run" section execute. In your case, your "Actions to Run" will execute any time your thermostat sends a reading over 72 degrees, and then your actions will set the thermostat to "cool mode" if the outside temperature is over 60 degrees. That certainly sounds like what you were describing. Note that this won't just happen the first time the thermostat goes over 72 but rather any time it sends such a reading ("becomes" can be confusing in the trigger wording in this regard), so if you ever want to manually change it to heat mode or off mode or something else, note that you might cause a fight with this rule. It also won't do anything if the thermostat is already over 72 and the outside temperature becomes greater than 60 degrees until/unless the thermostat sends another reading over 72 (that's why I emphasized the fact above that triggers are what make the actions run; nothing is inferred, which sometimes confuses people coming from ST/webCoRE).

Neither is necessarily problematic; both are just the exact outcome this rule would produce, which could be what you want.

PS - To be polite, I'd add an END-IF as your last action. RM will infer it for you, but if you had additional actions after this that you wanted to happen regardless of the outdoor temperature, then it would definitely be needed (and it's nice to put it there in any case). There is also a "Simple Conditional" you could use, which RM displays as just an "IF" rather than an "IF...THEN," which allows you to create one-line conditionals without the need (or the ability at all to use) an "END-IF," though I personally prefer to use "full" conditionals in almost all cases because it's easier to edit the rule to add more later if you want.

1 Like

Thanks. I added END-IF. I didn't notice that when I was setting it up. I'm a programmer myself so I want that there for proper syntax. :slight_smile:

I don't think the conflict with setting manually will be an issue in this specific case. I could see how it might be, but I'm home all day and want the A/C on all day if it's hot enough. The only reason I need this rule is because I live in the desert where in the spring/fall it can drop to 40 at night and 80 during the day, and sometimes we forget to flip it back and forth manually in the night/morning and end up cold while we're sleeping or hot while I'm working.

3 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.