I have 10 of the original LIFX bulbs, in several groups from 1 to 5 lights. What I want to have - since years - is a very basic and simple function:
Changing the color of 1 or several bulbs smoothly and continuously through the whole color wheel at a predefined brightness and intensity level. The speed of changing the colors should be very flexible so that it is possible to do it so slowly that you don’t realize that there is a change in colors.
Best thing would be to have this function in cloud, from a website or from a script of a local NAS (for example Synology) and not controlled from an app on the smartphone.
The existing effect “color circle” seems not to be able to handle this according to my wishes.
Because there are a number of 3rd party LIFX apps, maybe one of them supports what you’re trying to accomplish. On Android, there are quite a few that may be able to do what you’re looking for like Light DJ for Hue & LIFX
The LIFX Android app is pretty limited in what it can accomplish when it comes to programming the lights. It also runs down your phone’s battery since it has to stay running in the background when doing animations.
As another idea, I wonder if you could program something to do this yourself. Sure, it’s on you at that point, but that would make this possible a lot faster.
I believe since the lights are stateless, it’s possible the only way to get them to change like this is to send them a bunch of commands over time to change color. This means if you wanna do this for a longer period of time, you’d want a Raspberry Pi or an old desktop computer to manage it.
It should be just as easy to do it from the cloud. I bet anyone could create a web service that could do what you want and require you only give it an Auth Token from https://cloud.lifx.com/settings.
I can try setting something up a cloud service to color cycle a group of lights and see if it’ll work like I’m thinking.
Was a windows app that you set your parameters to do most anything, was brilliant. I had it do exactly what you are asking for and you barely noticed the change but the firmware changed, his app no longer worked and he never updated it.
I think I know why this isn’t a thing now. After a lot of testing the last few hours, the lights don’t change color smoothly to a bunch of different colors. I don’t know how other manufacturers handle this, but I was messing with the stepping of how many degrees I change for a given duration to find a smooth transition. The way I’m seeing it, you can visibly see some of the color steps if you go too fast.
Depending on your brightness and saturation, it’s possible orange will go away before you can blink and green and blue will sit there forever. This has to do with the fact that there’s a lot more green on the spectrum than other colors. This means we might wanna add more intelligence to get the hue to cycle cleanly between what we perceive as visible colors. I won’t be doing any of that work because of time constraints, but it’s an interesting problem to solve for sure.
Tonight’s been all about proving this is possible. All of the work I’ve done so far uses the LAN protocol. The final implementation will use the HTTP API so anyone’ll be able to put in a LIFX token and Group Name to activate a color cycle. That’ll all be in a separate project though.
There’s some math involved in making this appear smooth. Say you go in increments of 1 degree per second. For 360 hue changes, that’s 6 minutes.
360 hue variations / 1 degree increments / 1 second between each color change = 360 seconds
360 seconds / 60 seconds in a minute = 6 minutes for a complete cycle
If you want it to do a complete cycle in a total time of 1 minute, that’s:
1 minute for a complete cycle * 60 seconds in a minute = 60 seconds
360 hue variations / 1 degree increments / 60 seconds = 6 seconds between each color change
From my testing, if I set it to 1 millisecond between each color change, (360ms for a complete cycle), the lights won’t be able to react fast enough and will eventually stop responding to color change requests. So this is somewhat dependent on the electronics in the lights themselves as well.
For an example of a smooth color change:
360 hue variations / 5 degree increments / 0.5 seconds between each color change = 144 seconds
144 seconds / 60 seconds in a minute = 2.4 minutes for a complete cycle
Here’s the branch I made for the LAN protocol color cycle changing:
This is the file where the middleware resides:
Apart from my unreadable attempt at keeping this functional, it takes a duration, degree increments, and lets you set the initial brightness and saturation.
After switching to using the HTTP API, I realized how easy this could’ve been. The HTTP API nicely lends itself to this sort of thing.
I noticed the same problem with smoothness if I changed the colors too fast without enough steps in between. That, I’ll have to work on tomorrow. I bet I can get this up on a server tomorrow and have it ready for you to use! That way, you can hit this URL, give it a group or light name with an API token, and you’re good to go.
Grab a LIFX API Token so you can activate this with your online account.
It’s a really simple app that you can run at home if you want instead of having to run it through my free Heroku dyno. I added an HTML interface really quick just to give you some simple config options.
Works on your phone browser, but I forgot to add the one-line of HTML that causes the page to look mobile-friendly. The frontend is mostly HTML and some JS on top to handle hitting the API.
Hope this works for you!
If you have any questions or need some more functionality like the ability to start on a color other than red, go ahead and ask. You’re also more than welcome to fork the repo and send in a pull request. I’m sure I’ve missed some of your requirements.
great, thank you so much. I’m having a problem though with the time setting. no matter which value I put into the ‘time between changes’ field. the cycle always seems to take the exact same amount of time = roughly 60sec.! Screen Shot|690x388
any advice on what I’m doing wrong?
also is there a way of adding multiple groups or all groups to the cycle?
starting from a custom color would be nice to have but is really not that important for me. maybe it could just start from the current color?
and one last question. what would be the best way to stop a cycle midways. just override with the app or turn off/on the bulbs?
edit: actually it also seems that the ‘hue jump per change’ setting doesn’t change anything no matter which value I use?
You’re right! Duration isn’t working because I forgot to add it to the list of values that gets sent when you click “Submit”.
Adding multiple groups means you need to the ability to add field groups, and then I need to extend the API to listen for multiple selectors. At that point I’d wanna store that data so the next time you open the page you can get back to it. I can store it in a database based on your API Token so when you put that in, it’ll allow you to load previous settings
I will change the code to start from the light’s current color. Won’t take more than a few minutes to make these changes tonight. They’ll probably be fixed next time you’re messing with it.
wow, I really didn’t mean for you to put that much work into this. I appreciate it though.
in regards to multiple selectors, would it be simpler if it wasn’t multiple groups but just ‘all groups/light’? that would be more than enough for most people. not sure if you can call all groups/lights more easily?
the simple UI is more than sufficient for my needs!
For now I’ll have it end back on the hue value it started; although, if your lights were white, they’ll end on a color. I’d have to spend some time adding code to check the state of the lights ahead of time and then set those back when everything’s done. Probably would take 30-45 min to code and test, but that’s for another night.
This all sounds very interesting - I just would need more time for testing and playing…
BTW, I knew the script of the guy, mentioned by boxhead, but he seems to be completely offline…
Thanks a lot, Sawtaytones, for all your efforts - this seems to be a very cool and good solution. I hope, I will get this (or such a) script running on my local NAS. That is the way, I would prefer it most. I had little experiences with PHP years ago, but I’m not into practice.
But I tried already your HTTP API and it works! Nevertheless I can reproduce the issue, too, that “Time Between Changes in Seconds” and “Hue Jump per Change” have no effect.
Furthermore it seems to be a problem, if a minus sign (hyphen) is included in a light name.