Turn network on/off/dim
To control the dim level of all luminaires of a network you can send a CONTROL message to server over active WebSocket connection (and opened wire). The "level" parameter of the message is the wanted dim level (number) for the related luminaires.
let wire = 1; // Use same wire ID as was used in the related OPEN message for the targeted network
let value = 0.5; // Dim value can be anything from 0 to 1
if (webSocket.readyState === webSocket.OPEN) {
const data = JSON.stringify({
"wire": wire,
"method": "controlNetwork",
"level": value
});
socket.send(decodeURIComponent(escape(data)));
}
When CONTROL luminaires of network message was successful then server will send unitChanged events (with updated state info) of all related devices to all related clients and related luminaires will be on/off/dimmed.