Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rules tweaks #2336

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion concepts/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ rule "Window open reminder" do
changed gWindows.members, to: OPEN, for: 1.hour
run do |event|
# Item guaranteed to be OPEN here, no need to check
notify("#{event.item.label} is open for an hour!")
Notification.send("#{event.item.label} is open for an hour!")
end
end
```
Expand Down
22 changes: 16 additions & 6 deletions configuration/jsr223.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ sRule.setTriggers([
]);

automationManager.addRule(sRule);
```

```js
// And the same rule using the helper library:

const { rules, triggers } = require('openhab');
Expand Down Expand Up @@ -185,7 +187,9 @@ s_rule.set_triggers([
])

$automationManager.add_rule(s_rule)
```

```ruby
# And the same rule using the bundled helper library:

rule "A Cron Rule in Ruby" do
Expand Down Expand Up @@ -234,12 +238,18 @@ To facilitate JSR223 scripting, several openHAB-related variables are automatica
They can be loaded into the script context using `scriptExtension.importPreset(String preset)`, e.g. `scriptExtension.importPreset("RuleSimple")`.
The `default` preset is preloaded, so it does not require importing.

- [`Default`](#default-preset-importpreset-not-required)
- [`RuleSimple`](#rulesimple-preset)
- [`RuleSupport`](#rulesupport-preset)
- [`RuleFactories`](#rulefactories-preset)
- [`ScriptAction`](#scriptaction-preset)
- [`cache`](#cache-preset)
- [Overview](#overview)
- [Example rules for a first impression](#example-rules-for-a-first-impression)
- [Script Locations](#script-locations)
- [`ScriptExtension` Objects (all JSR223 languages)](#scriptextension-objects-all-jsr223-languages)
- [Default Preset (`importPreset` not required)](#default-preset-importpreset-not-required)
- [`events` operations](#events-operations)
- [RuleSimple Preset](#rulesimple-preset)
- [`RuleSupport` Preset](#rulesupport-preset)
- [`RuleFactories` Preset](#rulefactories-preset)
- [`ScriptAction` Preset](#scriptaction-preset)
- [`cache` Preset](#cache-preset)
- [`TriggerType` Objects (all JSR223 languages)](#triggertype-objects-all-jsr223-languages)

#### Default Preset (`importPreset` not required)

Expand Down