Rule Triggers in openHAB 2

Hi There,

my move from OH1 to OH 2 goes on and i am now diving into my rules. The questeion is now what are the possible triggers in oh2?

As far as i remember somewhere was written that there should be new timetriggern and other new stuff. Would please someone be so kind an give us a short overview what is currently there and what is expected in the future.

Thanks
Thomas

afaik this is future… see current infos about migration.

@Udo_Hartmann

Thanks for the information. I think it would really be great if someone could wite something like a road map. based on all the not documented, not implemented, partly implemented information oh2 is to me more alpha than beta.

But please do not understand it wrong i really appreciate all the work and i see as well that everyone has a real life besides oh.

Thanks
Thomas

I’m very happy that openHAB2 and it’s documentation takes ride on :wink:

I have added some docs regarding rules in OH2.

Rules are more or less identical to OH1, see here.

What you refer to as the “new stuff” is likely the new rule engine - note that this is work in progress and I do not recommend to use it productively yet. For the ones that want to play with it, see here how to install it.

2 Likes

Nice and clear :+1:
However there are two dead links to http://docs.openhab.org/features/automation/scripts
Is this work in progress :wink: or an issue?

Probably a left over from copying the docs from OH1. Could you create a PR to remove those links?

Done!

1 Like

So I am trying to write a rule in PaperUI that will trigger based on a change, but I would like the matching to be <= > etc as is provided in the ‘but only if’ part, by choosing the item has a given state option.
The exact use case is to send a command to lower the blinds if the temperature in the room is greater than or equal to 23C.
Currently I can test if the temperature is exactly 23C, but of course it could change from 22.5 to 23.5 and then the rule would not fire.

I am pretty new to Openhab, and rules, however having looked at this I am sure you could check just for status changes and use the ‘Only when’ option, which does have the required ‘greater than, less than, equal, etc’.

Hi Mike, that is what I can’t figure out. How to write a status change (trigger) that works for greater than or equal - they are just exact matches.
Same problem for time, if you wanted to have a trigger every 5 minutes, you would use the NTP binding to have a time source, but there is no way to match on every 5 minutes.

I mean you can set a rule for the temperature that fires on ANY change, just leave the ‘from’ and ‘to’ boxes empty, this will fire on ANY status change. Then you create an ‘only/if’ condition on the same rule that is (in your case) if the state is greater than or equal (>=) 23.

You’ll have to create a second rule to turn the servo off, in exactly the same way, but maybe having the only/if rule less than (<) 21 or whatever you think is appropriate.

1 Like

@psych great - that worked. I had no idea the you could leave blank the from and two boxes. Thanks for this tip.

You might also want to create another ‘if’ rule on both conditions to only fire when the relays are on or off, else you will be sending ‘on’ commands to the relay every time the temp changes, even though the relay might already be on. Not a big deal but saves on network traffic.