[SOLVED] Upgrade OH3.4.5 -> OH4.1 with jython rules

I’m on openHAB 3.4.5. and want to upgrade to openHAB 4.1. My system runs on CentOS stream release 8.
I still have a lot of jython rules, but I’m currently moving to “JavaScript Scripting” (JavaScript Scripting - Automation | openHAB). This will take some time but I do not want to wait longer with the upgrade if possible. I also use MariaDB for persistence.
I checked the breaking changes here Release openHAB 4.0.0 · openhab/openhab-distro · GitHub. The bindings I use should not be problematic, but I’m a little bit scared because of my jython rules.
Has anyone experience with jython and OH4 ? Should the rules still work (except the directory trigger, or is this fixed) ?
And in case of issues, is a downgrade possible, if I have a OH3 and a MariaDB backup ?

Never do anything like this without a tested backup and restore strategy. You can never guarantee that a downgrade will be possible, particularly if the upgrade fails for some reason and never completes corrupting your install.

I have no idea if Jython will still work. I know of no breaking changes that should have changed anything to how it works. I doubt the directory trigger has been fixed because that’s going to require changes to the Helper Library and there really isn’t anyone maintaining that any more.

The best I can recommend is try it and see what happens. You can always restore your backup if it fails.

Thanks @rlkoshak
A downgrade with restore openHAB & DB backup should not be a challenge, I did it a few times in the past.

Regarding the directory trigger, I found some hints:

@juelicher Sorry for pinging you here, but I found a few threads regarding OH4 and jython.

Can you tell me something about your experience with OH4 and jython rules ?

I really do not want to stay too long on OH3.4.5 if possible.
Migrating my jython rules to JavaScript Scripting is underway, but depending on the spare time, it can take a few weeks/months.

Despite the mentioned problem with the directory trigger I have no other issues with OH4 and Jython rules. At least none I can remember, but I am pretty sure there weren’t any. But keep in mind, that his is probably not a 100% test coverage.

I have also not started migrating my rules, the last time I did this (to Jython) it took several month and currently I do not have this sort of time. Before migrating I want to test HABApp, as I really do not like Javscript, HABApp seems to be a good alternative.

I just want to be clear that JS is not your only option. jRuby is very mature and people seem to love it (I am probably would have moved to that if it was faster to support UI rules). Groovy, Blockly, and Java are also options.

I’ve even seen someone report success creating rules in Scala through the Java add-on which has me itreagued. I love functional programming. :wink:

That’s not too say HABApp is a bad choice by any means. I just want to be clear that JS is not your only option.

1 Like

Thanks for pointing that out, as always very insightful!

Ruby might indeed be a good alternative. Scala sounds interesting, but I have never done functional programming, beside playing arround a bit.

I guess I have to do some more testing before migrating…

@juelicher thanks for your reply

I upgraded today to OH4.1 and most everything was working fine. I just had a few minor issues, e.g unit config.

Only the automatic update of changes on textual configs is no longer working.

I’ll mark this topic as solved and open a new topic for the issue with the reload of textual configs:

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.