Closed besynnerlig closed 5 years ago
Thank you! What do you think of the refactoring I did to postUpdateCheckFirst?
Thank you! What do you think of the refactoring I did to postUpdateCheckFirst?
Very neat! I've copied it into my production environment for testing it extensively. I appreciate your work!
@openhab-5iver
Wherever possible I'll try to prepare my old scripts before migration from lucid to the new openhab2-jython and OH 2.5M1.
There's no document summarizing the changes that breaks my scripts is there? I believe not. Maybe you can recall some steps that you had to go through when migrating the lucid scripts? If you do, would you like to hinting me about the most important things? There's probably a few more people that will try to do the same migration.
1) The openhab
package was renamed to core
.
2) core.rules.rule is now a callable (that returns a decorator), so in it's most minimal form, you need to use it like @rule()
(note the parenthesis). Previously, it was not a callable (@rule
).
3) core.triggers no longer registers the rule. core.rules.rule does that.
4) When defining triggers in classes (this was the big breaking change in the API), append .trigger
. Check the hello_world.py
for examples.
5) To catch the logging, you may need to set a logging level for 'jsr223.jython'. I setup an appender for it, so that it goes to a separate file than openhab.log. I have another for 'jsr223.jython.core' too. I plan to update the docs about logging. I also plan to change LOG_PREFIX to just 'jython' in the PR for 2.5.
That's all that come to mind right now. If you are migrating your rules to use the decorators, 1 and 5 are the only ones you'd need to be concerned with.
- The
openhab
package was renamed tocore
.- core.rules.rule is now a callable (that returns a decorator), so in it's most minimal form, you need to use it like
@rule()
(note the parenthesis). Previously, it was not a callable (@rule
).- core.triggers no longer registers the rule. core.rules.rule does that.
- When defining triggers in classes (this was the big breaking change in the API), append
.trigger
. Check thehello_world.py
for examples.- To catch the logging, you may need to set a logging level for 'jsr223.jython'. I setup an appender for it, so that it goes to a separate file than openhab.log. I have another for 'jsr223.jython.core' too. I plan to update the docs about logging. I also plan to change LOG_PREFIX to just 'jython' in the PR for 2.5.
That's all that come to mind right now. If you are migrating your rules to use the decorators, 1 and 5 are the only ones you'd need to be concerned with.
Thanks a million! That will really help me get started.
See: https://github.com/OH-Jython-Scripters/openhab2-jython/issues/98