The #VSCP server now use Duktape for embedded JavaScript

JavaScript has been possible to use for a long time now in the DM of the VSCP server. The DM, which stands for Decision Matrix is a way to tell what should happen when events (some would call them messages) comes in to the server from external sources (local or remote). The old engine V7 has been replaced with Duktape for best functionality and performance.

The decision matrix is documented here if your want to read more about it. Examples of operations (called actions in VSCP terms) is to compare measurement values, log measurements in a database, send data to a remote server,  and a lot of others.  You can of course execute external scripts of any type  and with the built-in JavaScript engine execute code snippets.

A typical example is in the script above where a CLASS1.CONTROL, Type=5, TurnOn event is sent to  Zone=11, Subzone=3 every second.

As scripts can be stored in variables it is possible to remotely and dynamically change the content of the script and therefore also the outcome of the action.

Variable substitution is another dynamic feature where escape variable are filled with dynamic values before the script is executed by the JavaScript engine.  The current list of escapes id available here.

Some custom VSCP functions is available and this list will of course be increased with socket communication and other. It i also possible to load external functionality from disc.