Rule to have Two AND Triggers?

The last thread on this was closed back in 2019.

I thought perhaps there might be some new updates regarding this.

Is it possible to have 2 Rule Triggers using AND instead of OR?

I'm trying to create a rule so that if the triggers are Season = Winter AND Outside Temperature < 8C then Close my Side Yard water valve controller.

TIA.

I do find it funny someone called Bruce is asking this question :slightly_smiling_face:

What I expect you are looking for is to include your season condition as a required expression, rather than a trigger. See the "switch" just above the triggers where you can turn on the Required Expression option and then define / select the expression to use. This option means that RM will only wait for the triggers when the expression is true.

I would like to explain a little more about triggers vs conditions, as well as triggers not being simultaneous, but might leave it for others to explain.

4 Likes

No, and it cannot ever be. Hubitat is event driven, and the likelihood of two separate devices sending an event at the exact microsecond is none. The truth whether these events are both in a particular state is done in conditions, as you have done, or possibly in required expression.

There are probably many ways to handle this, but off the top of my head you could do the following. (paraphrasing a bit here) But you will get different results for the various methods. There are likely more ways than this to do things.

Trigger: Weather reports temperature <8
Conditions:

  • If meteorological season reports Winter
  • And Weather reports temperature <8
  • Close Side Yard WAter Valve Controller

Probably better is

Required Expression: Meteorological season reports Winter
Trigger: Weather reports temperature <8
Condition: Close Side Yard WAter Valve Controller

The second way to me seems like it will be less "noisy", but there is a downside. During Spring, Summer, and Fall the rule will not even attempt to run. So that means that if for some reason during December before meteorological Winter, for example on November 30th, the valve would be open.

The First way above, it triggers the rule anytime the temp falls below 8, OR when the season changes to Winter.

So I guess it depends upon what you want to really happen?

7 Likes

Thank you both for the quick replies. It's my first time knowing about the Required Expression. I believe I understand now. I will try both of your methods.

2 Likes

I'm possibly misunderstanding the use case but isn't this sort of possible now using the new Conditional Triggers that was added?

In the example @Bruce123 is using you would:

  • create a condition condition for "Winter"
  • set the conditional trigger to on
  • select condition for trigger - "winter"
  • set the trigger capability as temperature, reports less than 8.0
7 Likes

Shameless plug: this is a common enough question that it is mentioned in the docs, which you can access using the "?" button in the top right of any rule (and similar for most apps and UI pages):

Back to the question, you've always been able to create this outcome using conditional actions since at least Rule 4.x (or was it 3.x...). However, there are some newer features that may also do what you need, depending on exactly what that is (particularly whether you just care about the temperature reporting <8 while you're already in "winter" or if you care about changing to "winter" while that is already the case). Any of these solutions could work for something along these lines, and others have given you good ideas already. Good luck!

5 Likes