UPDATE: For OpenHAB 3+ Please use this fork instead: GitHub - CrazyIvan359/openhab-helper-libraries: JSR223-Jython scripts and modules for use with openHAB - it’s maintained and contains more updates and fixes.
I stumbled across a problem during upgrading to OH3 because there’s no jython helper libraries for OH3 yet. I have managed to make some quick and dirty modifications to the current helper libraries to make it work on OH3. One last change that I need to do in triggers.py is to replace the Quartz
isValidExpression that validates a cron expression, because quartz is no longer included in OH3.
I see that in org.openhab.core.internal.scheduler there’s the CronAdjuster class that I could possibly use to validate the cron expression, however I cannot import this class into jython.
It’s late and I’m about to crash, but I thought I’d post it here to see if someone knows how to replace this isValidExpression. I can implement my own but would rather use an existing code that has been tested.
In the mean time, I’ve created a dummy isValidExpression returning True, and commenting out the some parts of triggers.py in the helper libraries. I’ve created a rudimentary replacement for
isValidExpression, which I will improve upon should it be necessary. At least my rules are working on OH3, after converting Joda datetime to ZonedDateTime.
EDIT: I have posted my working version on github here (note the oh3-patch branch):
It’s meant as a temporary fix until the official fix is available from @5iver.
All you need are these two directories:
Placed them into your conf/automation/(jsr223 | lib)/python/core correspondingly