Controlling LIFX bulbs using LAN Protocal with Java Application rather than Android

Hi, I’m new to the community so I’ll apologise in advance if there’s a better place to be posting this, I have had a good look around the pages though and couldn’t find anywhere that appeared to be related.

I’m wondering if anyone could point me towards an example of how I can control my bulbs via a Java Application using the LAN Protocol? At the moment everything I’ve seen assumes I’m using Python or running an Android Java app. Having already written most of my home automation software in Java (controlled using RestfulAPI) I would much prefer to be able to augment with this rather than use something entirely different.

I’ve found a post here:

… that seems to suggest I can import an android library into my Java Application, however when I do this all of the methods require Android Contexts to be passed to them, making me thinking I’m very likely barking up the wrong tree!

Is there a Java specific library that you’d recommend I use? And perhaps some examples how I go about using it?

Really appreciate any advice!

Thanks, Matt

Currently I’m not aware of any Java library that works with the latest firmware and does not require the Android framework libraries. If you wanted to try tackling one yourself I would be happy to assist you. My Java is a little bit rusty, but should be passable. The first step is to learn how to send LIFX messages for which I wrote a quick tutorial.

Hi Daniel, thanks for your reply.

Whilst researching how I’d go about doing this, I stumbled across this repository:

Have you heard of anyone using this? Does the code in there look sensible to you?

Thanks for any info! Help is much appreciated!


I haven’t tried that library, but I can see that the author recently updated it to support bulbs with the V2 firmware.

There is one way to find out! Give it a shot and see how it goes. :smiley:

Remember to report back so others can benefit from your investigation.

I have created Java libraries for working with Lifx smart lights. You can download the source code here:

There may be some bugs. I have included some sample code in the main function to assist in using the code

1 Like