What is a good replacement for RuleDSL?

While I have been using OH for years, the RuleDSL was never to my liking due to its quirks, and what I call anomalies compared to other languages.
I did not count the hours I spent on figuring something out that was specific to RuleDSL’s quirkiness (wanting to throw out OH altogether). [Most recently a type-casting issue that should have never been a problem in the first place.]

When time permits, I will either migrate or rebuild the OH system in v3. (I like the idea of the bridge allowing me to work at my pace.)
Most likely rebuild; hence, where the “title” comes in: “What is a good replacement for RuleDSL?”

I have heard there is Python, which, while I have not done much with it, I assume microPython sticks to the language too, hence, I would have a single language for OH, micros, and rPis; which would allow me to focus on a single language for all my ‘controller’ needs.

Maybe someone who uses Python as rule language can comment, whether they can do everything RuleDSL can do, or even more.

Thanks. :slight_smile:

There is Jython which is based off the obsolete cPython 2 but @Spaceman_Spiff 's HABApp using Python 3 might be more to your liking.

The remoteopenhab binding lets you control OH2 Items from OH3 so that may be good for migration, especially if you are running Docker.

Thanks… will dig into it :slight_smile:

Here more about it:



1 Like

The Jruby integration looks really interesting to me
there is also Javascript, Groovy, Blocky… you’ve got some choices

thanks, and this may well be :slight_smile: … but: it does not cater for a “single” language" I have to learn and maintain across all my micros, Pis, and OH.

Currently your options in OH 3 include:

  • codeless, simple when this do that type rules do not even require any code at all through the UI
  • Rules DSL
  • Python 2.7
  • JavaScript (ECMA Script 5.1)
  • Blockly, Scratch liked visual programming in the browser, not yet complete though, generates JavaScript under the blocks
  • Groovy
  • Experimental support for jRuby (search the forum)

Python, Groovy, and jRuby require an addon to be installed. All except Blockly (for now) and codeless are as capable or more capable than Rules DSL. In the case of jRuby, Python, and JavaScript, they are significantly more capable than Rules DSL.

If you plan on writing rules in text files, you will want to use the Helper Libraries for Python and JavaScript. jRuby also has a library but the Python and JavaScript ones prioritize similarity to Rules DSL to ease transition and translation of examples and jRuby prioritizes making rules more “pure” to the language so they are kind of their own thing.

Note that JavaScript, Python, and Groovy are also available in OH 2.5.

External to OH you have the choice of:

  • Node Red, visual programming flows
  • HABApp, pure Python 3
  • roll your own, the REST API is pretty robust

And of course, these are not mutually exclusive. You can use any or all of theses in any combination you choose at the same time.


I agree to what Rich says and the way I go is

  • for the usual simple rules I just use blocky
  • if I need to have delayed timers with closures but still have simple rule functionality I actually still use DSL
  • for complex rules where I have to manipulate or query multiple items or even need to call openhab core API I started using python.
  • sometimes I even mix those in one rule via the UI that calls multiple rule script implementations

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