The Next-Generation Rule Engine is still in development, so it is recommended to use the latest snapshot or milestone release of openHAB.
Use the Karaf logging commands to enable debug logging for automation:
log:set DEBUG org.openhab.core.automation.
Leave this on for setup and testing, but you may want to set to WARN when everything is setup.
For older openHAB builds before the ESH reintegration (older than snapshot 1566 and 2.5M2), you will need to change this to
Enable debug logging for jsr223:
log:set DEBUG jsr223.
This is the default logger used in the examples and the helper libraries.
Review the general openHAB Scripted Automation documentation and the language specific documentation found as links on that page.
Install the Next-Generation Rule Engine add-on.
Shut down openHAB.
Download the contents of this repository.
openhab account, copy the contents of the
/Core/ directory into your openHAB’s site configuration directory (Linux, Windows).
This will create a directory structure as described in File Locations and will contain all of the Core files for each language, including the startup delay scripts that ensure openHAB has started completely before loading other scripts.
If you do not plan to use all of the languages, you may want to remove the directories for them under
There is a main configuration file for each scripting language’s helper libraries that must be renamed.
For example, in
/automation/lib/python/, rename the file
These files can be used to secure personal information, so that they are not stored in files that may be shared with the community, or to store variables that are accesed by multiple scripts and/or modules, e.g. LOG_PREFIX.
The ‘’/automation/lib/python/personal/__init.py.example`` file must be renamed to
If you modify it, take care not to overwrite the file during upgrades.
Add/modify the EXTRA_JAVA_OPTS.
These examples assume that you will be using the standalone Jython 2.7.0 jar in the next step.
Changes to the EXTRA_JAVA_OPTS require an openHAB restart.
This option is typically used with a package repository openHAB installation (includes openHABian).
If creating a new file, remember to set the permissions so that the openhab account has at least read access.
If a file already exists and there is an EXTRA_JAVA_OPTS variable, add a space and append everything in quotes.
EXTRA_JAVA_OPTS="-Xbootclasspath/a:/etc/openhab2/automation/jython/jython-standalone-2.7.0.jar -Dpython.home=/etc/openhab2/automation/jython -Dpython.path=/etc/openhab2/automation/lib/python"
This option is typically used with a manual openHAB installation on Linux.
# Add to the top of the file
export EXTRA_JAVA_OPTS="-Xbootclasspath/a:/opt/openhab2/conf/automation/jython/jython-standalone-2.7.0.jar -Dpython.home=/opt/openhab2/conf/automation/jython -Dpython.path=/opt/openhab2/conf/automation/lib/python"
This option is for a manual openHAB installation on Windows.
If you are not using OH 2.5, 2.5M2, S1604, or newer, you will first need to update your
C:\openhab2\runtime\bin\setenv.bat file with the changes in the current file.
REM Add to the top of the file
set EXTRA_JAVA_OPTS=-Xbootclasspath/a:C:\openhab2\conf\automation\jython\jython-standalone-2.7.0.jar -Dpython.home=C:\openhab2\conf\automation\jython -Dpython.path=C:\openhab2\conf\automation\lib\python
Download the standalone Jython 2.7.0 jar and copy it to the path specified above in the EXTRA_JAVA_OPTS.
A full installation of Jython can also be used, but the paths above would need to be modified.
Jython 2.7.1 and 2.7.2a1+ will also work, but 2.7.0 has proven to be very stable.
/Script Examples/Python/hello_world.py script to
Start openHAB and watch the logs for errors and the entries from the Hello World script.
This script will make a log entry every 10s and should be deleted after installation has been verified.
Ask questions on the openHAB forum and tag posts with
jsr223. Report issues here, but please don’t hesitate to update the documentation and code.
Just like openHAB, this repository is community driven!
Check out the First Steps page for what to do next.