[Solved] OH3: How to get running with JSR223 JavaScript Rules?

  • Platform information:
    • Hardware: Synology 918+ 12 GB RAM (OH in Docker)
    • OS: DSM 6.2 (Debian in Docker)
    • Java Runtime Environment: (Java 11 in Docker)
    • openHAB version: OH 3 Snapshot from 2020-11-30 (after M4)
  • Issue of the topic:
    I used the openhab-helper-libraries for JavaScript the last years with openHAB 2. Now I try to migrate and do not know how to get running.


  • Do I still need the libraries in /conf/automation/lib?
  • Do I have to set something up / download anything?
  • I use the JSRule notation (form Simple Rule?): Can I still use it? If not, what is the right approach?

You see, although proudly owner of openHAB since 1.5, I am a little bit lost…

It seems that the libraries are broken because if I load them I get an Joda Time error. But I am not sure if this is the real reason.

Is there any documentation (or any piece of information I did not found yet) for start? I searched the community forum but without success.

And last but least: WOW! What a progress with openHAB 3! Thank you for your engagement! For everyone who helps - no matter whether developer or community manager. You, the people, make openHAB great (not again)! :slight_smile:


You are using an unstable non-production release of OH… how is it over there on the bleeding edge!? While you’re over there, you might as well go ahead and get everything prepared for the helper libraries and I’ll join you when things stabilize! :wink:

I have been busy with other projects and finalizing some add-ons for use with OH 2.5.x. When they are done, I will be creating OH3 versions of the add-ons and making sure the helper libraries are usable. I’m already aware of several things that will need to be updated. With how volatile things are, there will likely be many more things added to that list before there is a stable OH3 release. I’m not sure if it has been finalized, but the recent addition of an automation threadpool could require everyone using scripted automation to return to the dark ages of the rules DSL. Everyone’s rules may need to be rewritten to implement ReentrantLocks and remove the places where new threads are spawned to take advantage of not having to live with the limitation of a threadpool :sob:! This could cost me a lot of time.

Yes, this has not changed, though this directory is only a suggestion. Your libraries can go anywhere, but it is best for everyone to chose the same location to make it easier to give and receive support.

There will be updates, and I will post in the forum when everything is ready.

I’ve been getting in some changes to the JS libraries to aligned them with the Jython libraries. Eventually, the JSRule notation will be changed, but as I have done with the other libraries, I won’t make any fast moving breaking changes. I’m also working on implementing releases and versioning, so that you can update as quickly or slowly as you wish. If you turn on notifications for the helper library repo, you can keep an eye on the issues that have been reported, the progress that’s being made, etc. Once the add-on for the Jython helper libraries is available, I hope to get one together for JavaScript too, which will allow the libraries to be installed/updated through a UI.


Hi @5iver,

LOL! Here on the bleeding edge it seems a little bit lonely. It seems that not so many people try it (or use JSR223 JavaScript in general?). So thank you that you responded.

I was absolutely sure that it is not ready and I am used to build some dirty workarounds while everything is improved. I did not exspect anything…

But there are only a few tiny pieces of information regarding JSR223 JavaScript. I didn’t want to increase pressure! I have a working instance but I was so curious… :grin:

So, thanks for your great work, I am a big fan! If I can help you testing, feel free to contact me.


1 Like

There is a little bit of documentation for JavaScript rules created through MainUI/REST API and I’m doing my best to come up with more. We can’t wait for things to settle before writing the docs that need to come out when OH 3 is released so I’m unable to rely on the Helper Libraries or anything that doesn’t come with OH out of the box for these docs.

It’s all a bit scattered at the moment though. I don’t have nearly as much time as I need to work more on them and I’m still learning a lot as I go.


Continuing the discussion from [Solved] OH3: How to get running with JSR223 JavaScript Rules?:


for the time being I am in the process of setting up an OH3 test system.
I wrote some rules in Javascript using the helper libraries.

Some/ first observations:

  • as JODA time is gone I commented it in utils.js
  • PersistenceExtension errored … I renamed the file and commented it in utils.js (line 68)

The view rules I migrated so far work now …


1 Like