Hello,
I’m somehow stuck somewhere and would highly appreciate some hints and questions to move forward.
What I want to do is to use Jython scripting for all my rules and functions to implement. Searching addons as well as community I found two subjects:
a) “Jython Scritpting” addon; installation easy and it works; script developed using the buildin editor in OH UI
b) found on Github “openhab-scripters” https://openhab-scripters.github.io/openhab-helper-libraries/Getting%20Started/Installation.html
Point 1 to 9: ok
Point 10: found the my “start.sh” in folder “/usr/share/openhab”
When setting up the “bootclasspath”, “python.home” and “python-path” it seems I’m stuck.
Jython 2.7.2 installation: “/opt/jython”
/opt/jython $ ls
ACKNOWLEDGMENTS Demo Lib LICENSE.txt registry
bin Doc LICENSE_Apache.txt NEWS tests
CoreExposed.includes jython.jar LICENSE_CPython.txt README.txt
Here is what I added at top of “start.sh”:
export EXTRA_JAVA_OPTS="-Xbootclasspath/a:/opt/jython/jython.jar -Dpython.home=/opt/jython -Dpython.path=/opt/jython/Lib"
When I place a simple script under folder “/etc/openhab/automation/jsr223/python/personal” I can not find the script somewhere in the UI or being executed.
Script in UI editor, “simpletest”:
from org.slf4j import LoggerFactory
LoggerFactory.getLogger("org.openhab.core.automation.examples").info("Hello world from UI scripting!")
Script in folder personal, “test.py”
from org.slf4j import LoggerFactory
LoggerFactory.getLogger("org.openhab.core.automation.examples").info("Hello world from Python IDE!")
Thanks in advance. Now going to have a good wine, maybe this helps too.
Bernhard