Photons - Opensourcing a new framework for interacting with LIFX lights

Hi,

Over nearly two years now I’ve been writing a framework at LIFX for interacting with our lights. I am pleased to announce that I’m opensourcing a large portion of this framework!

It’s called photons and it can be found at https://github.com/delfick/photons-core

Photons is powered by asyncio and requires Python3.6. It’s also thoroughly unit tested.

The main difference from existing libraries in terms of API is a focus on sending messages to serials instead of calling specific methods on device objects, which gives a greater level of control over how we deliver those messages.

You can also do a number of common tasks straight from the commandline without having to create your own scripts. For example you can turn all your strips red by saying lifx lan:transform match:cap=multizone -- '{"power": "on", "color": "red"}' or set a label on a device by saying lifx lan:set_attr d073d5000001 label -- '{"label": "kitchen light"}'.

You can find information about what Photons can do over at https://delfick.github.io/photons-core/

I look forward to seeing what people think of and do with my work!

Stephen.

thanks but won’t install on Windows so I will stick with LifxLAN.

Fair enough. I hadn’t tried it on Windows previously. Seems I need to make uvloop optional for that to work.

Not saying the work isn’t appreciated just reading it was fully tested yet it wasn’t known it didn’t work on windows well… it also looks complicated at first glance, definitely for those who can use it all, me I like LifxLAN as it is simple and Meghan does an amazing job maintaining it.

Going to give it a go on Raspbian, would Photons work with Mulesoft Jython ?

yeah, there are parts of it that are a bit complicated. Some of my decisions make more sense in the context of the private version of photons.

I’ve only tried it with cPython on mac and on a raspberry Pi so I’m unsure if it works with Jython. I assume it would though…

I pretty much never use windows which is why I hadn’t tried it on that yet. I just spent a few minutes trying to get it to work and it seems uvloop isn’t the only problem. I’ve created an issue about it over at https://github.com/delfick/photons-core/issues/1

Thanks and good luck with getting it to work on windows.
For jython we can’t use C extensions nore is there anything like pip. No matter it was just me playing with it.

Thanks :slight_smile:

Too bad about it not working in Jython :frowning: