Skip to content

Commit

Permalink
Update jsr223-jython.md to include changes form ESH PR #5953 (openhab…
Browse files Browse the repository at this point in the history
…#751)

Signed-off-by: Scott Rushworth openhab@5iver.com (github: openahb-5iver)
  • Loading branch information
5iver authored and Confectrician committed Aug 6, 2018
1 parent f61059b commit d05ca45
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions configuration/jsr223-jython.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,23 @@ The rule created in the script is triggered by an update to `TestString1` and,
when triggered, the rule updates `TestString2`.

```python
scriptExtension.importPreset("RuleSimple")
scriptExtension.importPreset("RuleSupport")
scriptExtension.importPreset("RuleSimple")

class MyRule(SimpleRule):
def __init__(self):
self.triggers = [
Trigger("MyTrigger", "core.ItemStateUpdateTrigger",
Configuration({ "itemName": "TestString1"}))
TriggerBuilder.create()
.withId("MyTrigger")
.withTypeUID("core.ItemStateUpdateTrigger")
.withConfiguration(
Configuration({
"itemName": "TestString1"
})).build()
]

def execute(self, module, input):
events.postUpdate("TestString2", "some data")

automationManager.addRule(MyRule())
```

Expand Down

0 comments on commit d05ca45

Please sign in to comment.