Make your lights work like f.lux

If you haven’t used f.lux before its an application that makes your display match the light outside. The main aim here is to remove the blue light from your computer screen as the sun sets.

Here is how you can do it automatically with LIFX.

Evening Settings

This recipe will set your lights to a nice warm white in the evening, and it will do it over a period of 15 minutes. The slow transition is to make the light change unnoticeable. This recipe is also configured not to turn your lights on if they aren’t already.

Morning Settings

This recipe is similar to the one above, it transitions to cool white over 15 minutes without turning your lights on if they aren’t. This means that the settings will be completely invisible if they are off, but when you turn your lights on they will turn on as the expected color.

1 Like

I did something similar with local rule processing, running on Raspberry with Windows IoT Core:


Click my name in the tweet to see the image (just note that there’s a bug in that code screen shot. “||” should be “&&”)

This is all based on code from this article I wrote:
https://www.hackster.io/dotMorten/discovering-and-interacting-with-any-alljoyn-device-0dbd86?

It also works with my Hue Bulbs using my AllJoyn bridge:

Basically this code is always run at the right time of day for each device found to implement LSF, as well as when a bulb is discovered (so if a bulb was off when sunset hit, it’ll auto-trigger on that bulb the moment it gets back online).

Here’s the code used to determine if any AllJoyn device found supports setting temperature:

private async Task<bool> IsSupportedDevice(IService device)
{
    var lampState = device.Objects.SelectMany(i => i.Interfaces).
                       Where(i => i.Name == "org.allseen.LSF.LampState").FirstOrDefault();
    if (lampState == null)
        return false;
    var lampDetails = device.Objects.SelectMany(i => i.Interfaces).
           Where(i => i.Name == "org.allseen.LSF.LampDetails").FirstOrDefault();
    if (lampDetails != null)
    {
        var prop = lampDetails.GetProperty("VariableColorTemp");
        if (prop != null)
        {
            try
            {
                var value = await prop.ReadValueAsync();
                return (bool)value.Value;
            }
            catch
            {
                return false; //If reading this value doesn't work, it's probably not supported
            }
        }
    }
    return lampState.GetProperty("ColorTemp") != null; //Assume it's supported if the property exists
}

The best part is this work without internet access, because it’s all based on local processing.

1 Like

is that feature built into the lifx app? that would be great! i dont want to fumble around myself with schedules…how did they do it here? http://www.lifx.com/blogs/light-matters/19034143-the-lighter-side-of-circadian-rhythms why not integrate this? what about working with drexel university or f.lux developers on integrating this? do the ifttt-recipies also take into account the brightness level? automatic daylight+brightness control would be nice. thanks

hi, i know this post is old but i would like to try out your iftt applet. the thing is when i try to turn it on and save the settings i get an error “your applet is invalid see error below”, no error is below that i can see. if possible would you be able to tell me what settings you used so i can create my own possibly. so just to get this right also all i would have to do is turn on the light and the applet would already have ran, so that the light would be a warm incandescent temperature.

Is there an updated version of this? I’d really like to have my lights synced with f.lux

It would be really nice if the mobile apps supported this function directly… Turn off slowly at night (intensity and temperature)… And do the reverse in the morning.

That would also resolve the issue of a power loss (cycle) at night… Bulb would come back to life at the last intensity (off).

I haven’t bought an IFTTT hub yet… Maybe eventually, but I’d like to avoid purchasing more hubs and the like until I move into a house someday… (E.g, I don’t really need it right now, and by the time I do want to go “all out” with respect to home automation, there will almost certainly be a lot of different and better options.)