Hopefully soon. And if not, you can do anything the HTTP binding can do in a Rule using the sendHttp*Request Actions in the mean time if you decide to go down that path.
Jython is most commonly used and the Helper Libraries for it are the most mature. But JavaScript is also pretty popular. Groovy is supported but not widely used.
I think it’s worth it now. Some advantages include:
-
library support (e.g. I’ve already submitted a number of reusable scripts and modules to the helper libraries that you can just use, no need to copy/paste/edit code from the forum) Pull requests · openhab-scripters/openhab-helper-libraries · GitHub
-
it’s faster, though that almost never matters in this context
-
they do not suffer from the thread pool limitations described in (OH 1.x and OH 2.x Rules DSL only] Why have my Rules stopped running? Why Thread::sleep is a bad idea
-
the Helper Library delays the loading of the rules to avoid the startup problem where Rules start running before Items are loaded
-
they use standard languages which means there will be tons more resources in books and online to learn the languages (e.g. Free "Python for Beginners" video series)
-
also, because they are standard languages, you can use common programming concepts not available in Rules DSL like classes, functions, first class data structures, etc.
-
there are a number of OH things you can do that can’t be done in Rules DSL including:
-
enable/disable rules (see But How Do I…? — openHAB Helper Libraries documentation)
-
dynamically create rules (i.e. Rules that create Rules)
-
create/edit/delete Items from Rules (look at the OpenWeatherMap forecast library in the Helper Libraries or the test for the Countdown Timer module PR I’ve submitted)
-
access and modify Item metadata (link above)
-
there is a script unloaded function you can add to a file where you can clean things up when the script is unloaded/reloaded; very handy for cancelling running Timers to avoid errors caused by orphaned Timers
-
Rule triggers can be dynamically created at load time (see the drop in replacement for Expire 1 binding PR for an example)
-
they support a config file so, for example, you can define information in configuration.py and import that into scripts (see the generic presence detection PR for an example where the Groups/Items that indicate presence are defined in configuration.py and used to construct the triggers and access the right Items in the Rule, making it reusable as is, no editing required)
-
-
they are compatible with (i.e. run on the same NGRE) Managed Rules (rules defined through the UIs) which will probably become the default way to define Rules in OH 3
-
there is the ability to create unit tests for your Rules built in.
I’m sure there are more good reasons. There are some good reasons not to move though:
-
it’s a lot of work
-
the tooling in VSCode is not as good as it is for Rules DSL meaning you will have more errors that won’t be detected until run time so testing Rules is more important (on-the-other-hand, as time goes on you will probably find you will be reusing other people’s code more than writing your own)
-
you’ll have to potentially learn a new programming language
-
most of the examples here on the forum and elsewhere are still in Rules DSL (I’m working to add at least Python examples to all of my design pattern posts and trying to build libraries out of those that warrant it (e.g. the Gatekeeper DP has been submitted as a PR already)
-
installation is a little awkward