I just submitted a PR that adds a core feature for a JythonScriptEngineFactory and it would be great to have some testers! Basically, this will allow for the installation of Jython with the core and community helper libraries through Paper UI, once the PR is merged. If you’d like to test it, you’ll need to…
- Shutdown OH
- Backup OH
- Clear your cache
- Copy the
OPENHAB_RUNTIME/system/org/openhab/core/bundles/org.openhab.core.automation.module.script/2.5.0-SNAPSHOT/directory, replacing the one that exists. You may want to change the file extension of the existing jar, in case you want to easily rollback without a full restore (just clear the cache again after changing it back).
- Copy the
OPENHAB_CONF/addons/. This jar contains the core and community libraries, so there’s no need to copy them from the repo, however, the scripts will need to be copied to /automation.jsr223/python/core/.
- Restart OH and watch the logs
The files are located here.
These instructions are very short and assume you are familiar with how to setup Jython and the HLs. Once these jars are installed, the core and community libraries are installed, but you still need to setup your personal libraries and scripts. Include step 7, but understand that the core libraries (/automation/lib/python/) are in the jar, so the ones you copy will be ignored. You still need the configuration.py though. I’ll update the docs when the PR is approved. Steps 10 and 11 should be skipped. I’ll come back to answer questions and fill in some gaps!
Edit: Just had a thought. If you already have Jython setup, stop OH, remove your EXTRA_JAVA_OPTS setup for Jython, clear the cache, and install the jars. The existing libraries on your filesystem will be ignored.