Have you ever wished your lights would turn off on their own when you went to sleep? Or that they’d change color when your favorite sporting team scored? With LIFX smart light bulbs and IFTTT, we’re pretty close to that ideal and magical connected light bulb reality.
LIFX smart light bulbs are energy efficient LED bulbs that can change color and be controlled via smartphones and smartwatches. They are quite entertaining and rather easy to set up on your home Wi-Fi network.
To give our lights some autonomy, we’ll be using a service called IFTTT (short for “If This Then That”) which allows you to set rules based upon different internet connected devices and/or services. These rules can then trigger responses like your smart light bulbs changing color.
In this article, we’ll explore how to set up a LIFX smart bulb and then we’ll explore connecting it to IFTTT. Within IFTTT, we will set our lights to turn off when our Jawbone UP24 is in sleep mode. Afterwards we will look at how to set the bulb to change color if our favourite sporting team is playing.
Setting Up Our LIFX light bulbs
I’m on Android, so I’ve installed the LIFX Android app:
Open the app and click “Add Bulbs” to set up your LIFX light bulb. Make sure your LIFX light bulb is turned on otherwise it may not appear!
Choose your bulb and your home Wi-Fi connection, then you’ll be greeted with this wonderful screen allowing you to name the location of your LIFX light bulb, assign it to a group and give it a name:
Once it assigns all of those settings, you’ll see your new location and group in the LIFX menu with your bulb inside it. If you press the power button next to the location, group or individual LIFX light bulb, the light will turn off. If it turns off successfully, then you are ready to go!
You can click on the bulb name in the menu to open up the controls for your bulb. Here you can change the color of the light (either different shades of white or completely new colors like purple from the “Colors” button on the bottom left). You can also set up effects like a strobe light via the “Effects” button.
Now you’ve had a bit of fun with those settings, let’s look into how to connect up the LIFX light bulb to other web triggers via IFTTT.
Connecting Our LIFX Light Bulb To IFTTT
To create a new recipe, create an account on IFTTT and log in. Then, click your username in the top right and choose “Create”. This takes you to your New IFTTT Recipe Page.
We are then taken to a screen saying “ifthisthenthat”, click the “this” link to begin our process:
In the “Choose Trigger Channel” section, type in “UP” and choose the UP icon that appears.
If you are new to IFTTT and haven’t previously connected your UP to the service (likely!), there’ll be a screen that shows a button saying “Connect”. Click that button and follow the prompts to give IFTTT permission to access your UP data.
Once you are set up, choose “Sleep mode enabled” in the trigger options that appear.
Finish it by clicking “Create Trigger”.
Now we’ll have “if UP Sleep mode enabled then that” awaiting us. Click “that” to set up our LIFX smart bulb.
Type in “lifx” into the “Choose Action Channel” filter and click the LIFX icon. You are likely to need to connect up LIFX too, click the “Connect” button and go through the prompts to give IFTTT access to your LIFX account.
We’ll arrive at the “Choose an Action” section, here we select “Turn lights off”. This will set our light to be off when sleep mode is enabled.
Before IFTTT can turn off our light, it needs to know which lights we’d like to turn off. You can choose individual light bulbs, or whole locations or groups. I chose the individual bulb.
Next, we can set how long we’d like our lights to gently fade to the off state. I’d personally like to get straight to sleep in the wonderous glow of darkness, so I’ve selected “Instant”.
Then click “Create Action” to finish setting up this action.
Now you can give your IFTTT recipe a name and set whether you want your phone to notify you each time it runs. I’d recommend not setting your phone to notify you here as this is something we’d like to happen silently so we can rest! Once you are happy with the name and notification settings, click “Create Recipe”.
Once it has created your recipe, it will direct you back to your My Recipes page where you’ll see your new recipe ready and waiting to be tried out!
Testing Out Our Connected Light Bulb
Now for the fun part. Get our your Jawbone UP24 and set it to Sleep Mode. Your smart light bulb should automatically switch off!
If you wanted to set the light to turn on again when you wake up, you could set another recipe to do the opposite. For me though, it’s usually daylight outside when I wake up so I’d rather not turn my light on each morning unnecessarily.
Connecting Up Our Light Bulb To ESPN
We can also use IFTTT to change the color of our light bulb depending on different triggers. Let’s explore triggering our light bulb color to change whenever our favourite sporting team is playing!
Go through and create a new recipe as we did before, however this time for the “Choose Trigger Channel” section, find and select ESPN:
On the next screen, choose “New Game Start”:
Then choose the sport and team you’d like to trigger the action. I chose my favourite NBA team – the Phoenix Suns.
After that, choose LIFX again as the Action Channel, however rather than turning off our lights, choose “Change color of lights”.
Our options for this one are a lot more plentiful than the turning off light option! Here you can choose what color you’d like the light to change to, choose how bright you’d like it to be (or leave it at the brightness it already is), say whether you’d like this action to turn on the light if it isn’t already switched on (I chose “No” as Phoenix might be playing whilst I’m not home and I’d rather not cause a huge energy bill from an eager Phoenix Suns smart light bulb!) and then finally how long the transition should be (I chose “Instant” once again because I want it to happen straight away). Once you are happy with all those settings, click “Create Action”.
Finish it by clicking “Create Recipe” and surprise your friends when they come over to watch the next sporting match with you!
Not every bit of IoT enabled functionality necessarily needs a truck load of coding! Thanks to services like IFTTT and devices like the LIFX smart light bulb, setting up delightful interactions with internet enabled devices can be simple and easy for even non-coders to complete! Have you got a favourite IoT based IFTTT recipe? Did you come up with a good alternative trigger for your own LIFX smart light bulbs? Leave a note in the comments or get in touch with me on Twitter (@thatpatrickguy), I’d love to hear about it.
PatCat is the founder of Dev Diner, a site that explores developing for emerging tech such as virtual and augmented reality, the Internet of Things, artificial intelligence and wearables. He is a SitePoint contributing editor for emerging tech, an instructor at SitePoint Premium and O'Reilly, a Meta Pioneer and freelance developer who loves every opportunity to tinker with something new in a tech demo.
The Principles of Beautiful Web Design, 4th Edition
Learn PHP in One Day and Learn It Well
Docker for Web Developers