You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -138,10 +138,11 @@ See [openhab-js](https://openhab.github.io/openhab-js) for a complete list of fu
138
138
### UI Event Object
139
139
140
140
**NOTE**: Note that `event` object is different in UI based rules and file based rules! This section is only valid for UI based rules. If you use file based rules, refer to [file based rules event object documentation](#event-object).
141
-
Note that `event` object is only available when the UI based rule was triggered by an event and is not manually run!
142
-
Trying to access `event`on manual run does not work (and will lead to an error), use`this.event` instead (will be `undefined`in case of manual run).
141
+
Note that `event` object is only available when the UI based rule was triggered by an event and is not called from another rule!
142
+
Trying to access `event`in this case does not work and will lead to an error. Use`this.event` instead (will be `undefined`when it does not exist).
143
143
144
144
When you use "Item event" as trigger (i.e. "[item] received a command", "[item] was updated", "[item] changed"), there is additional context available for the action in a variable called `event`.
145
+
When a rule is triggered, there is additional context available for the action in a variable called `event`.
145
146
146
147
This table gives an overview over the `event` object for most common trigger types:
147
148
@@ -152,8 +153,10 @@ This table gives an overview over the `event` object for most common trigger typ
152
153
|`itemCommand`| sub-class of [org.openhab.core.types.Command](https://www.openhab.org/javadoc/latest/org/openhab/core/types/command)|`[item] received a command`| Command that triggered event |`receivedCommand`|
153
154
|`itemName`| string | all | Name of Item that triggered event |`triggeringItem.name`|
154
155
|`type`| string | all | Type of event that triggered event (`"ItemStateEvent"`, `"ItemStateChangedEvent"`, `"ItemCommandEvent"`, ...) | N/A |
156
+
|`event`| string | channel based triggeres | Event data published by the triggering channel. |`receivedEvent`|
157
+
|`payload`| JSON formatted string | all | Any additional information provided by the trigger not already exposed. "{}" there is none. | N/A |
155
158
156
-
Note that in UI based rules `event.itemState`, `event.oldItemState`, and `event.itemCommand` are Java types (not JavaScript), and care must be taken when comparing these with JavaScript types:
159
+
Note that in UI based rules `event`, and therefore everything carried by `event` are Java types (not JavaScript). Care must be taken when comparing these with JavaScript types:
0 commit comments