[dmx] Update README.md (#12914)

* Update README.md

Added Example for ECMAScript
This commit is contained in:
funkstille 2022-06-24 13:25:01 +02:00 committed by GitHub
parent 7f86947ceb
commit 8ee86d786a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.