Skip to content

Commit

Permalink
Created a demo.py to demonstrate a cron trigger jython rule (openhab#743
Browse files Browse the repository at this point in the history
)
  • Loading branch information
5iver authored and kaikreuzer committed Aug 1, 2018
1 parent 3281fbc commit e1a7479
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
scriptExtension.importPreset("RuleSupport")
scriptExtension.importPreset("RuleSimple")

class MyRule(SimpleRule):
def __init__(self):
self.triggers = [
TriggerBuilder.create()
.withId("aTimerTrigger")
.withTypeUID("timer.GenericCronTrigger")
.withConfiguration(
Configuration({
"cronExpression": "0 * * * * ?"
})).build()
]

def execute(self, module, inputs):
print "This is a 'hello world!' from Jython rule."

automationManager.addRule(MyRule())

0 comments on commit e1a7479

Please sign in to comment.