Scripts in OH3

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”

It does work for me, however you need to use callScript('myfile.script'), i.e. add one “.script” to the name of the script you want to call.

That also works for me! Great job guys!

Tinkering with it, I agree, the workaround does work. I was not clear to me that the additional “.script” needs to be applied not only to the script file itself but also to the call in the rule.

To make it clear to everyone:
The filename needs to be changed from
myfile.script
to
myfile.script.script

AND

in the calling rule
callScript('myfile')
needs to be changed to
callScript('myfile.script')

Thanks @bern77 and @Kai

1 Like