From d05ca45cc4629ff11ce9f39d85d0f4b97a6ea9c6 Mon Sep 17 00:00:00 2001 From: Scott Rushworth <21967853+openhab-5iver@users.noreply.github.com> Date: Mon, 6 Aug 2018 17:40:12 -0400 Subject: [PATCH] Update jsr223-jython.md to include changes form ESH PR #5953 (#751) Signed-off-by: Scott Rushworth openhab@5iver.com (github: openahb-5iver) --- configuration/jsr223-jython.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/configuration/jsr223-jython.md b/configuration/jsr223-jython.md index f72ee7c2fd..1d7a53fe9d 100644 --- a/configuration/jsr223-jython.md +++ b/configuration/jsr223-jython.md @@ -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()) ```