Reverse engineering of the DEKOR Lighting Protocol which is used to control LED lights connected to the DEKOR EZ WiFi Controller.
The DEKOR Lighting Protocol is sent entirely in plain text over TCP port 4001 to the DEKOR EZ WiFi Controller. Every command requires a UNIX timestamp and a CRC32 hash appended to every command. Of importance, the CRC32 hash must include the semicolon before the CRC32 hash. See examples for more information.
+;1;GETINFO;1;{UNIX TIMESTAMP};{CRC32}
+;1;GETINFO;1;{UNIX TIMESTAMP};{CRC32}
+;1;GETSCHED;0;{UNIX TIMESTAMP};{CRC32}
+;1;SETSCHED;0,{ON TIME},{OFF TIME},{LIGHTING LEVEL},{DAYS OF WEEK};{UNIX TIMESTAMP};{CRC32}
Parameter | Description | Valid Values |
---|---|---|
ON TIME | Schedule lights on at this time. | 0000-2359 |
OFF TIME | Schedule lights off at this time. | 0000-2359 |
LIGHTING LEVEL | Schedule lights on at this lighting level. | 0-100 |
DAYS OF WEEK | Repeat lighting schedule these days. | MTWRFSN |
+;1;SETSTATE;{ON/OFF};{UNIX TIMESTAMP};{CRC32}
+;1;SETLEVEL;{0-100};{UNIX TIMESTAMP};{CRC32}
+;1;SET;NAME,{NAME};{UNIX TIMESTAMP};{CRC32}
This example will turn the lights on.
$fp = fsockopen('10.0.0.X', 4001, $errno, $errstr, 30);
$command = sprintf('+;1;SETSTATE;%s;%d;',
'ON',
time()
);
fwrite($fp, $command . crc32($command) . "\n");
fclose($fp);
This example will set the lighting level to 50%.
$fp = fsockopen('10.0.0.X', 4001, $errno, $errstr, 30);
$command = sprintf('+;1;SETLEVEL;%d;%d;',
50,
time()
);
fwrite($fp, $command . crc32($command) . "\n");
fclose($fp);
This example will set the lighting schedule to repeat all days of the week (MTWRFSN) with an on time of 1600, an off time of 0730, and an initial lighting level of 100%.
$fp = fsockopen('10.0.0.X', 4001, $errno, $errstr, 30);
$command = sprintf('+;1;SETSCHED;0,%d,%d,%d,%s;%d;',
1600,
0730,
100,
'MTWRFSN,
time()
);
fwrite($fp, $command . crc32($command) . "\n");
fclose($fp);