-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[rules]
SwitchableJSRule
: Add ability to specify name of Switch Item (
#325) This adds an option to the rule config for `SwitchableJSRule` to specify the name of the Switch Item, which enables and disables the rule. If no `switchItemName` is provided, the Item name will be generated as before. If the `switchItemName` is specified but no Item with the specified name exists, an Item with that name is created, else the existing Item with this name is used. --------- Signed-off-by: Florian Hotze <[email protected]>
- Loading branch information
1 parent
7dcd7ef
commit 6ac82b1
Showing
7 changed files
with
74 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -376,6 +376,7 @@ See [openhab-js : items](https://openhab.github.io/openhab-js/items.html) for fu | |
|
||
- items : `object` | ||
- .NAME ⇒ `Item` | ||
- .existsItem(name) ⇒ `boolean` | ||
- .getItem(name, nullIfMissing) ⇒ `Item` | ||
- .getItems() ⇒ `Array[Item]` | ||
- .getItemsByTag(...tagNames) ⇒ `Array[Item]` | ||
|
@@ -1092,7 +1093,7 @@ See [openhab-js : rules](https://openhab.github.io/openhab-js/rules.html) for fu | |
### JSRule | ||
JSRules provides a simple, declarative syntax for defining rules that will be executed based on a trigger condition | ||
`JSRule` provides a simple, declarative syntax for defining rules that will be executed based on a trigger condition: | ||
```javascript | ||
var email = "[email protected]" | ||
|
@@ -1156,6 +1157,9 @@ triggers.DateTimeTrigger('MyDateTimeItem'); | |
You can use `null` for a trigger parameter to skip its configuration. | ||
You may use `SwitchableJSRule` to create a rule that can be enabled and disabled with a Switch Item. | ||
As an extension to `JSRule`, its syntax is the same, however you can specify an Item name (using the `switchItemName` rule config property) if you don't like the automatically created Item's name. | ||
See [openhab-js : triggers](https://openhab.github.io/openhab-js/triggers.html) in the API documentation for a full list of all triggers. | ||
### Rule Builder | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.