By Dan Moren
February 7, 2017 6:04 AM PT
Automate This: Red alert, shields up!
Look, we’re all nerds here, right? Maybe some of you have never watched a single episode of Star Trek, but I sincerely doubt that’s the case for the majority of you folks. Nothing to be ashamed of!
When I first got my Amazon Echo last year, I thought I’d try my hand at a simple task using IFTTT: creating a Red Alert effect. It turned out to be pretty easy to create an Alexa keyword to turn my lights red but it was hardly close enough. For one thing, there was the whole having to say “trigger red alert” to get IFTTT to respond—booo. For another, it was just too darn quiet. What’s a red alert without a klaxon going off in your ears? Just makes you feel like you’re in a photographer’s darkroom.
Future experimentation took me down some cul-de-sacs: using the Yonomi app, I could instead say “turn on red alert” and get the lights to turn red and blink, but there was also quite a delay. I even briefly dallied with trying to create a simple skill for the Echo that would play the red alert sound, but it proved to be slightly too complicated for the time I was willing to invest—just a bit too much in the way of programming, and my skills in that department are sorely rusty.
But the other day, as I was mucking around with the Google Home for some articles I’m writing elsewhere, I discovered that the Home’s IFTTT integration is wayyyy superior to the Echo’s. Not only does it allow you to simply define a phrase—any phrase!—to trigger a command, but it also provides options for passing variables, including a string, a number, and both.
Naturally, this reignited my interest, and after an hour or so, I finally struck gold. Now witness the power of this fully armed and operational nerdery!
Wow. I know. It’s pretty nerdy. But I bet a few of you out there are wondering: how can I bring that nerdery home? Well, friends, I’m here to tell you how I accomplished it. All you need is a slightly ridiculous amount of home automation equipment. To wit:
- A Google Home (or an Amazon Echo or Echo Dot, though it will have some limitations)
- A Philips Hue White and Color Starter Set
- A Harmony Hub (you don’t even need the one with remote, though if you’re going to use it for actual home entertainment stuff, I would get one)
- A Sonos speaker (or speakers): I used two Play:1s, but the Play:3, Play:5, and even Playbar should all work fine.
You’ll also need to have an IFTTT account, and have configured the Home/Echo and Harmony hub to work with it.
Working together in Harmony
So, the major trick is getting the lights and sounds to work simultaneously. IFTTT is limited: a trigger can only fire off a single action. As a result you can’t use IFTTT to control the lights and the sound.1
My solution was instead to turn to the Harmony Hub, which can talk to both the Sonos speakers and Philips Hue lights. I set up a single activity called Red Alert, which did two things: using the Home Control features, turned on the three lamps in my living room, setting their color to red and their brightness to 100 percent; and, using the Entertainment Devices settings, turned on the Sonos Play:1 in my office.
Now, as part of the Sonos connectivity, you can set the speaker to automatically start playing something when it’s powered on. In this case, as part of one of my earlier experiments, I had already downloaded a red alert audio file, which I’d added to my iTunes Library, which my Sonos in turn can access via its Music Library function. I then designated the audio file as a Sonos favorite, and simply told the Sonos to start playing that Red Alert sound when the activity was triggered. And thanks to the way the Harmony-Sonos integration works, if the speaker in the activity has been added to a group in the Sonos app, all the speakers in that group will start playing the same audio.
With the Harmony activity set up, all that’s left to do is add the glue to bring it all together.
An applet a day…
Using IFTTT, I created an applet that used the Google Assistant channel and triggered on a specific phrase: red alert. In another huge mark for Google Home’s IFTTT integration, it allows you to define up to three variant phrases that trigger the same action. So you could also have “set condition red” or “go to red alert” if you felt like it. Additionally, the Google Assistant channel lets you define a response for the Home to speak aloud.
On the other end of that workflow was the Harmony channel, for which I used the Start Activity action and chose my “Red Alert” activity that I’d already created. That’s all it took. As soon as I created that recipe, I could say “Okay Google, red alert” and I was off to the races.
Of course, that klaxon can get annoying after a while, so I also decided to create a “cancel red alert” action that would turn off the lights and stop the sound.2 And I decided to get a little bit fancier (and, of course, nerdier), by adding in an authorization code.
Okay, it’s not a real authorization code. I created an IFTTT applet that takes both a string ($) and a number (#) and that would trigger on saying “cancel red alert authorization $ #”. It doesn’t actually matter what you say there, as long as it’s a word and a number. You could say “cancel red alert authorization grapefruit seven”3 and it would work just fine.
So, you can also do most of this with the Echo, since it too can accept arbitrary commands via IFTTT, albeit with the previously mentioned limitation that you have to prefix such commands with “trigger.” It also can’t accept variables like the Google Home or speak aloud when it receives a command. So, slightly less fun, but the basic features will function the same.
And there you have it. There are a couple other tweaks that could be made—somebody already asked me if I could stand down to yellow alert; I briefly had an applet that would handle that, but I turned it off because it ended up in a collision with the above apps. If you’re more of a Battlestar Galactica fan you could also easily adapt the same workflow to “set condition one throughout the ship.”
Okay, look, I’m sure I’ll find something useful to do with all this equipment at some point, but what’s the point if you can’t have a little fun as well?
There is probably something wacky you can to do chain actions together, but frankly, that’s just a bit too complicated. ↩
Technically it actually “powers off” the Sonos, since Harmony integration currently only lets you stop and end activities, not execute certain commands. ↩
Which, as we all know, is Worf’s authorization code. ↩
[If you appreciate articles like this one, help us continue doing Six Colors (and get some fun benefits) by becoming a Six Colors subscriber.]