diff --git a/Core/automation/lib/javascript/core/rules.js b/Core/automation/lib/javascript/core/rules.js index a1252206..c25b26ab 100644 --- a/Core/automation/lib/javascript/core/rules.js +++ b/Core/automation/lib/javascript/core/rules.js @@ -96,9 +96,10 @@ return RuleBuilder.create(ruleDto.uid) var ruid = uuid.randomUUID() + "-" + obj.name.replace(/[^\w]/g, "-"); logInfo("################ JSRule Line: "+__LINE__+" ################# ruid:" + ruid); //var rule = new SimpleRule({ setUID: function(i) { uid = i; } }) - var rule = new SimpleRule(){ + var rule = new SimpleRule({ execute: obj.execute //DOES THIS WORK? AND IF YES, WHY? => execute is found in implemented SimpleRuleActionHandler - }; + }); + var triggers = obj.triggers ? obj.triggers : obj.getEventTrigger(); rule.setTemplateUID(ruid); @@ -136,7 +137,7 @@ return RuleBuilder.create(ruleDto.uid) var rname = obj.name ? obj.name.replace(/[^\w]/g, "-") : "nameless-generic"; var ruid = obj.uid ? obj.uid : uuid.randomUUID() + "-" + rname; var triggers = obj.triggers ? obj.triggers : obj.getEventTrigger(); - var execX = new SimpleRule(){execute: obj.execute};//Not good!! + var execX = new SimpleRule({execute: obj.execute});//Not good!! return RuleBuilder.create(ruid) .withActions(execX.getActions() ? execX.getActions() : null) //.withActions(obj.execute ? [obj.execute] : null) //org.openhab.core.automation.module.script.rulesupport.shared.ScriptedAutomationManager L164