OH2.5 to OH3 - When, and to what, should I convert rules from DSL?

I’ve recently moved to OH3 and have been enjoying it. I’ve been reworking the entirety of my item structure to use a semantic model and am now moving on to converting my DSL rules. Initially I wanted to use Blockly for all of my rules, assuming it is the rule engine of the future, but simple things like sending a WOL packet via the Network binding don’t appear to be possible.

So, to my question: is it advised to spend the time converting the rules to JSR223, or should I just run on my DSL rules for a while and see what improvements come to Blockly in the future? I’ve been unable to find a clear statement on when to expect DSL to be removed from openHAB. Will it be supported for the until “openHAB 4” or do I need to get on conversion soon, if I want to be prepared for future releases?

Thank you!

Blockly is never going to be the “rules of the future.” It’s a way to build rules for people who don’t have any idea about programming. It is always going to be more basic and less capable than any of the other languages. It’s simply impossible to make it complete and keep it usable.

Rules DSL is unlikely to ever be removed from openHAB. But if that ever does happen, there will be lots of forewarning and perhaps tools built to make the transition easier. And OH 4 is probably years away so you don’t really have to worry to much about what will happen then.

If you are comfortable with your Rules DSL rules and they work, don’t worry about it. If you want to learn something new, trying out JavaScript or Python rules would be a good choice. I would not try to rewrite my Rules DSL as Blockly though.


Thank you! I will probably leave my functional DSL rules as-is for now. I do have a few that I believe could benefit from the capabilities of Python now that I’m in this nested-group semantic model - particularly in terms of speed of rule execution. Happy to know that running DSL rules isn’t a ticking time bomb!

I converted all my DSL to JavaScript. It took a bit of time but in the end it seems to be a lot cleaner.

I had both OH 2.5 and OH 3 running and I would convert a DSL rule that was on the 2.5 system and convert it to javascript on the OH 3 and then disable that rule on the 2.5 system. I would convert a few rules everyday and I had a Javascript template I would use that had most of the code that was used most of the time.

I used blocky to write the basic code and then I clicked on the code button and copied that code into my JavaScript rule as I am not a JavaScript programmer. The gave me the syntax and the basic outline of the program.

I did need some help from the forum for triggering items and why it didn’t work but other than that it worked.

Also JavaScript doesn’t have a timer option but I got around that but using the metadata expire on the item and to be honest that worked out even better than timers I had in OH 2.5 DSL rules.

The new OH 3 is great and it seems to run better but it is a steep learning curve.


var ZonedDateTime = Java.type("java.time.ZonedDateTime");
var ScriptExecution = Java.type("org.openhab.core.actions.ScriptExecution");

this.timer = (this.timer === undefined) ? null : this.timer;

var runme = function() {
  // timer code goes here



this.timer = ScriptExecution.createTimer(ZonedDateTime.now().plusSeconds(5), runme);

This was just typed in, there might be typos. But it should get you close enough to perform searches for additional examples.

Anything that can be done can be done in JavaScript rules.

1 Like