LIFX HTTP for noobs

If you’re like me, and lacking technical skills to understand the LIFX HTTP API then there’s an easy workaround to reduce the commands to a single HTTP GET or POST.

  1. Connect your bulbs to IFTTT
  2. Create a recipe with a maker event (HTTP request) as the trigger, and a LIFX bulb as the action.
  3. The HTTP command will end up looking like this:{event}/with/key/{your-key-here}

Ha! That is a novel but very cool idea! Keep in mind that going through the IFTTT servers first may increase the latency and make the command take longer. But hey, whatever works for you. :smiley:

Nice hack! :smile:

Have you figured out if there’s a way to send the colour code via the URL too. I sent up a few recipes, but didn’t find that out yet.

IFTTT is a pretty slow service, certainty not a replacement for direct communication with the LIFX cloud, but it’s a decent workaround until I learn about HTTP headers for using the LIFX API.

I don’t think so, in my experience each unique command needs a unique URL.

Good news! You absolutely can with a few slightly advanced IFTTT tricks.

In the latest release of the LIFX IFTTT channel we added the advanced options section which can be used to change any of the select boxes to an option that isn’t select able. It also allows you to use IFTTT ingredients (basically variables) in place of certain options.

In your case you want to get one of the Maker provided ingredients (value1, value2, and value2) and use those to override the color. I’ve published an example IFTTT recipe demonstrating this. Then all you have to do is submit the argument to the maker channel. You can do this with curl like this:


And your light should change to the color selected. This will also work for breathe, pulse and all the other actions.

You can read more about our ‘Advanced Options’ field here:


If you are having issues with headers, let me know what language you are using and I’ll make some sample code for you. :smiley:

1 Like

Thanks for the offer, but I managed to figure out what I was doing wrong after doing some more reading. :smile:

I am trying to change my white 800 color warmth using the above technique, but instead of putting the advanced options in the recipe directly I am passing the custom variables via POST (also tried PUT) like so:

<form method=POST action='[myEvent]/with/key/[myKey]'>

<input name=value1 placeholder='color' />
<input name=color placeholder='also color' />
<input type=submit value='do it'></input>


The data I am entering into the inputs there is ‘kelvin: 9000’

It seems to me that the data I am passing to the maker channel isn’t having an effect on the LIFX event. Am I doing something wrong? Is it possible to manipulate the warmth and brightness of my light programmatically via my own PHP script talking to the maker channel on IFTTT?

That looks right, the value should show up in the value1 variable in IFTTT. You can use this in the advanced options section like this: {{ Value1 }}. If that isn’t working you might be better of contacting IFTTT support.

Otherwise send me a screenshot of the ‘Action Fields’ page and I’ll see if I can spot any issues.

(I’ve bumped your account to a new trust level so that you can upload files.)

Here’s the recipe on my phone:

As you can see I have left the advanced options blank. If I put advanced options in there it will read from those options fine, but whether or not I have advanced variables there the ones passed from my PHP script don’t have any effect.

Do I have to wrap my PHP string in double curly brackets? Am I making any sense?

Essentially what I am trying to do is run a PHP script on my server that will modulate a colour value (just white for now, as I only have a white 800) and send events to the maker channel in order to pass the data through IFTTT to my LIFX bulb. Thanks for the rapid response, btw :wink:

Edit by @daniel_hall: Embedded the images

Okay so IFTTT will only use those values if you tell it to, and it can only use them in the advanced options field. IFTTT also only accept values passed in that are named Value1, Value2 and Value3. So, you can’t just choose custom in the dropdowns, you also need to enter something in the Advanced Options section.

In your case, if you just want to change the color I would change your form to look like this:

<form method=POST action='[myEvent]/with/key/[myKey]'>

<input name=value1 placeholder='color' />
<input type=submit value='do it'></input>


For now I would set brightness to a fixed value and leave color as custom. Then put the following in the ‘Advanced Options’ section:

color: {{ Value1 }}

Then visit the page with that form in your browser enter #00ff00 in the color box and press submit. Your bulbs should then change to a very deep green.

I also want to ask if I can have permission to edit your post to embed those images directly in your post? I think it would help other users people understand how it works.

You sir, are a gentleman and a scholar.

I finally have it working. Here’s my IFTTT action settings:

And here’s my PHP/HTML:

<form method=POST action='[myEvent]/with/key/[myKey]'>

Value1: <input name=value1 placeholder='brightness' />
Value2: <input name=value2 placeholder='color' />
<input type=submit value='do it'></input>


Note that the <input> names value1 and value2 are not capitalised. That was the gotcha in this case.

And feel free to embed those images :wink:

Edit by @daniel_hall: Embedded images

You are very welcome. I’m glad to hear that you got it all going.