LIFX Developer Zone

How to send a packet to a LIFX bulb using the LIFX LAN Protocol

I’m learning the LIFX LAN Protocol and have a rather dumb question. So once I’ve constructed the packet how do I send that packet to a LIFX Bulb and how do I send it to all the bulbs?
Thank you in advance for helping out a beginner.

Hello,

I would strongly suggest using an existing library like LIFXLan or Photons

The basic premise is you create a UDP socket and then throw bytes at it. It’s recommended you only broadcast the GetService to 255.255.255.255 and use the StateService replies to know what devices are on your network.

Then you “unicast” bytes to specific devices, which is the same as a broadcast, but instead of sending to 255.255.255.255 you send to the specific IP of the device you want to talk to.

To test your packet you can use software like PacketSender ( https://packetsender.com/ ) before you try to embed it in code.

Those two libraries are in Python, if you’re using some other language you may have to hunt around for a better library. Here is a PHP library - https://github.com/kz/lifx-php

1 Like

I suggest Bardolph.

1 Like