Control Slider
To control the Slider value of specific luminaire of network you can send a CONTROL message to server over active WebSocket connection (and opened wire). The "targetControls" parameter of the message uses similar format as received with unitChanged event of the related device. The "value" of the Slider object of the message is the wanted percentage (decimal number) between Slider Min and Max value for the related luminaire. The Min and Max values of the Slider are available via related unitChanged event. Min and Max values are normally within range of [0..100].
let wire = 1; // Use same wire ID as was used in the related OPEN message for the targeted network
let unit_id = 1; // Device ID of the related luminaire
let targetControls = {"Slider": {"value": 75.0}}; // Slider value converted to range [Min..Max]
if (webSocket.readyState === webSocket.OPEN) {
const data = JSON.stringify({
"wire": wire,
"method": "controlUnit",
"id": unit_id,
"targetControls": targetControls
});
socket.send(decodeURIComponent(escape(data)));
}
When CONTROL luminaire of network message was successful then server will send unitChanged event (with updated state info) of related device to all related clients and color of related luminaire will be updated.