From 8ee86d786a97c1556ef49e17307cf2d9691632ea Mon Sep 17 00:00:00 2001 From: funkstille <13382630+funkstille@users.noreply.github.com> Date: Fri, 24 Jun 2022 13:25:01 +0200 Subject: [PATCH] [dmx] Update README.md (#12914) * Update README.md Added Example for ECMAScript --- bundles/org.openhab.binding.dmx/README.md | 25 +++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.dmx/README.md b/bundles/org.openhab.binding.dmx/README.md index 59be03274..9cc9709f7 100644 --- a/bundles/org.openhab.binding.dmx/README.md +++ b/bundles/org.openhab.binding.dmx/README.md @@ -213,20 +213,41 @@ If the new string is invalid, the old configuration will be used. This binding includes a rule action, which allows to immediately change DMX channels from within rules. There is a separate instance for each bridge, which can be retrieved e.g. through -``` +:::: tabs + +::: tab DSL + +```php val dmxActions = getActions("dmx","dmx:sacn-bridge:mydmxbridge") ``` where the first parameter always has to be `dmx` and the second is the full Thing UID of the bridge that should be used. Once this action instance is retrieved, you can invoke the `sendFade(String channels, String fade, Boolean resumeAfter)` method on it: -``` +```php dmxActions.sendFade("1:41/3","10000:255,255,255:-1", false) ``` The parameters are the same as in a chaser thing configuration. Defining more than one step in `fadeString` is supported, too. +::: + +::: tab JavaScript + +The first parameter always has to be `dmx` and the second is the full Thing UID of the bridge that should be used. + +```javascript +actions.get("dmx","dmx:sacn-bridge:mydmxbridge").sendFade("1:41/3","10000:255,255,255:-1", false); +``` + +The sendFade parameters are the same as in a chaser thing configuration. +Defining more than one step in `fadeString` is supported, too. + +::: + +:::: + ## Full Example This example defines a sACN/E1.31 bridge in unicast mode which transmits universe 2 and three things: a three channel dimmer used to control a RGB light, which takes 1s to fade from one color to another and 10s from 0-100% on incremental dim commands, a single channel dimmer which will turn on only to 90% if it receives an ON command and does not fully switch off (to 10%) if it receives an OFF command and chaser which changes the colors like a traffic light.