How to Setup Jython

It was meant as more cultural differences, not political.

1 Like

Right, since they do not rely on me. I am currently doing this work (and a million other things), but if there is a period in the future where I am busy with other projects and won’t spend a minute for openHAB anymore, you can rest assured that others are able to do the releases as well and openHAB can further evolve.

I wrote: “I’m thus very happy to see a PR with the migrated code (and adapted to the naming convention) and will do my best to very quickly help reviewing and merging it.”

I am sorry if this wasn’t perceived as a friendly, helping, collaborating and constructive statement, but as “condescending & dictatorial”. This might then indeed be a lack of my skills in bridging cultural differences.

That was meant as humorous since you mentioned spreading out the releases to keep you busy.

That is not offering assistance writing the PR. @5iver responded he is busy mow with other things.

He has offered to assist somebody else from the community to write the PR. If nobody else wants to do that it is not Scott’s fault.

1 Like

We can also help with porting the PR to OH3 and see how well that works. But it can be perceived as a hostile take over. :wink:

Thank you. I think @5iver is a little overworked currently.

Sorry, being stressed it isn’t easy to identify humor these days - thanks for trying :wink: .

Yes, that was exactly what I thought and why I actually asked him whether he wants to do it himself (and might already have started) or if he is ok when somebody else takes it over.

If we now agree that his statements can be taken that he is fine with it, that sounds good.

1 Like

Perhaps you or @wborn should PM him to ask. Do not take my opinion as fact.

1 Like

The Jython and helper library add-ons have been complete for a long time, with the exception of incorporating the changes needed to move to an automation repository and a response to the namespaces that I had suggested. As I stated above…

… these are the things that I need decisively answered for me to be able to resubmit the add-ons:

  1. We agreed back in March to move everything but the rule engine to an automation repository, but this has not yet been created. When will this be created so that I can submit the add-ons there? Or have you changed your mind?

This discussion has gotten WAY off topic from what I had originally presented. My intention was to discuss creating a repository that would hold everything related to automation, where the maintainer(s) could focus specifically on automation. I feel this is very much needed for openHAB to evolve. You and @wborn preferred to keep the rule engines in OHC, so the scope of the discussion turned to the creation of a repository for automation, but with the exception of the current rule engine. An openHAB repository has not yet been created for this purpose.

  1. I’ve waited for a response to my suggested namespaces since July, copied below. Unless I hear otherwise, I will just incorporate them into the Jython and helper library add-ons as I had suggested.

There are many more ScriptEngineFactory add-ons to submit, possibly some more helper library add-ons, but I would much rather work on a scripting API than helper libraries for each scripting language, and there are many community helper libraries that could be made into add-ons. Putting them all into this namespace will be ugly and difficult to manage, as I pointed out in openhab/openhab-core#1319 (comment). However, I will accept whatever namespace you force me to use in order to move this PR forward and to finally get it merged into 2.5.x. I suggest then to just take out the separators from the proposal I made three months ago…

org.openhab.automation.scriptenginefactoryjython
org.openhab.automation.helperlibrariesjython
org.openhab.automation.helperlibrariesjythonareatriggersandactions

  1. While we are at it… the helper library add-on has not been reviewed. Other than the above changes, are there any other changes that will be required for it to be merged? At one point you had said that they needed to be included in the Jython add-on, which is a bad idea. The two add-ons are equally important.

How is there any question about whether I would continue work on my add-ons?! I will not make any commitments for M2, since I am unaware of any firm schedule for its release or when my questions will be answered, but I’m not going to stop working on them.

Great idea… show the community how well antagonizing disgruntled contributors with snide comments motivates them!

Sure would… just like the Groovy add-on was.

I never offered to assist somebody else to write the PR. Where did that come from?

I do not know which of my statements you are referring to or where you got the impression that I was not able to work on my add-ons. I am absolutely capable of migrating my work to OH3. I will not make any commitments for M2, since I do not know when my questions will be answered, but I’m not going to stop working on them. Yes, my time is limited, but this there is very little left to do.

3 Likes

I must have misinterpreted this. Sorry.

I realize now I was wrong.

1 Like

I want to move on from the DSL rules so I started to learn python and I tried to setup Jython.
I’m pretty sure that I did all the steps from https://openhab-scripters.github.io/openhab-helper-libraries/Getting%20Started/Installation.html

After starting openhab service I see this in karaf log

    20:19:49.087 [DEBUG] [ript.internal.ScriptEngineManagerImpl] - Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/000_startup.py
    20:19:49.234 [WARN ] [jython.Startup                       ] - 

    *******************************************************************************
    Jython version:       2.7.0.final
    Operating system:     Linux
    OS Version:           5.4.51-v7+
    Java vendor:          Azul Systems, Inc.
    Java VM name:         OpenJDK Client VM
    Java runtime name:    OpenJDK Runtime Environment
    Java runtime version: 1.8.0_152-b76
    sys.path:             /etc/openhab2/automation/lib/python
                          /etc/openhab2/automation/jython/Lib
                          /etc/openhab2/automation/jython/jython-standalone-2.7.0.jar/Lib
                          __classpath__
                          __pyclasspath__/
    *******************************************************************************

And some error afterwards (I removed a part of the log to make it more readable)

    Loading script 'python/core/components/100_DirectoryTrigger.py'
    Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/100_DirectoryTrigger.py
    Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/python/core/components/100_DirectoryTrigger.py': ImportError: No module named configuration in <script> at line number 20
    Loading script 'python/core/components/100_OsgiEventTrigger.py'
    Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/100_OsgiEventTrigger.py
    Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/python/core/components/100_OsgiEventTrigger.py': ImportError: No module named configuration in <script> at line number 10
    Loading script 'python/core/components/100_StartupTrigger.py'
    Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/100_StartupTrigger.py
    Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/python/core/components/100_StartupTrigger.py': ImportError: No module named configuration in <script> at line number 10
    Loading script 'python/core/components/200_JythonBindingInfoProvider.py'
    Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonBindingInfoProvider.py      
    Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonBindingInfoProvider.py': ImportError: No module named configuration in <script> at line number 8
    Loading script 'python/core/components/200_JythonExtensionProvider.py'
    Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonExtensionProvider.py
    Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonExtensionProvider.py': ImportError: No module named configuration in <script> at line number 10
    Loading script 'python/core/components/200_JythonItemChannelLinkProvider.py'
    Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonItemChannelLinkProvider.py
    Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonItemChannelLinkProvider.py': ImportError: No module named configuration in <script> at line number 9
    Loading script 'python/core/components/200_JythonItemProvider.py'
    Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonItemProvider.py
    Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonItemProvider.py': ImportError: No module named configuration in <script> at line number 9
    Loading script 'python/core/components/200_JythonThingProvider.py'
    Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonThingProvider.py
    Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonThingProvider.py': ImportError: No module named configuration in <script> at line number 8
    Loading script 'python/core/components/200_JythonThingTypeProvider.py'
    Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonThingTypeProvider.py        
    Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonThingTypeProvider.py': ImportError: No module named configuration in <script> at line number 8
    Loading script 'python/core/components/200_JythonTransform.py'
    Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonTransform.py
    Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonTransform.py': ImportError: No module named configuration in <script> at line number 10

I also continued and placed the hello_world.py script in /automation/jsr223/python/personal/ and another error

    Loading script 'python/personal/hello_world.py'
    Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/personal/hello_world.py
    Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/python/personal/hello_world.py': ImportError: No module named configuration in <script> at line number 1

I’m running openhab 2.5.9 on a RPi3 with Debian 10 (not openhabian).

Any ideas?

Looks like you missed #8

1 Like

I’m so stupid, I renamed the file in the extracted folder not on the RPi.
Thanks!

1 Like

It’s a small step that gets missed often.

1 Like

The next release provides a clearer log entry when the configuration.py is missing and allows things to still work without it. This works better for people using the add-on. Eventually, the configuration.py will be settings inside the add-on.

3 Likes

I have just installed OH3 and would like to use Jython scripts to solve my rules in the future. But now i read that it may be that the future of Jython (in OH) is uncertain. Please correct me if this is a misinterpretation.

For me as a newcomer, it is difficult to understand which way or rather which script language is the best for the new rule engine. In the long term, i want to avoid having to rewrite all the rules with a new script language.

As i have also noticed, there are slight tensions (in this thread), i don’t know the background, but I would like to take this opportunity to thank everyone who put their time into the development and help and hope that OH continues to be an exciting community project ! Thanks a lot for this!

2 Likes

A far as i know @5iver is working on a version for OH3, but he has a real life ans some other projekct to. So we have to be patient with this.

The decsion which script language to use is not an easy one. For now OH3 offer:

  • Native OH3 DSL
  • Javascript
  • Goovy
  • Blockly as a visual interface to code Javascript
  • Node Red (not included in OH3 but as part of openhabian)
  • Jython (@5iver we count on you)

I OH3 moves some day to GraalVM some more will be seen.

You should question yourself wich of the Languages fits best for you. A Strat with DSL is onot a wrong one because your are very close to the oh3 concepts

1 Like

Thanks for your answer. What i’ve read, GraalVM also supports Python, among other things. Then I will continue to deal with Python and would be very happy if there is a binding for Jython in the near future… thanks @5iver for your commitment!

2 Likes

I have been using Graal (for modern JS) in Openhab for about a year now, I am working on PRs to get it into OH so that everyone can use it :crossed_fingers:

6 Likes

@Dibbler42:
HABApp already supports OH3 and allows you to create rules in python (3) .

2 Likes

@Spaceman_Spiff Looks impressive. I will try to dive into it.

2 Likes