After a play with the plugin, you will probably want to control the lamps directly from scenes. The Luup for this is straightforward. Each command requires a UDP packet of three bytes to be sent to the WiFi Bridge. The following examples assume the bridge is on IP address 192.168.1.240 - change as required.
To turn on zone 1 (MiLight White)
socket = require("socket")
local s = socket.udp()
s:sendto(string.char(0x38,0x00,0x55), "192.168.1.240", 50000)
s:close()
The WiFi Bridge will accept a sequence of commands provided there is a gap of at least 50ms between them. Some special commands require at least 100ms gap (see command list).
To set zone 1 to full brightness (MiLight White)
socket = require("socket")
local s = socket.udp()
s:sendto(string.char(0x38,0x00,0x55), "192.168.1.240", 50000)
luup.sleep(100)
s:sendto(string.char(0xB8,0x00,0x55), "192.168.1.240", 50000)
s:close()
To set zone 1 to half brightness (MiLight White)
socket = require("socket")
local s = socket.udp()
s:sendto(string.char(0x38,0x00,0x55), "192.168.1.240", 50000)
luup.sleep(100)
s:sendto(string.char(0xB8,0x00,0x55), "192.168.1.240", 50000)
for i = 1,5 do
luup.sleep(50)
s:sendto(string.char(0x34,0x00,0x55), "192.168.1.240", 50000)
end
s:close()
The commands must be sent as hexadecimal bytes as shown above. The commands are:
MiLight White
35 00 55 - All On
39 00 55 - All Off
3C 00 55 - Brightness Up
34 00 55 - Brightness Down (There are ten steps between min and max)
3E 00 55 - Warmer
3F 00 55 - Cooler (There are ten steps between warmest and coolest)
38 00 55 - Zone 1 On
3B 00 55 - Zone 1 Off
3D 00 55 - Zone 2 On
33 00 55 - Zone 2 Off
37 00 55 - Zone 3 On
3A 00 55 - Zone 3 Off
32 00 55 - Zone 4 On
36 00 55 - Zone 4 Off
B5 00 55 - All On Full (Send >=100ms after All On)
B8 00 55 - Zone 1 Full (Send >=100ms after Zone 1 On)
BD 00 55 - Zone 2 Full (Send >=100ms after Zone 2 On)
B7 00 55 - Zone 3 Full (Send >=100ms after Zone 3 On)
B2 00 55 - Zone 4 Full (Send >=100ms after Zone 4 On)
B9 00 55 - All Nightlight (Send >=100ms after All Off)
BB 00 55 - Zone 1 Nightlight (Send >=100ms after Zone 1 Off)
B3 00 55 - Zone 2 Nightlight (Send >=100ms after Zone 2 Off)
BA 00 55 - Zone 3 Nightlight (Send >=100ms after Zone 3 Off)
B6 00 55 - Zone 4 Nightlight (Send >=100ms after Zone 4 Off)
MiLight RGB
22 00 55 - Lamps On
21 00 55 - Lamps Off
23 00 55 - Brightness Up
24 00 55 - Brightness Down (There are nine steps between min and max)
27 00 55 - Mode Up
28 00 55 - Mode Down (There are 20 modes. The lowest is constant white)
25 00 55 - Speed Up (Fast)
26 00 55 - Speed Down (Slow)
20 xx 55 - Set Colour to xx (value shown on MiLightRGB plugin converted to hexadecimal)
Edit 15/03/2013 - Added additional MiLight White commands. Thanks to Hamish at LimitlessLED.