There are actually two ways to do this. The first is with the beta add-on and manually adding the helper libraries. The second is to use the Jython 2.7.0.jar and add it to a given location (typically in the $CONF/automation/jython folder that needs to be created), then point docker-compose to the file location and restart OH so it picks it up. I recently moved from the add-on to the 2.7.0.jar, so Iāll try and address both.
Iām assuming NGRE is installed in your docker OH image.
Install the org.openhab.core.automation.module.script.scriptenginefactory.jython-2.5.0-SNAPSHOT.jar file in the [docker path]/openhab/conf/openhab2-addons folder.
Download the helper libraries from here to your openhab/conf directory (or someplace else - youāll be mimicking the directory structure of this download in your openhab-conf/ directory).
It has all of the helper libraries - some of which you will have to use, and some of which you will probably want to use. I put the whole zip file in the conf directory to keep all of the sources (just a personal decision) and then created the directory structure manually.
The structure should look like this. Essentially, you need an āautomationā folder in your openhab/conf directory (along with rules, items, services, etc folders). In the automation folder, you will need need a directory structure for the libraries/modules (/automation/lib/ā¦), and for the scripts (rules) in (/automation/jsr223/ā¦). The subdirectories below those paths are for the language choices, then for files for either the core helper libraries (core - required to have), community contributions (some good stuff in there), or your own stuff (personal folder). So, from the downloaded zip file, you need, at minimum, to put in the core files to /automation/jsr223/python/core and the same to on the /automation/lib/python/core side.
At that point, the directories will work and the files are there. Now you have to make some changes to the config files in the automation structure you just created (easy, but easily overlooked). At this page on the docs, pay attention to step 8. Once you have the core stuff in place, you need to make it āactiveā by renaming these files from default.
The easy way to test it before an OH restart is to put the hello_world.py script from the original downloaded files in [wherever you downloaded them]/openhab-helper-libraries-master/Script Examples/Python/hello_world.py into your /openhab-conf/automation/jsr223/python/personal/ directory. Now restart your container and watch the logs. The hello_world script should eventually load and youāll see it spamming you. At that point you can move or delete it and youāll be good to go.
The instructions for using the 2.7.0.jar are about the same, but you have to tell OH where to find it. Youāll stop OH. Remove the beta add-on. Download the 2.7.0.jar and create a directory in your automation folder called ājythonā and put the .jar there. Then in your docker-compose file, point to where it is:
EXTRA_JAVA_OPTS: ā-Xbootclasspath/a:/openhab/conf/automation/jython/jython-standalone-2.7.0.jar -Dpython.home=/openhab/conf/automation/jython -Dpython.path=/openhab/conf/automation/lib/pythonā
Then restart it.
That was a bit verbose, but hopefully it helps. Once you get it, itās straightforward. IMO, whatās missing in the docs is a big picture context to what all youāre doing. Basically, youāre adding jython.jar support to some location and building a directory structure with the downloaded helper libraries. Thatās really all there is, but it is error prone, especially when it lacks a bit of context for a new user.