Since i’ve updated Openhab2 to the latest build (1071 as of today), i’m getting errors on my Jython rules. Not a single rule is loads. When running the command automationManager.addRule(), the following error is shown:
Error during evaluation of script <script> : TypeError: Default constructor failed for Java superclass org.eclipse.smarthome.automation.module.script.rulesupport.shared.simple.SimpleRule in <script> at line number X
The hello world example works, so my Jython configuration is OK:
28-Oct-2017 21:46:59.780 [INFO ] [ript.rulesupport.internal.loader.ScriptFileWatcher] - Loading script 'zzz_test_hello_world.py'
28-Oct-2017 21:46:59.800 [INFO ] [org.eclipse.smarthome.automation.examples ] - Hello world!
28-Oct-2017 21:46:59.802 [DEBUG] [ript.rulesupport.internal.loader.ScriptFileWatcher] - Script loaded: zzz_test_hello_world.py
However when i try to load a simple test rule:
scriptExtension.importPreset("RuleSupport")
scriptExtension.importPreset("RuleSimple")
class MyRuleTest(SimpleRule):
def __init__(self):
self.triggers = [
Trigger("MyTrigger", "core.ItemStateUpdateTrigger",
Configuration({ "itemName": "TestString1"}))
]
def execute(self, module, input):
events.postUpdate("TestString2", "some data")
automationManager.addRule(MyRuleTest())
An error is shown in the openhab log:
28-Oct-2017 21:59:58.971 [INFO ] [cript.rulesupport.shared.ScriptedAutomationManager] - removeAll added handlers
28-Oct-2017 21:59:58.973 [INFO ] [ript.rulesupport.internal.loader.ScriptFileWatcher] - Loading script 'zzz_rule_standalone_test.py'
28-Oct-2017 21:59:59.056 [ERROR] [ion.module.script.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/opt/openhab2/conf/automation/jsr223/zzz_rule_standalone_test.py': TypeError: Default constructor failed for Java superclass org.eclipse.smarthome.automation.module.script.rulesupport.shared.simple.SimpleRule in <script> at line number 13
28-Oct-2017 21:59:59.057 [DEBUG] [ript.rulesupport.internal.loader.ScriptFileWatcher] - Script loaded: zzz_rule_standalone_test.py
The following rule related bundles are installed:
openhab> bundle:list | grep -i rule
131 │ Active │ 80 │ 0.9.0.201710240931 │ Eclipse SmartHome Rule Model
132 │ Active │ 80 │ 0.9.0.201710240931 │ Eclipse SmartHome Rule Runtime
198 │ Active │ 80 │ 0.9.0.201710240931 │ Eclipse SmartHome Automation Script RuleSupport
Is there anyone else who experiences these issues and have you found a way to fix it?