LIFX Integration doesn't seem to be correctly using the API


Simple example:
Manually, set a bulb to 10% brightness, color blue (any color will do)

Using WebCoRE, create a piston that sets the LIFX bulb brightness to 100%, leave everything else untouched.

When you run this piston…

The expected behavior
The bulb fades from 10% to 100%, maintaining its color.

What actually happens:
Bulb immediately jumps from 10% to 100%, without fading, and color changes to white.

It seems to me that WebCoRE is providing default values when they are not supplied rather than allowing LIFX to supply the default values.

I’ve tested this both manually with the API directly, and also via WebCoRE, and it’s easily reproducible.

As a secondary test, I used the “Make a PUT request” Location method, and it worked as it is supposed to be working. The light faded to the supplied brightness and maintained its existing color.

Example tests:
This method, ignores the current color and defaults it to white with a duration of 0 seconds.

This method maintains all existing settings, and nicely fades the lights to 100%
The anonymized url is :{{:selector}}/state
And an authorization header is being supplied Bearer {{LIFX Token}}


You may want to attach an image of the piston by clicking on the green camera icon above the piston.


Ok. Didn’t think it was necessary since it was only one line. Will do.


Ignoring your API question for a moment:
A “Set bulb to 100%” command does just that.
It "sets’ the bulb to 100%. (it does not gradually fade in)

For the record, there is a “Fade” command here in webCoRE…
Just be aware that once a fade starts, (for all practical purposes) it will run thru to completion.

Now this baffles me. A command such as:
Set Bulb's level to 100%
…should not touch the current color.

Maybe it is because of your alternative wording?


I would normally agree with you, but the point of the LIFX Integration commands built into WC are to utilize the API that LIFX provides. So if I leave a parameter unspecified, then WC should not be defaulting values for me, it should just be passing that through to LIFX.

The LIFX API automatically fades for transitions for color, brightness and on/off changes. If you do not want it to fade, then you set the duration to zero.


Ahhh… For what it’s worth, I have never used a “built-in” API call…
I usually call them via a “web request” as your second example above.


Yeah, LIFX is the only built in API integration that can take commands like this for WC. You have to set up the API key in the integration settings in WC (same place you set up your IFTTT maker key).

Now that I’ve got it set up to use Web Requests instead of the built in LIFX integration, I’ll probably keep that way anyways, even if this gets fixed. WC seems to primarily be using the state API method. But they also offer a states API method, which allows sending multiple commands at once.

I also noticed that doing it using the Web Request method, the piston is running significantly faster, and the lights are getting set much more quickly. It also helps that their API offers a “fast” property on all of their API methods, which allows you to ignore errors and state checks. So that also allows for faster run times.


This makes sense to me, since it is a direct call, instead of going thru a middle man for processing.