Hardware Dimmer

Hi Lopter,

Yes it looks interesting and sure if my dimmers talked to the lightsd daemon, and that was the only thing that talked to the lights, then that would work, if the daemon was able to accept incremental instructions, which from the protocol you have published, it cannot, although I am sure it would be easy to make it do so if the code is open source.

But the downside is that the code then takes 2 hops to get to the bulbs instead of 1 and further latency is exactly what you dont want. Also why cant the bulbs do this?

It sounds like a great project but I am hoping that LiFx can do this the right way. It is afterall very much in their interest to do so, people would kit out their whole houses if this was fixed! (Well some people would!)



lightsd totally can totally be used to send incremental commands: getting the state of the bulbs from lightsd is a very cheap operation and the state of the bulb is guaranteed to be as close as possible to their actual state (lightsd can sample the bulbs more than one time per second). One of the examples shipped with lightsd shows an incremental operation:

The bulbs are completely stateless that’s why they can’t do it. Moreover, you always have 2 hops since the traffic as to go through the access point anyway. Then, if lightsd is running on your access point directly or on a device wired to that access point then going through it adds very negligible latency.

All of that said, I see what you mean and commands that takes relative values could be implemented both in the LAN API and in lightsd.

I don’t know if I’ll implement that in lightsd since you can easily emulate it. One thing I want to do at some point with lightsd is being able to subscribe to updates which will further reduce the latency cost of that emulation (at the benefit of being able to do other things like display the actual status of the bulbs pretty accurately).


I know this doesn’t address your desire for a hardware brightness adjuster like a knob, BUT… I was able to use my phone volume buttons to turn the lights on and off which is much easier than unlocking your phone, launching the app etc. etc.

You would need a jailbroken iPhone with ‘Activator’ and ‘Activate Command’ installed. Then you would link the event of holding down the ‘volume up’ or ‘volume down’ button to a curl or bash script that runs the power on or off command. It’s a bit of a hack but gets the job done in no time.

As for controlling it in a knob-like fashion, I toyed with this in my free iOS app ‘LIFX Ambience’ by using the built-in gyroscope such that you could flip the phone over to the left to turn it off or to the right to turn it all the way on. It’s still experimental and I would very much appreciate any feedback or suggestions for improvement on this. You can check it out here:

It currently won’t respond to the gyroscope when the phone is locked or in the background. That is something I am thinking about ways to get around.

I think the OP’s point was that it’s not atomic. Personally, it doesn’t seem that important to get a mathematically correct answer if two people are adjusting the brightness simultaneously. But I understand the sentiment, given how much time at my day job I used to spend tracking down errors caused by non-thread-safe code.

Ummm… the bulbs are inherently stateful, and they are actually in the best position to be able to do atomic updates to their own state.

Edit: Now that I think about it, I can see why incremental updates in the bulb wouldn’t work so well, since the protocol is unreliable. Although you can ask for an acknowledgement, if the acknowledgement doesn’t arrive, you don’t know if the request was lost, or only the acknowledgement was lost. This is similar to the problem I mentioned previously. Or to put it more succinctly, incremental updates are non-idempotent.

I really wish LIFX bulbs provided a secondary protocol that allowed building really low-powered switches that doesn’t rely on WIFI - you need mains powered for that. I agree using your phone for turning bulbs on really aren’t feasible for full usage.

This is what the Philips Hue bulbs got right - I absolutely love my battery-less Hue Tap buttons, but do like that the LIFX bulbs are bridge-less and much brighter. We use our Philips bulbs where we actually have day to day usage - the lifx bulbs are mostly on ordinary switches and from time to time we’ll adjust them for special occasions (like red on Halloween etc).

I’ve been tinkering with the idea of making a ZigBee-switch-to-LIFX bridge to solve some of this. It’ll keep the bulbs bridge-less but add bridge-powered switches for LIFX.


You guys may want to look into these switches/buttons. They require no power. You would need a bridge between the switch and the bulb though.


Or if your willing to spend more $$ you can use Crestron like I am.


i’d like to know how you got that to work, and what functionality you could get from it. feel free to email me: me at davecotter dot com

How do you have the Creston dimmer connected to your Lifx bulbs?

I am really surprised that a year has gone past and there is practically speaking no change. I am aware of the Pop home switch, but its really not the thing I think most users want.

Here is what I have in mind:
Its essentially like an LiFx bulb, has the same WiFi and Communications infrastructure. You can discover it in the app too, and when you do the app allows you to place it in a group. The group contains at minimum 1 bulb and 1 dimmer but may also contain several bulbs and several dimmers. If we wanted to get fancy we could allocate weather it was colour, brightness, or both at once we wanted to change. This information is sent to each dimmer on exit from that part of the app.

The device itself has a shaft encoder, (that can turn infinately in either direction) and possibly a button. So you push the knob to toggle a switch and otherwise can turn completely fully in one direction. If you want to get fancy, it could have a break so that the knob becomes harder to turn in 1 direction when the bulb is on max or min - thats a nice to have touch feedback but not essential.

When you turn the knob clockwise the device fetches state of each bulb and then increments and sends by the amount turned. counterclockwise decrements. The state is only interrogated after a pause. Each lamp in the group has its own brightness sent to it. Its not likely to work right if two dimmers change the brightness at the same time but we can live with that. But unless you are playing a modern version of that game where you stand at the bottom of the stairs and your child stands at the top and you both try to convince the other that the 2-way switch is broken by switching it exactly when they do… but then that would be that would be too much fun!

Now the reason it would be so much better if LiFx did this than me, is because for this to “feel good” latency should be at a minimum and using the existing LiFx radio structure would likely be faster. The reason we cannot handle two people using 2 dimmers at once is because we cannot send atomic incremental commands, only absolute values and also its UDP so a few commands may get lost. But it would still be really good.

I want to kit out my house with LiFx bulbs but I dont want my guests children and everyone else having to download an app. I also dont want them messing with lights in my room when they are in another room. The normal thing is you change the brightness and/or colour of the lights in the room you are in.

So the toggle/switch on the knob? Well, that just uses software to switch the lamp on and off. I’d like this in 2 versions - battery and mains wire in replacement, but the battery version is probably not possible. The wire in replacement should fit in the space of a normal switch and if we have to provide live and neutral so be it. (Some switches do not have the neutral in them, just the interrupted live, as we intend to put the switch in always on mode, we will need the neutral. )

Now lets consider safety. What if you need to change the bulb socket? Switch of the electricity at the board = you should do that anyway. Change the bulb. Well that doesn’t happen often and so we can say that you should also switch of the electricity at the board in that case too. Or live dangerously & change the bulb live. I am not going to sayy that tho. Lastly, what do you do if your router fails, this could leave you with no lights! Two possiblities. Either you turn the electrity off at the board and on again, the lamp will come on with at least 25% brightness, you cannot turn it off but maybe thats not a big issue until your router is fixed. Or we make the knob toggle button work as an actual light switch (configurable depending on how you connect) then you are covered against router failure completely.

So LiFx, pretty please, would you make this? You will wipe the floor with your bulbs (well even more!!) and people will kit out their whole house with bulbs not just 4 or 5 as at present so this is massive for LiFx.

You still won’t do it? It would be pretty hard (But not impossible) to do this with non-LiFx kit. And you dont get the full integration you would have otherwise. I’m a software Engineer. Perls my thing but I can do most languages. So send me a development kit and sign me up, and I’ll develop it!

The world needs this. I need this gadget. I need a job(!). LiFx needs this. And so, particularly do LiFx shareholders!

An IoT twistable knob would likely have a range of applications past simply LIFX. Maybe a development firm like www.flic.io would be partial to the suggestion.

Just found this: http://www.nobcontrol.com/

(Flic) It wont really work because flic’s are battery operated, and its hard to have something wi-fi thats battery operated, (Flics do bluetooth for that reason.) On the otherhand using the existing LiFx wifi would work really well, link in with the lifx app, and allow you to replace your wall switch which has mains power, or plug in a knob to a mains power socket.

(nobcontrol.com) Interesting project. But I dont feel it would help here, as it would be hard to incorporate the LiFx protocol without introducing an additional device and extra lag. :frowning:

(deleted as posted twice in error.)

to fix your issue with flic is wall mounted phone/ tablet i have a wall mounted tablet in a central location in the house

There’s a device called Welle on Kickstarter http://kck.st/2mYNd59 and I found a video about it working with LIFX here https://youtu.be/ycDz3tdehbI. Think it looks interesting.

Flic is coming up with a Hub that goes on pre-order tomorrow.

Apparently they have a Linux SDK as well, so I’m assuming you could pair them to a Raspberry Pi and get them working that way. I was able to pair a Logitech POP to my Windows PC, but I didn’t know how to do anything with it after that. I’m sure the Flic, as it has OS-specific tooling could be programmable when paired to various devices.

I believe if you install Android on a Raspberry Pi, you’ll have a home automation solution.

Alas nothing worth using yet. Last I saw Android on Pi had lots of issues with touch screens and play store etc.

@markwin I just wanted to post an update to this thread and tell you that I was able to make my own hardware dimmer with a ~$30 Raspberry Pi 3 and a ~$1 simple rotary encoder with a push button.

I basically followed this tutorial to set everything up, then changed the volume controls to light brightness controls instead. Here is my modified python code.

It works REALLY well. It’s snappy too since I am using the LAN protocol. Each clicky-turn of the knob results in a ± 20% in brightness. Pushing down on the push-button toggles the lights on and off. I have it set up next to my bed for maximum laziness! haha