Use Java to talk to your LIFX color light bulbs on your local LAN.
The emirac LIFX Java Library communicates with LIFX bulbs on your LAN. It's a Java archive called
"emirac.lifx.jar" that consists of a few objects and interfaces that facilitate discovering bulbs
and querying and setting their power, colors, and names. Complete documentation for the API is
online here: http://www.emirac.net/lifx/doc
All communication is via UDP over the local wireless LAN.
No internet, no cloud connection, no tokens needed. There's no need for an internet connection
because everything happens on the local net.
Typical round-trip times between your program and bulbs are well under 10 milliseconds.
Java programs can talk to your bulbs from your PC.
Java programs can talk to your bulbs from your Raspberry Pi.
Java programs can talk to your bulbs from your Android device.
The video below shows the Fire program running on an RPi and sending many messages to bulbs and
discovering a new bulb.
During the time the RPi program runs the CopFone app jumps in and sends and receives lots of messages
to flash the bulbs from an Android.
After CopFone exits the Fire program is still working. When Fire
exits it returns the bulbs to their initial state.
This is an example Java program called "Fire" that uses the emirac LIFX Java Library.
Fire will run on any Java platform that can do wi-fi. Here it's running on the RPi. Fire consists of
two Java classes: Fire1.java and FireTask.java.
Fire1: contains the main entry point. Keeps track of the bulbs discovered and their initial conditions.
Creates a runnable FireTask for each new bulb and adds it to an ExecutorServce threadPool.
FireTask: one FireTask for each bulb. FireTask is a runnable with an infinite loop which changes
its bulb's color to make it flicker.
Fire finds every bulb on your local net and makes it flicker like a candle. When it shuts down (via ctrl-C or the "enter" key)
Fire resets each bulb to its original color and power state. All the code for fire is below.