Openhab2 Rules in Openhab3

Hello,

I just built a new Openhab3 system (upgraded from a Pi3 to a Pi4). I’m trying to migrate my Openhab2 rules to Openhab3 and I’m having issues with a few of them. It seems the new ‘Rules’ interface isn’t as flexible as the old one. This is mostly dealing with the ‘Trigger’ condition, I realize I can run scripts after it’s been triggered… but complicated triggers are hard/impossible?

Astro rule:
when current time > dawn
then…

Vacation rule:
when away == true and (dusk or night)
then…

Questions:

  1. If I use the code from my openhab2.rule how to I set variables in there, it doesn’t seem I can have a rule trigger a script and pass anything in.
  2. If I use code from the openhab2.rule which sections do I keep and throw away? My gut instinct says to keep the stuff between ‘then… end’
  3. Can I simply copy my rules/openhab2.rule to rules/openhab3.rule? Documentation not clear on this.

Thx!

This was never possible in OH2 either. It’s just not an event suitable for trigger…

That depends on an item name I expect.

Hello,

It was shorthand, essentially comparing current time to dawn start time. But the question still stands, can I simply copy the openhab2 rules to the openhab3 rules?

The main change in OH3 involved time & date calculations.

Yes, but because datetime handling has changed with the use of Java11 you will need to change anywhere you use that.

1 Like