Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions configuration/jsr223.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, ?> 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)
})
```

:::
Expand Down