Skip to content
Open
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
16 changes: 14 additions & 2 deletions tutorials/getting_started/rules_scenes.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,19 @@ Use the following block and add the _scene id_ to the block to call the scene
Save it and that's it.
:::

::: tab JS
::: tab Groovy

```groovy
var ruleManagerBundleContext = org.osgi.framework.FrameworkUtil.getBundle(org.openhab.core.automation.RuleManager).bundleContext
var ruleManagerServiceReference = ruleManagerBundleContext.getServiceReference(org.openhab.core.automation.RuleManager)
var ruleManager = ruleManagerBundleContext.getService(ruleManagerServiceReference)
ruleManager.runNow("scene_office_dimmed_light")
ruleManagerBundleContext.ungetService(ruleManagerServiceReference)
```

:::

::: tab JS Scripting

```javascript
rules.runRule('scene_office_dimmed_light', {});
Expand All @@ -127,7 +139,7 @@ Save it and that's it.
rules[“id”] gives you the rule object for the given id, which supports the [trigger method](https://openhab.github.io/openhab-jruby/main/OpenHAB/Core/Rules/Rule.html#trigger-instance_method) (aliased as run).

```ruby
rules["scene_id"].run
rules["scene_office_dimmed_light"].run
```

::::