Just got control of my Milight RGBW 11w led bulbs using Blynk…
maybe of use to someone.
I found the codes at https://raw.githubusercontent.com/stoman/milight-api/master/doc/limitlessled-documentation.txt, and found that communication is via UDP and port 8899.
I managed to cobble together (with my limited knowledge) a program that allows me to have faster /easier control (on/off and colour) than the app that comes with it. So now I can control my surround sound volume (spi digital pot) my talktalk YouView common commands plus(ir) and control the lights with one app and one dashboard.
Happy man.
Anyway UDP control was quite simple in the end …
First add
#include <WifiUdp.h>
Then add
const intUDP_PACKET_SIZE = 3;
byte packetBuffer[UDP_PACKET_SIZE];
unsigned int localPort = 8899; // Milight port
int milight; //data to send to milight
IPAddress udpServer(255, 255, 255, 255);
WiFiUDP Udp;
And in setup() add
// v22 button lamps on, button v23 lamps off, slider v25(0-255) is colour. (group1)
BLYNK_WRITE(V22)
{
memset(packetBuffer,0,UDP_PACKET_SIZE);
packetBuffer[0]=0x45;
packetBuffer[1]=0x00;
packetBuffer[2]=0x55;
Udp.beginPacket(udpServer, 8899);
Udp.write(packetBuffer,UDP_PACKET_SIZE);
Udp.endPacket();
}
BLYNK_WRITE(V23)
{
memset(packetBuffer,0,UDP_PACKET_SIZE);
packetBuffer[0]=0x46;
packetBuffer[1]=0x00;
packetBuffer[2]=0x55;
Udp.beginPacket(udpServer, 8899);
Udp.write(packetBuffer,UDP_PACKET_SIZE);
Udp.endPacket();
}
BLYNK_WRITE(V25) // colour slider
{
unsigned int colData = param.asInt();
memset(packetBuffer,0,UDP_PACKET_SIZE);
packetBuffer[0]=0x40; //command change colour
packetBuffer[1]=colData; //0x00; // colour number 0-255
packetBuffer[2]=0x55;
Udp.beginPacket(udpServer, 8899);
Udp.write(packetBuffer,UDP_PACKET_SIZE);
Udp.endPacket();
}