[SOLVED] Connect multiple triggers with logical AND

I only found information to combine multiple triggers within one rule with logical OR, would it also be possible to use AND there?

  • Platform information:
    • OS: openhabian
    • openHAB version: 2.4-M5

AFAIK this is not possible. You can do your AND checks inside the rule. Or if your items are all switches you can put them into a group that changes on only when all members are on and trigger the rule by the group.

i thought about combining different trigger types, e.g.
when
item_trigger AND time_trigger
then

to use an additional IF condition within the rules then part is an option of course, but this way might be more comfortable

And with time_trigger do you mean cron trigger? Or just if it’s specific time of day?

yes, I thought about cron as a second trigger condition :slight_smile:

Can’t think of a situation where this would be useful where you trigger once a day and check for item state. Could you elaborate this a bit more? But with these given facts so far I suggest to trigger your rule with cron and write an if statement that checks for a particular state of the item.

if ( Item.state != ON ) {
     return;

Somebody correct me if I’m wrong but this should also pass the rule if the state is NULL. E.g. after system restart.

The reason you can’t find Information about combining triggers with AND is because such a trigger-combination will ONLY work of all selected triggers are tripping at EXACT the same time. What you probably want is that the rule is performed when all your conditions are met, which could happen when any of your Triggers tripp (which would call for an OR combinationof the triggers AND a check of all conditions in the when part ).

1 Like

thx gitMiguel, thx opus!
my problem is, that a temperature_item is changing quite often and this is needed some else where. But this temperature_item also triggers a rule, which is to update only each 10min → cron.
opus, I got your explanation, and understood, thx. So I will use cron only as a trigger and put an IF condition for temperature_item into the then-part of the rule.
there a condition like

item changed at least

might be helpful. :wink: But I only found

item changed from X to Y

I think I have to use a local var Number to store the old temperature value and only proceed with the rule, if actual state of temperature_item deviates from var Number. This will prevent the rule to be handled too often.

Post your code when you have worked something out and we’ll help

Searching for threads wi ‘hysteresis’ throws up several, such as