Using f.lux with Yeelights! First alpha release

Hey guys,

I’m pretty new to coding in general but I recently started to get into Python. I have written a little script that automatically changes your Yeelight bulbs to f.lux display color.

If you don’t know what f.lux is, it’s a tool to darken your display in the evening/night smoothly to reduce strain on your eyes.

First alpha release on here:
Supports up to 5 lamps.
If anybody wants to test it and give feedback, I’d appreciate it!




Are you interested to put your tool in the recommendation list of Yeelight app?

1 Like

Sure, that would be great!
Where can I find that list?

I will PM you about the details.

1 Like

This is awesome. Waited for someone to develop this for a long time. Working pretty good.

You should include an installer which enables autostart.

1 Like

@lepathi Glad to hear you like it and thanks for the feedback! I will definitely try to include that.

Don’t forget to think about a way to differentiate between a remote session to the PC and normal Usage. I don’t need my lights to turn on when I am accessing the PC through VPN from the school. Maybe check the “Turned-On”-Status of the lights and only apply settings when they are already turned on.

Alright, for the installer and autostart I still have to read a bit and figure out how to do that.

For your status-check request: I personally want my script to turn the lights on so I will likely add an option in the config, something like “Only control bulbs that are already turned on”. So the script would theoretically do nothing if all lights are off, even when it’s on autostart. Or just control one light of 5 or similar.

1 Like

I am totally looking forward to see your results.
Take your time. :slightly_smiling_face:

1 Like

Awesome! Please continue developing.

“Only control bulbs that are already turned on”

This is a must have feature for me.

In the future it would be awesome to have something like this that is not dependent on a PC being turned on. Maybe a Raspberry Pi like solution that could control the lights. This way the PC could be off and the lights would still change.

Edit: Stupid me. F.lux already supports Linux! :slight_smile:

1 Like

Hi @coasterli ,

how can we see the recommendation list in the Yeelight app? on my app it is empty.

Show me your empty page


I don’t get it… what does this f.lux app do? It only knows which time of day it is??? I maan, if you’re adjusting the bulbs with your script, what is f.lux needed for???

No, it’s not just a clock.

So basically, new research shows that blue light at late hours can keep you awake and is bad for your sleep pattern and general health (see this article from Harvard Medical School). What f.lux does is adjust your display in the evening/sunset/night with a smooth transition to show less blue light. It looks like warm orange-red filter, because the blue subpixel are made darker.

Same with your Yeelights. If you have them at max brightness with 6500K, your lamp emits very much light of the blue wavelengths. By lowering color temperature, we reduce those. This script only synchronizes the two (optimally you shouldn’t use your computer in the night at all and you should put your lamps at red color for best sleep induction, but that’s not the point here).

1 Like

great work @davidr! I’m just waiting for it to show up on my recommendations list which is currently empty. Looking forward to trying it out since I’m already using f.lux on my macbook

I understand the concept of blue light etc, I was just wondering what f.lux does that you can’t do directly with your scrip (get location, time zome, sunrise/sunset etc).

Ah, I understand.

Well, I could write a script that basically does the same as f.lux - basically dim your lights depending on your timezone and corresponding sunset times. But the most important point of f.lux is that it dims your monitor, which is way too complex for me to write a script for. So I use the data f.lux provides to synchronize it with my Yeelights - nothing more.

I’ve been a f.lux user for years and in the evening I just turned my lights off when I didn’t have any smart lighting. Even a regular desk lamp can be detrimental to your sleep schedule. Now it’s all automated! :slight_smile:

1 Like

Thank you! From your screenshot I think you’re on the wrong menu though. It’s not built into the app, it’s just on the list for recommended apps under integration, see here. The script has nothing to do on your phone anyway, you need to run it on your computer.

On your phone you need to enable LAN control for the bulbs you want to control. For Mac OS, I cannot provide you with a tutorial as I use windows but it should work. Afaik it should have Python installed, so the file should work for you. But maybe you have toi install Python by yourself, it’s fairly easy to do. If you need any help, I can try and help you set it up.

I thought Windows 10 has this already built in in some extent - there is “night light” option which sets blue to lower value at night.