OpenHAB and decision table?


is there a way to use decision tables in openHab?

I have several rules, where i have many if - if else - else blocks to decide, what should happen. It would be better, to use decision tables. Is there a way to use a standard, like DMN?

Thanks and Greetings

Counter question (as I’m not familiar with coding): Is DMN or such a thing available in java? I dare say it could be possible to import this functionality.

As another thing, if you only have one input, you might be happy with

switch item.state {
    case 1 : {}
    case 2 : {}
    case 3 : {}
    case 4 : {}
    default : {}

There is no native support for this (beyond using the switch statement @Udo_Hartmann illustrated. There is a Java library which, if you can figure out how to get it in the Rules Engine’s classpath you should be able to use.

This might be a good job for an Action addon. I’ve been bemoaning the lack of good support for state machines in the Rules and have been planning to implement something reusable when the Experimental Next Gen Rules engine becomes more complete and stable. This would work just as well.