Huy's Notes
Control Philips Smart Light Bulb via UDP

Control Philips Smart Light Bulb via UDP

I just picked up a couple of Philips Wiz Light Bulbs from HomeDepot. They're cheap compared to a Philips Hue or other smart lights but worked well.

One thing, they need to be connected and controlled via a mobile app. Like many other computer nerds, I want to do it right on my laptop, but there is no public documentation on how to do it from the manufacturer.

But again, it's 2020, and the product is on the market for quite a long time, so as I expected, the people like already figured out how to do it and posted them online everywhere. In fact, it's surprisingly (and worryingly) easy.

All we need to do is send a JSON payload to the light bulb via a UDP request on port 38899. No password or authentication is required!

    "id": 1,
    "method": "setPilot",
    "params": {
        "r": 255,
        "g": 255,
        "b": 255,
        "w": 255,
        "c": 255

We can do it right on the terminal emulator by something like:

echo "{json payload}" | nc -u -w 1 <bulb-ip> 38899

For example, the following command changes the light color to 4800k and 70% dimming, with is the IP address of my light bulb:

echo '{"id":1, "method":"setPilot", "params": { "temp": 4800, "dimming": 70 }}' | nc -u -w 1 38899

If you're not a bash fan, let's try some JavaScript:

const dgram = require('dgram');
const socket = dgram.createSocket('udp4');

const send = (opts, ip) => socket.send(`{
  "id": ${Math.floor(Math.random() * 10)},
  "method": "setPilot",
  "params": ${JSON.stringify(opts)}
}`, 38899, "");

  temp: 4800,
  dimming: 70


Referred in

If you think this note resonated, be it positive or negative, please feel free to send me an email and we can talk.