4.2+ Rules discussion thread?

ECMA script is in the documentation as being deprecated. I currently use DSL for everything, and have tried a few alternatives.

For a text based solution, what is the direction openHab is going for rules? Is there a discussion thread I can read up on?

No it isn’t. Only one of the two ECMAScript add-ons is, but not both.

Nashorn JS is deprecated. It’s no longer supported upstream and it provides a version of JavaScript that is nearing a decade old.

However the JS Scripting add-on (aka GraalVM JavaScript) provides the most recent version of JavaScript, it is what Blockly “compiles” to, and both the add-on and the helper library are continuing to be supported and developed. Because of Blockly, it’s probably the most used rules language now. And yes, it supports file based rules,.

Another good choice is jRuby which is also receiving continuing support and development.

Jython has recently been resurrected with a new volunteer providing support for it. It is no longer marked as deprecated in OH 4.2+.

Groovy has always been supported, though the docs are a little spare.

There’s an add-on on the marketplace to use Java with jRule which is undergoing continued development.

HABApp is external to OH but has a sizable community of users and is undergoing continued development.

None of these would be a bad choice, though I might wait on Jython a bit for the new maintainer to bring it up to parity with the other add-ons before jumping in, unless you want to help what that effort. I’m expecting that the helper library will change significantly in the near future so you might need to adjust your rules if you jump in right now.

All of the above are text based. All of the above except for jRule and HABApp work for both managed rules (i.e. defined through the UI) and in files. jRule, only supports files last time I looked and HABApp is external to OH so obviously does not support managed rules.

What direction is OH going? All of the above. All of these are actively supported with a sizable community of users. JS Scripting is probably the most used but that doesn’t mean the others are less capable or supported.


Excellent review. Thanks!!

I tried JRule oh, about in 2022. It worked, but was cumbersome and bulky with all the classes. I’ll try it again.

But, JavaScript would seem to be the one with least friction and good support.