Total noob here, looking for a way to gradually dim a bulb or LED strip over a 1-hour period (color doesn't matter)

Um, yeah what the title says. I haven’t done programming since high school, so I need to ask a lot of dumb questions. Browsing around this site though, I read about the “breathe” and “cycle” options, maybe there is something in those I could tweak? Has anyone else out there tried to get the bulbs to do this with success?

To start RTFM.

You can power off a bulb over x period where it dims down via the HTTP api or the app on your phone.
You can set a schedule on the app or via IFTT

E.g. in set state send through the HTTP command to changed your brightness level from say 100 to 30 % and do that over 1 hour do what you want.

This is your opportunity to learn. Also lookup github there are a lot of examples in multiple languages on how you can control your lights etc. great for learning.

There’s no way do do this without coding (unless there is an app that already does it). You can turn the lights off over half an hour by holding the tap on the light icon in the LIFX apps main screen and then selecting your power off time period.

Otherwise you’ll need to get yourself a webserver (the same thing you need to get in order to host a website) and do some coding with the HTTP API (link is at the top of this page)

Alright, I warned that I’d be asking a lot of dumb questions…here we go! I tried doing the hold-tap thing that abrythenabry said, that works great! I’d still like to get more functionality (e.g. increase max time of power-down, and control the curve of the power-down) with coding.

Can I just use my own computer as a webserver? Barring that, is there a standard server that developers use just for testing (since I don’t really want anyone else but me to access whatever it is I’m going to code)?

I’ve been playing around with the LIFX HTTP API examples, and I guess this should be obvious, but what do I do with all the code that is generated? Is this the stuff I’m supposed to put on the server that I don’t have? I managed to generate an authorization token, so I’ve got that going for me, which is good :confused:

Aha! So the examples in the HTTP API section will control the led strip I have directly! No need to copy/paste…I think this is the solution that will work just fine for my purposes :smile:

For the densest noobs like me who may be searching this forum for a way to dim a lightbulb over a time period up to 100 years (haha!) here’s what I did:

  1. Go to HTTP API section, click on “Authentication” in the left-hand menu.
  2. Click the link in the first paragraph that says “account settings”
  3. Do what it says to generate a new token. Copy the resulting gobbledegook it gives you to your clipboard.
  4. Go back to HTTP API and click on the “Set State” under the API ENDPOINTS menu. It has a little purple “PUT” in front of it.
  5. Scroll to bottom of page, type in “all” for selector, “off” for power, “white” (or whatever color) for color, “1.0” for brightness (max. brightness in this case), “3600” for duration (one hour in seconds), and “0” for infrared.
  6. Click the green button to the right of “Try It Out”, paste the authentication token in here.
  7. Click try it!
1 Like

The samples will work but lots of hassle.
If you are interested in learning and as you say you don’t have a server, get yourself a Raspberry pi.
It is cheap and good to learn from.

You can then start learning some Python scripting, lots of examples in github and Python comes with Rasbian the default OS.
you then can create your scripts etc and run them easily enough and learn.

Or you can buy a POP switch, I have mine set to turn off the lights over 5 mins as I go to bed, nice and easy. click twice and lights come on dull red and go off again about 2 mins later, enough time to stumble to the loo and back to bed again.

If you want to learn then start with Raspberry Pi, also there Coder, it is a web server etc for Rasberry Pi that you download the disk image and off you go, you can create your own websites or modify theirs and put your coding into the background. create a home website to control your lights.

lots of learning there anyway for you if you are interested. if not, go buy pop and play with IFTT or get a googe home (one day LIFX might actually work with it)

Don’t use a web server for this kinda stuff. Use serverless services like AWS Lambda ( or Microsoft Azure Functions or something else (there’s a few others, Google’s is in alpha but should be public beta soon from what they are saying in their forums). It’s worth noting that with AWS Lambda you can invoke those cloud functions on a schedule.

So, and this is a crude example, you could setup two Lambda functions. One to make a simple API call to dim and one to make one to brighten (or just turn 100% lets say).

The dimming function you set on a schedule in AWS to run every 5 minutes lets say in the evening. It dims by 8.5% so over the hour it runs 12 times (102% … so off on the last run). You’ve now dimmed your light to off over an hour. The code to do this is stupid silly small. The configuration in AWS is more of a hassle, but isn’t too bad.

Then in the morning you run the other Lambda on a schedule and it flips the light back on to 100%.

Total invocations is about 13 per day. Total time it takes them to run is like 13 seconds probably less, but probably no more than 24 seconds. RAM usage is super low so your total cost (and you can see AWS’s pricing page) is like fractions of a penny per day here. I bet you can run a good number of API calls on a schedule using something like AWS Lambda and pay maybe $1-$5 per year if you’re unlucky. I bet it ends up costing less than a $1 for many folks.

To run a server for this kinda stuff is absolutely wasteful and silly.

Hey AliceCombs.

Good on you for investigating the web API and setting up your token. Just wanted to let you know there’s no need for a webserver (or paid web services) like the other comments said. You send those requests to LIFX’s webserver… your token is what identifies your individual account/bulbs (this is exactly what’s happening when you test it on their website).

To make it more convenient you can have your phone do all this. Unfortunately there’s no iOS version of Tasker, so you might have to do some research if you’re an Apple user. But the below is for Android.

In the LIFX web API you should see an example using the command “curl” (linux command). Now there’s various ways to send the HTTP request using Java, or Python, etc… but I wanted to just use curl. So you can download Termux, which is a terminal emulator for Android so you can use the curl command. Then you can use Tasker to get creative with how you want to trigger sending that command, like turning off your lights when you’re 1km away from your home, or using NFC tags to toggle your lights, etc.

If you’re using an iPhone I’m not sure how you would go about this, but iOS is unix based, so using curl is probably possible somehow.