From a6c437e01db9b68f650e7dfad1e67ea83081ac1c Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Sat, 18 Mar 2023 11:51:11 -0600 Subject: [PATCH] update docs for core.GenericEventTrigger (#1986) * update docs for core.GenericEventTrigger see https://github.com/openhab/openhab-core/pull/3299 Signed-off-by: Cody Cutrer * link to javadocs for mostly-complete list of event types Signed-off-by: Cody Cutrer --------- Signed-off-by: Cody Cutrer --- configuration/jsr223.md | 11 +++++---- configuration/rules-ng.md | 48 +++++++++++++++++++++++---------------- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/configuration/jsr223.md b/configuration/jsr223.md index a990bd6c6..f53119a3c 100644 --- a/configuration/jsr223.md +++ b/configuration/jsr223.md @@ -529,11 +529,12 @@ Read the JSR223 language specific documentation for examples of using these `Tri ::: ::: details core.GenericEventTrigger -| Parameter | Description | -| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `eventTopic` | Default: "openhab/\*"

Events can also be filtered, e.g.
Item events: "openhab/items/\*/"
Channel events: "openhab/channels/\*/triggered"
Thing events: "openhab/things/\*/" | -| `eventSource` | `Item` name, `ChannelUID`, `ThingUID`, etc. | -| `eventTypes` | `ItemCommandEvent`, `ItemStateEvent`, `ItemStateChangedEvent`, `GroupItemStateChangedEvent`, `ItemAddedEvent`, `ItemRemovedEvent`, `ThingAddedEvent`, `ThingRemovedEvent`, `ThingStatusInfoChangedEvent`, `ThingStatusInfoEvent`, `ThingUpdatedEvent`, etc. | +| Parameter | Description | +| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `topic` | The topic to match, as a file-system style glob (*, **, ?, and {} operators).

Example filters:
Item events: "openhab/items/\*/"
Channel events: "openhab/channels/\*/triggered"
Thing events: "openhab/things/\*\*" | +| `source` | The object that triggered the event, such as `org.openhab.core.expire` | +| `types` | `ItemCommandEvent`, `ItemStateEvent`, `ItemStateChangedEvent`, `GroupItemStateChangedEvent`, `ItemAddedEvent`, `ItemRemovedEvent`, `ThingAddedEvent`, `ThingRemovedEvent`, `ThingStatusInfoChangedEvent`, `ThingStatusInfoEvent`, `ThingUpdatedEvent`, etc. A non-exhaustive list can be found [in the Javadocs](https://www.openhab.org/javadoc/latest/org/openhab/core/events/event). | +| `payload` | Regex to match against the actual event data. | ::: ::: details core.SystemStartlevelTrigger diff --git a/configuration/rules-ng.md b/configuration/rules-ng.md index a43a4375c..e80d9f3fe 100644 --- a/configuration/rules-ng.md +++ b/configuration/rules-ng.md @@ -484,37 +484,45 @@ The above example uses two rule configuration properties: ### GenericEventTrigger -GenericEventTrigger has 3 configuration parameters: `eventTopic`,`eventSource` and `eventTypes` and one output: 'event'. +GenericEventTrigger has 4 configuration parameters: `topic`,`source`, `types`, and `payload`, and one output: `event`. ```json { "uid":"GenericEventTrigger", "label":"Basic Event Trigger", "description":"Triggers Rules on Events", - "configDescriptions":[ + "configDescriptions": [ { - "name":"eventTopic", - "type":"TEXT", - "label":"Topic", - "description":"This is the topic, the trigger will listen to: >>openhab/*<<", - "required":true, - "defaultValue":"openhab/*" + "name": "topic", + "type": "TEXT", + "label": "Topic", + "description": "the topic, as a file-system style glob (*, ** and {} operators). will match all events if empty", + "required": true, + "default": "" }, { - "name":"eventSource", - "type":"TEXT", - "label":"Source", - "description":"This is the source of the event (eg. item name)", - "required":true, - "defaultValue":"" + "name": "source", + "type": "TEXT", + "label": "Source", + "description": "the source of the event (e.g. org.openhab.core.expire, etc.). will match all events if empty", + "required": true, + "default": "" }, { - "name":"eventTypes", - "type":"TEXT", - "label":"Event Type", - "description":"the event type, the trigger should listen to. Multiple types can be specified comma-separated", - "required":true, - "defaultValue":"" + "name": "types", + "type": "TEXT", + "label": "Event Type", + "description": "the event type the trigger should listen to. multiple types can be specified comma-separated. will match all events if empty", + "required": true, + "default": "" + }, + { + "name": "payload", + "type": "TEXT", + "label": "Event Payload", + "description": "A regex to match the event's serialized payload. will match all events if empty", + "required": true, + "default": "" } ], "outputs":[