seaside1 / jrule

openHAB Java Rules Engine
Eclipse Public License 2.0
29 stars 15 forks source link

Dynamic rule builder #195

Closed rsopp closed 8 months ago

rsopp commented 9 months ago

Support for dynamic rules using a newly created JRuleBuilder

seaside1 commented 9 months ago

Thank you for the PR, I'll have a look shortly work with the previous PR:s, but more or less done

seaside1 commented 8 months ago

I have a comment there on the JRuleLoadingStatistics.addRuleClass which is missing?

Quite a big PR, I'm running this in my prod env now to test things out. Hoping @seime or @querdenker2k can help out to test this before merge.

querdenker2k commented 8 months ago

@rsopp Sorry stupid question, but what's the usecase of this PR? Is it to create rules in a loop for a few items which i would otherwise put inside a groupitem and listen on the groupitem change? For what are you using this feature?

rsopp commented 8 months ago

@querdenker2k I use the following setup for the dynamic rules:

seaside1 commented 8 months ago

Another example is: https://github.com/seaside1/jrule-sonos/commit/389b9850817fd8cc53c05bd48e107bda4179683e#diff-2cfb4f9fc917e919de336c63834832acefb3c3cfe03c5f6401201edbb7b9b56e

Using The JRuleInvocationCallback