Rules question can I and in a trigger?

Hi Guys Here is my current rule, questions below:

rule "AC Filter Triggered Fire Light"
    //Item AcFilterClear changed and
    Time cron "0 0 0/1 1/1 * ? *" // Every hour when flag is set.
  if( ( AcFilterClear.state == ON && Kitchen.state == ON ) && ( now.getHourOfDay >  8 && now.getHourOfDay < 21 ) ) {
    //mappings=[NONE="None", SELECT="Alert", LSELECT="Long Alert"]
    logInfo(RuleLogName,"Ran Cron Only in Home_triggers")

Question, can I setup a rule to say:

Trigger A and
Trigger B

Also, can I trigger with something like when item on or an if statement? Vs item changed. I am trying to avoid having the hourly cron with the if in the body of rule. This is not a requirement but a curiosity.


No, you can’t. Since all triggers are based of events, the two events would have to happen at exactly the same time, which isn’t possible in practice.

Triggers are essentially compared with an OR operator. The new rule engine introduces the concept of Conditions, which are doing the same as your IF statement. There’s no benefit in using Conditions in scripts, but they are handy when creating rules in the UI. Using the Rules DSL, there’s nothing more efficient than what you are doing.

1 Like

Thanks all! I wanted to confirm!