diff --git a/configuration/jsr223.md b/configuration/jsr223.md index 8bd8006b07..859a50ac11 100644 --- a/configuration/jsr223.md +++ b/configuration/jsr223.md @@ -146,22 +146,25 @@ import org.openhab.core.automation.module.script.rulesupport.shared.simple.* import org.openhab.core.config.core.Configuration scriptExtension.importPreset("RuleSupport") -scriptExtension.importPreset("RuleSimple") -def sRule = new SimpleRule() { +automationManager.addRule(new SimpleRule() { + { + name = "Main" + description = "Primary Logic" + uid = "1-2-3" + tags = ["T"] + triggers = [ + TriggerBuilder.create() + .withId("aTimerTrigger") + .withTypeUID("timer.GenericCronTrigger") + .withConfiguration(new Configuration([cronExpression: "0 * * * * ?"])) + .build() + ] + } Object execute(Action module, Map inputs) { - println("Hello World from Groovy") + org.slf4j.LoggerFactory.getLogger("A").error("Hello World from Groovy") } -} -sRule.setTriggers([ - TriggerBuilder.create() - .withId("aTimerTrigger") - .withTypeUID("timer.GenericCronTrigger") - .withConfiguration(new Configuration([cronExpression: "0 * * * * ?"])) - .build() - ]) - -automationManager.addRule(sRule) +}) ``` :::