Simplified Jython rule definition (similar to Rules DSL) using a universal decorator

Unfortunately, no. The issue is still open…

I’ve looked into it, but haven’t figured it out.

@niebochod, with the help of your debugging, I was able to fix the issue on Windows where scripts were not starting when OH starts. Here is the PR…

This PR will end up in OH 3.0, but I’ve made a test jar that is built to work with OH 2.5.x. If you’d like to try it (or anyone using scripted automation with Windows!), use your console to uninstall this bundle…

bundle:uninstall org.openhab.core.automation.module.script.rulesupport

Then shutdown OH, download this jar, and copy the jar into your /addons/ directory. To test, restart OH and your scripts should start on their own.

If/when you clear the OH cache, like when updating OH, you will need to repeat these steps since the old bundle will be reinstalled and there will be errors due to also loading the test bundle. To remove the test bundle, delete the jar and clear the cache.


Works great! Thanks!

1 Like

Thanks. Works also for 2.5.3.

1 Like

For OH3 will there also be an option to have true Python 3 and support for all libraries and modules? A combination of hab app and jython with its direct access to all binding functions etc would be a dream come true.

It’s possible, but unlikely. Development of Jython 3 is supposedly being started up again, since the release of Jython 2.7.2. So, it is possible that there could be some kind of release of Jython 3 before OH 3.0. If it is in a usable state before a release, I could do a build and setup an add-on for it. Just be patient… we’ll get there!

GraalVM is a possibility, but it looks to be a bit of a dud and the adoption of it is low. Well, except for companies/apps migrating from Nashorn, since the focus has been on graal-js due to Nashorn being removed in JDK15. graal-python is still in a very immature state, but javax.script does not look like it is going anywhere anytime soon. Whatever the case, there are many more important things that should be worked on for OH automation.

If you absolutely have to use Python 3 libraries with scripted automation, you can do so using executeCommandLine to call a Python script. It’s not optimal, but it works and you don’t lose the functionality of scripted automation or the helper libraries.

Hi @5iver,

I have a question. Not knowing if this is the best place for it or if I should start a new topic for it.

I started migration my DSL rules to Jython rules. Now I am very much interested in using automation Conditions in my rules. How is that possible. Do you have an example or a link for me?

It would be possible, but I have not implemented Conditions in the helper libraries and may never get to it, since the functionality is the same as using conditional statements in the script. Keep in mind, the Triggers still trigger, even if the Conditions are not met, so you’re really not saving anything.