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

I’m sorry. I’ve done all I can. The maintainers have very obtusely prevented the merge of my add-ons for almost a year now, so you will need to continue to wait.

What trouble are you having? The installation for docker should be the same as for non-docker.

No… the helper libraries are included in the add-on. If you are using the add-on, just install the scripts, not the libraries.

Can’t we indtall manually? I was able to get it started on OH2.5.6.148 as I remember under Java11 with Jython 2.7.0. Probably not as I do not see installable base of the rule engine in OH3 at all.

In OH3, manual installations of Jython have been broken for a long time. I believe this is true of all scripting languages. I do not plan to spend the time to look into it until my other development efforts are unblocked. So, you currently need an add-on, but they have not been merged and are now closed. Also, Java11 will require Jython 2.7.2 or newer. Just wait… a solution is on the way!

5 Likes

I’d appreciate some clarification what all of this means? Is jsr223 with its languages not supported by OH3? Are the helper libraries not supported? Is this a dead end?

Previously, there were many messages in the community that DSL rules will not work in openHAB3 and it will be necessary to rewrite all the rules for the new engine. I rewrote all the rules and I’m ready to go, but as I understand it, there is openHAB3, but my new rules will not work? In the release notes, OpenHAB3 saw information that the DSL rules are supported. Was I rewriting my rules in vain?

It’s not so much because of OH3 but more because of newer Java versions.

The extension mechanism was removed in Java 9 so any JARs added to /runtime/lib/ext will not be used.

See also:

1 Like

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!

2 Likes

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

3 Likes

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.

4 Likes

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.

6 Likes

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

8 Likes

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")
    else:
        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()

3 Likes

That’s really silly! Thank you.