[beta testers wanted!] Jython addon w/ helper libraries (requires OH 2.5.x)

This is not true - DSL rules still work in OH3. Can you link to any authoritative statements which says that DSL rules won’t work in OH3?

I’m running OH 2.5.9 on Java 11(openjdk) with these Jython addon from this thread. And it’s working nicely.

1 Like

Having a Jython add-on can fix it for OH3 too. :wink: It’s the manual installations of JARs in /runtime/lib/ext that most likely also won’t work for you with Java 11.

did you read the post?

Or do you just need to have a discussion with someone?

Interesting response.

Of course I did.

I just want to make sure that other people don’t potentially waste their time moving from DSL to something else for no current benefit, so asked where you had previously seen that rules DSL would not be compatible with openHAB 3 so it could be corrected!

Let’s hope not, because I also switched to Jython…

They are supported, but currently you need an add-on for them to work.

The libraries work great and can be manually installed. However, the add-ons waited through out the entire 2.5.x development cycle without being merged, so they need to be recreated for OH3.

To put things in perspective, an open source project won’t ever die if there are people willing to contribute. The problem with OH is that people are willing to contribute, but they and their contributions are being turned away. OH development is extremely slow, mainly due to being a dictatorship (kaiHAB). When enough developers are ignored, blocked, or mistreated, the result and solution is a fork. That will mean the death of OH, but it will also be the birth of another project with a better means of managing, supporting and leading the contributors, and more opportunity for the user community. Stay tuned!

The old rule engine was planned to be removed, but the fate of rules DSL was unknown. Any information about that in the forum was premature. There were some incorrect posts about it and I did my best to correct them, which led to this…

What/whose posts are saying that the DSL was going to be removed? Keep in mind, the old rule engine is NOT the rules DSL… they are two different things.

That is incorrect. Worst case, you will need to manually install a Jython and helper library add-ons. Best case, my add-ons get merged. Unless you are a developer or masochist, don’t jump on OH3 until 3.1.

No! Jython is leagues beyond the DSL, and if you don’t think so, then you are not using it right! You migrated, saved a lot of headaches, gained performance, and can do much more than any other scripting language currently available. Wait until OH3 is released and you will hear the screams!


As much as I understand your discontent that rised up over the time (and I´m just a viewer on this topic as I don´t understand much of the technical things you are all talking about). I think neither you than anyone else here, should be that subliminal aggressive or pejorative to each other as it feels right now to me.

This is valid for this thread as well as How to Setup Jython


To not let such provokative and false claims be uncommented here, I’d like to remind everyone that I tried to do my best to have openHAB not depend on my person, but to have an open and transparent governance structure. Decisions are not taken by me, but every maintainer has an equal say. Furthermore, any contributor can potentially become a maintainer.
Being blamed for taking part in discussions and spending my time on them feels pretty wrong to me. And by saying this, I do not at all want to blame the other maintainers for not taking part in some discussions, because I am extremely thankful to all of them for what they do and how they invest their time, energy and superb skills.


Only because you bring it up again:

  • Over and over again I made posts sometimes repeating verbatim something you or Kai said here or in github (including the fact that Rules DSL might become deprecated) only to have you swoop in and say “no!”

  • I always tried to put lots of “I think” and “I hope” and other hedge words to show this is my opinion and understanding about where things are going and I’m accused of making definitive statement on behalf of the OH Foundation.

  • I finally gave up when I mentioned that a Jython add-on was in work and hopefully would become available; the very topic of this thread, and I was accused of giving people false hope.

What conclusion was I supposed to come to? It wasn’t what I was saying, since I was only repeating what you had already said. It was the fact that I was the one saying it. It’s hard not to be offended by that so I withdraw as much as I can on the topic, and not happily. No more talk about what is possible or where things are going. Somewhat limited posting on anything having to do with Jython rules. And probably by the time I move over to OH 3 no more Jython at all as I move to JavaScript. My end goal was to develop Rule Templates anyway and I want to make them have as few external dependencies as possible.


If we was a real dictator your account had been locked a long time ago. There were enough reasons for it

1 Like

I suppose everyone involved should relax, take some time and try to get comfortable with the thought that there where a bunch of misunderstandings and resulting negative emotions involved here.
After all we’re here for fun and not for fighting. We should leave the fighting to “competing” smart home solutions :slight_smile:

I hope everyone can forgive and forget and start over in the near future. For OH3 the time for powerful scripting (with the helper libraries) has come. IMO this also deserves a high rank in the features for the (public) promotion of OH3


Problem with unrecognized Python built-in function “isistance”

I am using openhabian 2.5.9-1 on a raspberry pi 3b.
I followed the OP to install this Jython addon and I managed to run the hello world example and some other scripts too. I am unable to use the built-in function isistance as it gives the following error

2020-11-01 17:18:30.312 [ERROR] [Jython Hello World (cron decorators)] - Traceback (most recent call last):
  File "/etc/openhab2/automation/lib/python/core/log.py", line 51, in wrapper
    return fn(*args, **kwargs)
  File "<script>", line 21, in hello_world_cron_decorators
NameError: global name 'isistance' is not defined

The script that I am trying to execute is the following

from core.rules import rule
from core.triggers import when
from core.log import logging, LOG_PREFIX, log_traceback
from threading import Timer

log = logging.getLogger("{}.HelloWorld".format(LOG_PREFIX))

@rule("Jython Hello World (cron decorators)", description="This is an example cron triggered rule using decorators", tags=["Test tag", "Hello World"])# description and tags are optional
@when("Time cron 0/30 * * * * ?")
def hello_world_cron_decorators(event):
    dummy=Timer(10,lambda : log.info("Hello World,Timer elapsed")).start()
    log.info("Hello World,Timer launched!")
    if isistance(dummy,Timer):
        log.info("it works")
        log.info("it does not work")

The scripts executes, launching the timer but it fails to execute the line containing isistance.

I can’t figure out what I am doing wrong. Is it a problem with my installation?
The full log is

2020-11-01 17:18:30.254 [DEBUG] [e.automation.internal.RuleEngineImpl] - The trigger 'Time_cron_0_30_921296401c5d11eb992116ecc463c7ee_93ada89e1c5d11ebaf7516ecc463c7ee' of rule '9d3f8d9a-708a-47e4-9ef3-4d1a8410d293' is triggered.
2020-11-01 17:18:30.296 [INFO ] [jsr223.jython.HelloWorld            ] - Hello World,Timer launched!
2020-11-01 17:18:30.312 [ERROR] [Jython Hello World (cron decorators)] - Traceback (most recent call last):
  File "/etc/openhab2/automation/lib/python/core/log.py", line 51, in wrapper
    return fn(*args, **kwargs)
  File "<script>", line 21, in hello_world_cron_decorators
NameError: global name 'isistance' is not defined

2020-11-01 17:18:30.319 [ERROR] [e.automation.internal.RuleEngineImpl] - Failed to execute rule '9d3f8d9a-708a-47e4-9ef3-4d1a8410d293': Fail to execute action: 1
2020-11-01 17:18:30.323 [DEBUG] [e.automation.internal.RuleEngineImpl] -
java.lang.RuntimeException: Fail to execute action: 1
        at org.openhab.core.automation.internal.RuleEngineImpl.executeActions(RuleEngineImpl.java:1197) ~[bundleFile:?]
        at org.openhab.core.automation.internal.RuleEngineImpl.runRule(RuleEngineImpl.java:993) [bundleFile:?]
        at org.openhab.core.automation.internal.TriggerHandlerCallbackImpl$TriggerData.run(TriggerHandlerCallbackImpl.java:91) [bundleFile:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_265]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_265]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_265]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_265]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_265]
Caused by: org.python.core.PyException
        at org.python.core.Py.AttributeError(Py.java:205) ~[?:?]
        at org.python.core.PyObject.noAttributeError(PyObject.java:1013) ~[?:?]
        at org.python.core.PyObject.__getattr__(PyObject.java:1008) ~[?:?]
        at core.rules$py.execute$6(/etc/openhab2/automation/lib/python/core/rules.py:110) ~[?:?]
        at core.rules$py.call_function(/etc/openhab2/automation/lib/python/core/rules.py) ~[?:?]
        at org.python.core.PyTableCode.call(PyTableCode.java:167) ~[?:?]
        at org.python.core.PyBaseCode.call(PyBaseCode.java:307) ~[?:?]
        at org.python.core.PyBaseCode.call(PyBaseCode.java:198) ~[?:?]
        at org.python.core.PyFunction.__call__(PyFunction.java:482) ~[?:?]
        at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237) ~[?:?]
        at org.python.core.PyMethod.__call__(PyMethod.java:228) ~[?:?]
        at org.python.core.PyMethod.__call__(PyMethod.java:218) ~[?:?]
        at org.python.core.PyMethod.__call__(PyMethod.java:213) ~[?:?]
        at org.python.core.PyObject._jcallexc(PyObject.java:3626) ~[?:?]
        at org.python.core.PyObject._jcall(PyObject.java:3658) ~[?:?]
        at org.python.proxies.core.rules$_FunctionRule$16.execute(Unknown Source) ~[?:?]
        at org.openhab.core.automation.module.script.rulesupport.shared.simple.SimpleRuleActionHandlerDelegate.execute(SimpleRuleActionHandlerDelegate.java:34) ~[?:?]
        at org.openhab.core.automation.module.script.rulesupport.internal.delegates.SimpleActionHandlerDelegate.execute(SimpleActionHandlerDelegate.java:59) ~[?:?]
        at org.openhab.core.automation.internal.RuleEngineImpl.executeActions(RuleEngineImpl.java:1189) ~[bundleFile:?]
        ... 7 more

typo, should be isinstance()


That’s really silly! Thank you.

OH3 M3 came out.
Is there a prospect to add support for jython soon?

good question

Absolutely! I have add-ons for Jython, Jython helper libraries, Jython TransformationService, jRuby, Groovy, and Kotlin. I will post here when they are ready. I thought I’d have them done last week, but a big storm knocked out our power for a few days and tore up a bunch of trees that I still haven’t finished cutting up. The 2.5.x versions will be available in the Eclipse IoT Marketplace, so that everything can be installed through Paper UI. After they are done, I will submit the 3.0.x versions. Those are still waiting for an automation repo and a decision on namespaces, but that won’t stop manual installations… or a new marketplace :wink:. I will post here with updates, but will also be starting some new topics for each of them.

I stopped working 5 years ago and have many projects that keep me busy, but it is hard to ignore the ones that can buy me a :beer:! Anyone who appreciates the helper libraries or other work I’ve done can find a link in my profile! Thank you to all who have already donated… it is very helpful! :slight_smile:


I see that a Jython Automation add-on has been added to OH3 RC2! Can anyone explain what this means with respect to the Helper Libraries? Are they part of this add-on? I have not found something like a migration guide for 2.5 to 3.0 (both in general and for Jython in particular) but would like to try it soon. Are there instruction on how to use the add-on, where to place py files, etc available somewhere? I want to add that I’m pretty much an application layer programmer and are not deep in OH’s internal structure…

I do not think that it works. I haven’t seen anything in that from 5iver and it gives still error message: [ab.core.service.AbstractWatchService] - ScriptEngine for py not available. So I think it does not work. I will do some trials later but I do not think that is is a working addon at the moment.

If you install the “Jython Scripting” add-on via the “Automation” add-ons type you can use Python in UI/file based rules.

It doesn’t include any helper libraries but once they are updated for OH3 they can also be included ofcourse.

1 Like