LIFX Developer Zone

Creating a simple on/off switch in C# .NET Where To Start?

Hello! Im completly new to the LIFX API and I was wondering if someone could give me a quick example of a simple switch.
Im trying to create a application that will be able to turn on and off the lights!

If you cant give me any examples, is there any “Get started” documentation on here? Because I couldnt find any.

If you are using the HTTP API there are plenty of examples.
If you are using the LAN protocol then you won’t need any because using it requires a depth of knowledge that does not require examples. If you read the posts you will find questions already have been asked.

There are API’s using the LAN protocol created by members of the community, do a search on Github and you will find a few just make sure you are using fairly recent ones that support the latest firmware.

Thanks for the reply.
I couldnt find anything on GitHub except for dotMortens example and that one used WPF and got very confusing very fast.
About the link you sent me. It doesnt cover C# only PHP, Python and cURL.

I know that to begin this project I need tha pplication to connect to my network to find the Lightbulb which runs on WiFI. Then I simply need to create a switch. But I cant even access the functions because I couldnt find a library.

Anything I can do to help you with the sample? Btw these aren’t WPF samples, but Windows Store samples, so I"m a little confused.
The amount of code isn’t really more than what’s presented on the front-page.

If you’re building a Windows 10 you can also use AllJoyn. I have another library that makes that really easy.

I’d invite you to try:
Simply use the LifxMvc.Services assembly.

Hi emorrison1962 - I wonder if your suggestion might also work for a problem I’m working on(?)…

I am looking for a library that can be used with a Java application running on desktop that I’m writing in order to control my lights. For example I’d like to implement a “power orb” that takes data-feed from my solar inverter and smappee to calculate net generation vs consumption and changes colour from green to red so I can quickly see current state.

Basically it’s a Java Restful implementation that I’d like to use to turn-on change colours of bulbs etc. When I searched a few months ago I couldn’t see a Java library that implemented methods to interact with bulbs, the timothyb89 library went someway along that path but didn’t support v2 of the firmware. As such I’ve been writing code to create UDP packets with headers etc myself.

Might your MVC assembly perform the functions I’ve mentioned above and be referenced by a Java desktop application?

Thanks for any help!


Matt, I’m sorry, but I’ve not developed in Java. Can you reference a .NET
assembly from java? If so, give it a shot.

There are 2 things I know of you can use. LifxNET (its in nugget)
or I wrote an extension and a console app for that

My plugin in (BixLIFXConsole) runs as a console app and accepts http simple URL for commands. This way I can use programs like homeseer,bash (curl), ha-bridge or whatever to access the bulbs.

Turn on all lights that start with “Kitchen Light”, Dim to 80% and make it a white color of kelvin 2700**
http://localhost:9105/?Light=Kitchen Light&Power=On&Dim=80&Color=2700

1 Like

Have you ever used visual studio Visual Basic?