Well, the error is it can’t find the script so either:
you didn’t move your scripts over
they are in the wrong folder
the “right” folder may have moved
there is a bug and openHAB is looking in the wrong location.
Someone experiencing this problem needs to file an issue.
// Run another rule
var FrameworkUtil = Java.type("org.osgi.framework.FrameworkUtil");
var _bundle = FrameworkUtil.getBundle(scriptExtension.class);
var bundle_context = _bundle.getBundleContext()
var classname = "org.openhab.core.automation.RuleManager"
var RuleManager_Ref = bundle_context.getServiceReference(classname);
var RuleManager = bundle_context.getService(RuleManager_Ref);
var map = new java.util.HashMap();
map.put("test_data", "Passed data to called function!")
RuleManager.runNow("tocall", true, map); // second argument is whether to consider the conditions, third is a Map<String, Object>
Notice how you can pass data to the other rule. Much of the stuff in the above code is done for you in the Helper Libraries.
Unfortunately you can’t do this from Rules DSL as far as I know.
Hi Rich, thanks for the link. The “how-to” was basically clear to me, I might not have been too clear as what I’m unsure about. Sorry for that.
Is it openhab-core, openhab.distro, … that I need to open the issue? I’m not really sure which part of the different parts of OH I need to open the issue with.
Adding “.script” to the name did not work, neither did the removal of the entire extension work. In both cases the same error message is logged:
2020-12-28 18:10:34.172 [INFO ] [rg.openhab.core.model.script.default] - ##### Prüfe, ob heute arbeitsfrei ist
2020-12-28 18:10:34.176 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'zentral-1' failed: Script 'arbeitsfrei' cannot be found. in zentral
“zentral.rules” is the calling script and “arbeitsfrei.script” or “arbeitsfrei.script.script” or “arbeitsfrei” is the script called from within “zentral.rules”