In between 2.5 and 3.0: Which scripts/rules language to use?

Hi Community,

I was trying to find an answer here in the posts, but nothing up to date.

I just started with the “smart” part of my home automation and need to create some rules (heating scheme, window open/close reaction, etc.) in openHAB 2.5.0.

Before investing time and effort into the Xbase/Xtend “official” language (why is it called “DSL” sometimes?), I wanted to know, if there is a recommendation, which language to use atm (11/2020) considering the upcoming 3.x release. Is it better to start with JSR223/Jython right away to have an easier migration?

Thanks a lot,

You are asking one of those “religious war” type of questions.

It depends greatly on you current skills and interests. For me personally I think using @Spaceman_Spiff’s HABapp and Python 3 classes makes the most sense. Using Jython based on the Python 2 is not as compelling personally.

1 Like

Because it is not pure Xbase/Xtend, but a Domain Specific Language, and not a well implemented one at that!

Short answer… yes. Very little will need to be changed in your Jython scripts to migrate to OH 3, but hold up on upgrading until all the bugs crawl out of OH3 and the Jython add-ons are ready.

Long answer… there are many other scripting languages that can be used in the JVM, but the Jython helper libraries, documentation, and forum knowledgebase is by far better and more advanced than any other alternative. The Jython add-ons, which would have made installation a couple clicks, have been ignored/rejected/blocked for nearly two years now. To easily install them in OH 2.x, I have had to add them to the Eclipse IoT Marketplace. I’ll make an announcement in the forum very soon, after everything has been polished up. However, you can also manually set up Jython and the helper libraries for OH 2.x. For OH 3.x, you have to use an add-on for Jython, so a manual install won’t work. I will provide OH 3.x add-ons for manual installation right after the updated 2.x add-ons. I am also working on other alternatives to ease the installation.

HABapp is limited to the REST API, like is used by the UIs. Scripted automation is so much more powerful and can do more than even bindings. With it, you have direct access to all of Java, any Java library, and the OH public classes, although Jython can even get to the private ones. As for writing your automation, there is little to no difference using Python2 vs 3, though Jython is it’s own Python interpreter and is much more than CPython. As for Python3 libraries, Jython can use executeCommandLine to run Python3 scripts, so you are not missing out on anything. Jython3 is also under development, though graal-js is maturing faster, so there are future possibilities.

You are never limited though, because you can use the UI, rules DSL, Jython, JS, jRuby, Groovy, Kotlin, HABapp, Node-Red, etc. all at the same time!


Thanks for the reply, @Bruce_Osborne!

OK, maybe it was a bit misleading and I try to re-phraze it:

Is it worse starting now with XBase/Xtend/DSL rules? Will they be fully migrated to new rule engine in 3.0?
Or better start with one of the JSR223 scripting language right from the beginning, as I would expect, that they are still supported in 3.0?

The text configuration in OH2 is supported in OH3. I currently use text for Items, Sitemaps, & Rules (DSL). I auto-discover & add my Things through the UI because text filt Thing configuration can be quite error prone.

My current plan is to end up with text Items and, likely HABApp, text rules. I will have my Sitemaps and have not yet decided how I would use the new UI. I suspect I will use Grou Items & tags in my text Items for semantic organization.

I personally am not currently planning on using JSR223 but it might be worth is if you have javascript experience. @5iver or @rlkoshak are our best experts on using JSR223.

They already are supported on OH3.

I would recommend starting with one of the other languages as you will have more flexibility in the long run, but you won’t be stuck without support of you start with Rules DSL.


I just want to underscore this. I’m not planning to move to OH3 until it’s official, because I don’t have time to contribute to debugging efforts. Based on forum traffic, it feels like a lot of people are jumping into OH3 thinking it’s ready to be used in production, so I’m glad to hear you’ve gone with the very stable 2.5.

I’ve given thought to learning JSR223, but at the same time my DSL rules are relatively simple and run perfectly fine. So, I don’t have a ton of motivation to fix something that isn’t broken. If I were starting from scratch, I’d go with JSR223 since that’s the future.

Make sure to check out @rlkoshak’s tutorials, which often (always?) include examples for both DSL and JSR223 rules.

Not always but I try to for at least the design pattern tutorials


Russ, I think it just maybe ‘feels’ that way because OH3 is generating an awful lot of traffic on the forum lately.

Exactly, OH3 is being made available for early testing only although me thinks it won’t be long until a stable release drops as early testing is indeed showing really great results
#Yannik for president of earth :+1:

1 Like

Oh, absolutely. I’m just a little concerned that new users are going to come along, see everyone talking about OH3, and think that’s the way to go. Humans have a tendency to choose the newer and shinier thing over the less-shiny model that actually works properly. So until the stable release happens, it’s worth pointing out that 2.5 is a better starting point.

1 Like

I disagree. Until there is good documentation for the user 2.5 should be recommended. There is so much documentation it could take another year before it is ready for new users.

1 Like

I think you and Russ are agreeing Bruce. Only disparity perhaps is

Which I think is being developed just as fast as the version itself. (hats off to rich & others) I think good docs are as quickly forthcoming as stable release.

Not to disagree… at this moment (11.2020) 2.5 best starting point

Negative. You learned with existing doco for v2 which at one time was heavily disparaged but open source devotees pitched in and rocked it!!! (history lesson warning)
Edit: And really just to add… IMHO Yannick’s interface is so dog gone intuitive… it barely needs any explanation

If I was a new user with no knowledge of 2.5 and considering that the ‘stable’ tagged release is probably now less than 4 weeks away, I would go with starting out on 3.0 so anything I learnt is not a waste of time in a matter of weeks.

If I had a working 2.5 system already and I was not fully comfortable with lots of changes, or lacked spare time, then I would wait until the main websites documentation switches over to showing 3.0 versions by default and maybe even then wait an extra Milestone release or two. You will then have a smoother transition.

I think the fact openHAB has so many different ways to be both a good and a bad thing. Good we have choices, but bad as it can be confusing which way suits you the best and causes lack of examples for people to follow. We also have Blockly and Nodered for graphical ways on top of the multiple scripting and New Gen drop down UI way.

I guess it depends on what interests you have and what languages you already know?
Are you interested in Binding Development?
Interested in creating widgets for the new Pages concept in the new UI?
Microcontroller projects?
Web page development?

The above can change what someone may recommend you learn to use.

1 Like

I am truly old and dense then. I have not wrapped my head around the Main UI.