Closed lewie closed 5 years ago
Since openHAB 2.5 access to these classes is broken. JSR223 is unusable. Current I have tested access only with javascript language, but suspect the other script languages are in the same situation?!
Some classes have been moved from org.eclipse.smarthome.automation to org.openhab.core.automation. Using the raw API to create rules with JSR223 is working. But there are some org.eclipse.smarthome.core packages that have not been renamed, and I haven't found a way to access them yet.
After testing, this is the only one that worked for me...
org.openhab.core.automation.handler.TriggerHandler
This issue should be moved to openhab-core, but I plan to create one tonight, and will reference this issue. BTW, did you see this question?
@openhab-5iver, Thank You! Now I'm on the right track.
The topics are discussed at the right place: https://github.com/openhab/openhab-core/pull/663 https://github.com/openhab/openhab-core/issues/610
Expected Behavior and Current Behavior
Since openHAB 2.x overJSR223 for example javascript nashorn we could access these classes and use it for scripting: org.eclipse.smarthome.automation.core.util.RuleBuilder org.eclipse.smarthome.model.persistence.extensions.PersistenceExtensions org.eclipse.smarthome.automation.handler.TriggerHandler ...
Since openHAB 2.5 access to these classes is broken. JSR223 is unusable. Current I have tested access only with javascript language, but suspect the other script languages are in the same situation?!
Possible Solution
Probably I overlooked something. I don't assign any announcement or change to this serious behavioral change. I can't yet categorize whether it's an oversight, bug, or a architectural measure. I would very much like to learn about possible solutions! ;-)
Steps to Reproduce (for bugs)
Install openHAB 2.5 nightly and run a script, calling any of these 3 classes like in JavaScript: var RuleBuilder = Java.type("org.eclipse.smarthome.automation.core.util.RuleBuilder");
RuleBuilder is currently indispensable, and we don't have an alternative. RuleBuilder is https://github.com/lewie/openhab2-javascript/blob/master/jslib/JSRule.js#L119