If This/Then That (IFTTT) and the Belkin WeMo

How I used an Internet service to automate home lighting without installing any software.

Like most good technologists, I am lazy.  In practice, this sometimes means that I will work quite hard with a computer to automate a task that, for all intents and purposes, just isn’t that hard.  In fits and starts for the past 10 years, I have been automating my house in various ways.  It makes my life easier when I am at home, though it does mean that friends who watch my house when I’m gone need to be briefed on how to use it.  If you are expecting to come into my house and use light switches and the TV as you do every place else, well, that’s why you need a personalized orientation to the house.

In this post, I’ll talk briefly about one of the most basic automation tasks I’ve carried out, which is about how the lights in my house are controlled.

The humble light switch was invented in the late 19th century, with the “modern” toggle switch following in the early 20th century.  The toggle switch has not changed in about 100 years because it does exactly what is needed and is well understood.  The only disadvantage to the toggle switch is that you have to touch it to operate it, and that means getting off the couch.

My current home is an older home that was previously a storefront.  All the plumbing is on one wall of the house, which I sometimes jokingly call “the wall of modernity.”  The telephone demarc is on the opposite side, though I’ve made some significant modifications to the telephone wiring from the days when I was using Asterisk more extensively.  As a large open space, there is not much built-in lighting, so most of the lights are freestanding floor lamps.

The initial “itch” that I was scratching with my first home automation project was a consistent forgetfulness to turn off lights when I went to bed — I would settle into bed up in the loft and then realize that I needed to get up and turn off a light.  At that point, remote controlled lights seemed pretty darn attractive.

My first lighting automation was done with Insteon, a superset of the venerable 1970s-era X10 protocol.  With Insteon controls, I could use an RF remote and toggle lights on and off from a few locations within the house.

With the hardware in place, I turned to finding software.  An RF remote is a good start, but I wanted to eliminate even that.  What I found is that the home automation community doesn’t really have off-the-shelf software that “just works” and lets you start doing things out of the box.  I used Mister House for a while, but at the time I was using it, the Insteon support was pretty new.  I worked with a friend writing some automation code — well to be honest, being a tester for him, but we were solving problems unique to our homes, not writing something that was ultimately going to be the answer for our parents.

Earlier this year, I was introduced to IFTTT, which stands for “If This, Then That.”  It is the closest thing I have seen to a generic software stack that can readily be used for home automation purposes.  IFTTT can be used for much more than just home automation, but I’m going to stick to that restricted use for the purpose of this post.

There is much to like about IFTTT, so I’ll focus on just a few attributes:

  • Programming without knowing programming.  I’ve taken enough computer science courses to know how to write a program, but I’m not good enough to be a professional programmer.  IFTTT lets you write rules — essentially, programs that control objects in the physical world — without the high bar of learning specialized syntax or all the system administration work that goes along with running a program.
  • Extending control beyond my home.  Traditional home automation has been based on sensors inside the home.  In order to respond to something, there needs to be a sensor to gather that data.  To turn the lights on after dark, you need a sensor that tells your house it’s dark.  To do something when it’s raining, you need a sensor that gets wet, and so forth.  As you’ll see, IFTTT lets you choose a location and use information from Internet services to assemble the context.
  • One of the cleanest and easiest designs I’ve seen.  I know everybody brags about design, but IFTTT is so simple that a colleague of mine in sales uses IFTTT extensively.  (Insert your own joke about the technical competence of sales representatives here.)

To act in the physical realm of my house, though, IFTTT requires devices that can take action.  The Belkin WeMo is a family of products, including a remote-controlled electrical outlet, light switch, and motion sensor.  The WeMo uses Wi-Fi to connect to my home network, so it can be controlled by any device on my network, or any service on the Internet.

So, let’s start out with a simple idea: I have a light, and I’d like to turn the light on when it’s dark.  In traditional home automation, I can easily do that by picking a time to turn the light on and using the same time every day.  If I pick a time that is appropriate for the winter, though, the light will come on too early in June.  If I pick a time that is right for June, I’ll have to get up and turn the lights on in December when it gets dark.  Or, using traditional home automation, I could find a source of sunset times, pull them in manually, and hope the data feed I’m using never changes.

That is, until IFTTT.  In this example, I’ll show you how to set up a WeMo to have a light that turns on at sunset.  IFTTT mini-programs are called “Recipes” and consist of a trigger and an action.  Building a recipe is a straightforward guided process that begins by picking the trigger:

IFTTT mini-programs

IFTTT’s interaction with the world is organized into “channels,” and more channels are being added on a routine basis.  The first step in creating a recipe is to choose the trigger:

choose the trigger

Triggers are organized alphabetically.  I cut the screen shot off after F because I wanted to get down to W for Weather and WeMo.  The first time you select the weather channel, you’ll be prompted to set a location; I chose my home in San Francisco:

set a location

The weather channel has a number of components that you can choose to use as a trigger.  Some are expected, such as the weather forecast.  However, the weather channel also allows you to take actions when conditions change.  The weather data used by IFTTT is also rich enough to have pollen count and UV index, which are not always readily available from many forecasts.  For the purpose of our example, we’ll be using the “sunset” option, though it’s easy to imagine creating triggers to control lights when the sky becomes cloudy or turning on air filtration when the pollen count rises:

the sunset option

Some triggers require additional configuration.  Sunset is straightforward because it’s known for the location that you chose:

additional configuration

Here at step three, the first part of the rule is done.  We have set up a rule that will fire every day at sunset.  IFTTT helpfully fills in the “this” part of our rule in a way that makes it obvious what we’re doing:

first part of the rule is done

The second part of writing a rule is to lay out the action (the “that”) to take when the trigger fires.  Once again, we choose a channel to take the action, choosing from the large number of channels that are available:

lay out the action

We’re trying to control lights plugged into a Belkin WeMo, so we’ll scroll down to “W” and pick the WeMo.  It has the actions that you might expect from what is essentially a power switch: turn off the outlet, turn on the outlet, blink the outlet, or toggle the outlet.  In our case, we want to turn on the outlet to turn on the light:

turn the outlet to turn the light on

From the menu of options, choose “turn on.”  IFTTT supports having multiple WeMo switches, each of which can be named.  A drop-down allows you to choose the switch being controlled by the rule so that many different devices can be controlled.  For example, a coffeepot might be turned on when an alarm goes off, different lights might be controlled by different rules, and so forth:

drop-down allows you to choose the switch being controlled

The last step in creating a rule is to finalize the action.  IFTTT helpfully displays the rule in full in a nice simple form.  Is there any doubt what the rule we’ve just created will do:

finalize the action

In my personal setup, I use a rule that turns off the light at 10 p.m. as a reminder to go to bed.  There is not yet an easy way to say “turn off the light two hours after it turned on” because IFTTT doesn’t hold much state (yet).

One aspect of IFTTT that I recently appreciated was how easy it is to change the rule.  When going out of town, I decided to have the lights on all night so that pet sitters wouldn’t have to figure out all the ways in which lights could be turned on.  I simply deactivated the “turn off at 10 p.m.” rule that was like this:

deactivated the “turn off at 10 pm” rule

I then replaced it with a rule that turned off the lights at sunrise.  (The lights in question are a low-power strand of LED lights.)

replaced it with a rule that turned off the lights at sunrise

Could I have accomplished the same tasks in other home automation systems?  Absolutely, but it would have taken me much longer to get to my end goal, and I would have had to do significantly more testing to believe that my automation would behave as expected.  The combination of IFTTT and the WeMo makes setup much easier and more accessible.

tags: , , ,