Skip to content

Commit

Permalink
Blockly rulecontext types (#2105)
Browse files Browse the repository at this point in the history
* fix some typos in Readme

Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>

* Blockly get rule context type explanation

Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>

* adding info about context type selector

Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>

* fix linting

Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>

---------

Signed-off-by: Stefan Höhn <mail@stefanhoehn.com>
  • Loading branch information
stefan-hoehn authored Jul 29, 2023
1 parent a066495 commit 88266a1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion configuration/blockly/rules-blockly-run-and-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,24 @@ _Function:_ Retrieve event context related information of the rule

A rule carries contextual information when triggered - this block can retrieve that information.

- The rule trigger type defines which of the attributes are available to the rule - they will not all be available.
- The rule trigger type defines which of the attributes are available to the rule - the types available depend on the trigger type of the rule.
- For more detailed information see [UI Event Object](https://next.openhab.org/addons/automation/jsscripting/#ui-event-object) or [openHAB Events](https://www.openhab.org/docs/developer/utils/events.html).

Here is a list of possible values that can be retrieved.

- rule UID - String
- event type - String
- new state of item - String / Number by selection
- previous state of item - String / Number by selection
- triggering item name - [Item](rules-blockly-items-things.html#item), not a String
- received command - String / Number by selection
- triggered channel - String
- triggered event - String

The block adds a selection drop down in case a state or command is returned:

![blockly-context-number-string](../images/blockly/blockly-context-number-string.gif)

## Transform values via Map, Regex or JsonPath and others

openHAB provides many [transformations](https://www.openhab.org/docs/configuration/transformations.html):
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 88266a1

Please sign in to comment.