Have an idea for an application, but have limited experience. Looking for advice

I have an idea for a small program will trigger lights based on our VOIP phone usage. However, I haven’t coded in 15 years. I want to start with a small daemon that sits in the background and listens for broadcast traffic on UDP 2088. It will then trigger predefined actions for certain light(s) on the LAN based on certain data in the packet.

I’ll start with something non-interactive, but if I figure it out, I’ll later add on a small front-end that lets a user input the phones and other variables.

I’d like to try to figure this out mostly on my own, but I want to make sure this is possible for a noob. (I spent most of my career configuring routers, firewalls, VOIP PBXes, etc.) If so, what language should I start with? Ruby? Or, is this more of a run before you walk kind of thing?

Thanks!

Hello Andy,

Yes, that’s perfectly possible. Using a high-level, garbage collected, language like Ruby is also the right good idea.

LIFX exposes two APIs:

  • HTTP API: goes through LIFX’s servers so you’ll get a full RTT back and forth the Internet worth of latency, on the other hand the API is very easy to use;
  • LAN API: use the local API exposed by each LIFX bulb, much less latency but much harder to use as well. I actually wrote a small daemon to make that API pretty much as easy to use as their HTTP API, you’ll find more info in this thread.

If you haven’t really done programming before, I would recommend Python over Ruby: the syntax is much simpler to pick up than Ruby. If you have done some Perl before I guess you’ll be fine with Ruby though.

Best

1 Like

Thanks. I’ve done some simple IFTTT things with the HTTP API, but I’m going to try to work with the LAN API. Latency will be pretty important. Obviously, I’ll start slow, with the normal tutorials and sample programs and work my way up. See if I can just get it to listen on a port and print something when it receives the correct packet, for example. Hopefully I’ll get to the point where I can use your API.
Thanks for the advice on Python, by the way. I’m going to start on it today when I get some free time at work. :slight_smile:

If you are going with Python, you might be interested in these libraries that can be used to control a bulb over the LAN.

There are also many more that can be found by searching PyPI, but I haven’t used them yet.

Thanks!
I started with learning how to print “hello world!” I just got to the point where I have Python installed on two different computers (Linux and Windows). The Linux Python script is listening on UDP 9030 for a certain string. If it receives it, it turns my office light on (calling another script Bulb_On.py). If not, it turns if off (Bulb_Off.py). The Windows Python script sends the string on port 9030. I just got it to work.

Next I can have it listen on the BLF port for the phones. I just have to figure out how to make it recognize and react to the data in the packets.

2 Likes

It works!

1 Like