Anyone have PHP code for LAN Protocol?

Just wondering if anyone has some sample PHP code for the LAN Protocol?

Thanks

I’m not aware of any. It might be easier to open a socket and talk to @lopter’s excellent lightsd application. Let me take a shot at writing some simple PHP code for you, it might take me a little while though.

1 Like

I am also interested in PHP LAN protocol sample code.

Any updates? I am greatly interested in some sample code for using the LAN Protocol with PHP.

Hello all,

I’m the author the small background service that @daniel_hall was talking about (lightsd).

I don’t have PHP examples yet; but lightsd’s protocol is pretty simple and I wanted to chime in since I just added a small “how-to” to write a lightsd client:

http://lightsd.readthedocs.org/en/latest/protocol.html#writing-a-client-for-lightsd

It has a Python example, but I’m pretty sure it will be easy to translate to PHP.

Any question or remark let me know!

Thanks for the info. I briefly started to look into lightsd the other day after posting but haven’t had a chance to dig in yet. My plan will probably be to put it on a Raspberry Pi. I will look at it more later this week.

1 Like

Sounds cool, let me know!

lightsd should be pretty easy to get running on Raspbian if you’re using that; here are the build instructions:

http://lightsd.readthedocs.org/en/latest/installation.html#build-instructions-for-debian-based-systems-ubuntu-raspbian

It’s not PHP, but there is a really cool NodeJS module…

https://www.npmjs.com/package/node-lifx

Currently missing multi-zone support. There is no stable release tagged yet, but what is there is fully functional and I don’t expect the API to change significantly, if at all. However, I would currently recommend depending on specifically dev-master#f5be2229eaaf24536c74931beaa32cd48898ab2d as this is a known-good point in history (current point, at time of writing).

Here it is in Java as well, in case you’re interested. As with Dave’s release, these are also missing MultiZone support.