Roadmap to Happiness - What is missing in the core framework

The Next Gen Rules Engine remains experimental. I don’t think that will change by 2.4. The documentation for it is just being started. See Experimental Next-Gen Rules Engine Documentation 1 of : Introduction.

No one is expected to write the JSON by hand. There is a UI in PaperUI for creating Rules and eventually there will probably be a couple of choices.

All three of the JSR223 languages as well as legacy Rules DSL Rules will be supported.

If one is already using JSR223 Rules, they are already using the base NGRE.

JSR223 is just a name for the mechanism that allows one to run non-java programming languages in the Java Runtime Environment (JRE). Nashorn is the JSR223 implementation of JavaScript. Jython is a version of Python that runs on the JRE. OH is a Java application. Whatever language Rules are written in must run in that environment.

The Rules DSL is its own language and it has its own preferred way of structuring code. This is true of any programming language. The DPs are not work arounds. They illustrate the proper way to structure Rules DSL code. Indeed, if you try to structure your solution in a different way, you will probably have to restructure your approach, sometimes significantly. You sound like a programmer and for years I have pushed programmers away from the Rules DSL and to JSR223 Rules because most of the time people who already know how to program cannot or will not structure their code in a way that works well in Rules DSL.

NGRE has support for Rule templates (I’m not sure how it works yet) as well as libraries. But this will only be for Rules. You will have to manage your Items separately.

In the NGRE Rules can call Rules, Rules can be enabled and disabled, and of course there is support for libraries. But in Rules DSL, you shouldn’t have any duplicated code either. Using Groups, Member of triggers, and the like you should only need the one Rule in the first place.

In neither the Rules DSL nor the NGRE should there be replication of logic.

The NGRE takes a really different approach to implicit variables. They are still there but not you have an event Object that encapsulates everything you can know about the event that caused the Rule to trigger. For convenience, some of those properties are exposed as variables (e.g. on a changed triggered Rule there will be a newState and previousState variable populated).

I’m not sure I understand what you are suggesting though by a forces parameter with received command. Regardless, there is a reason why it is the way it is. There are circumstances where one needs received command to work exactly like it currently does. Any change to this breaks those cases. For example, imagine you have a device that always reports it’s new state. With such a device one will likely want to use autoupdate=false which will prevent the Item itself from being updated or changing state on the command and instead waiting until the device reports back that it changed state. So, in this case, you can’t rely on an update to trigger your Rule and you can’t rely on a state change to trigger your Rule when you need to have a Rule triggered when the Item receives a command but you don’t want to or need to wait for the state change. The only way to trigger a Rule in this circumstance is to trigger it based on the actual received command event independently of what the Item’s state is doing. But this also means you can’t rely on MyItem.state in that Rule, hence the variable.

Sometimes the complexity is deliberate, well thought out, and required.

You shouldn’t be doing much locking. It’s dangerous and prone to errors. If you need the locking then my recommendation would be that there might be a better approach or you should be using JSR223 Rules.

One can counter with just because one doesn’t understand why something is complicated doesn’t mean it can be made simpler.

I’m not arguing that there are not areas where OH can’t use some simplification and it has frankly come a really long way in only a couple of years. But it needs to support a lot of use cases and that adds complexity.

Based on the description I really think you would be better off using JSR223 Rules or, if you are adventurous you can start to experiment with the NGRE. There are a few things it can’t handle just yet but it’s pretty capable.

2 Likes