Tips

Alexa, Home Assistant, and how a single word broke my smart home

This is the story of how a single word caused my smart home to go berserk.

My mother, like all good mothers of kids who grew up in the 80s/90s, has some concern for the level of technology I have integrated into my family’s lives. She regards Alexa, in particular, with a mild contempt, sure that our ability to demand anything without concern for manners (“please”) will result in over-dependence on disembodied voices, a new pinnacle of laziness, and ultimately the downfall of society. Think Wall-E.

The inevitable outcome of Alexa, according to my mother.

The other thing my mother constantly harangues me about when she visits is the fact that I always have lights on. Whenever someone is home (and we’re not in bed), I have Home Assistant setup to always leave a few lights on in the kitchen and family room area — accent lights, not all the lights. Just some low under-cabinet lighting so you can see the kitchen countertops if you want to get a snack or something. But it bugs her, and partly to mess with me she always turns them off.

And so, it was in this context that, to my mother’s merciless delight, she caused my smart house to go completely haywire.

On a recent visit, annoyed by the low lighting I left on in the kitchen, she told Alexa to turn off all the lights. The exact phrase was, “Alexa, turn off all the lights.” I was sitting in the family room when she did this, so I got a front row seat to what happened next.

The first thing we noticed was that the desired lights didn’t immediately turn off. Instead, lights started turning on…the family room overhead lights, the lamp, the main kitchen lights, the dining lights. Some lights then turned off…like the kitchen under-cabinet lights she originally wanted off. But then they turned on again…and then some of the family room lights turned off. Then they turned on again. Then off. We looked around; I was puzzled, my mom was starting to laugh at how Alexa was so confused. The bookshelf accent lights turned off…the foyer chandelier came on…the bookshelf lights turned off again…

Then with a beep and a loud mechanical whirring sound, the Roomba started up.

Dramatization.

The house seemed possessed. Every light in sight was cycling on and off seemingly at random, the robot vacuum was whirring frantically around the kitchen table, and my mom was laughing hysterically as I stared at my Home Assistant app on my phone, trying to figure out what was going on. I saw in the app that the basement lights were also all on, then suddenly they turned off again. The outside lights were on. The basement TV turned on. It was total chaos. All we needed was creepy clown funhouse music to complete the picture.

Finally, as the lights stopped their dance and I paused the Roomba, I realized what happened: she said “all the lights.” Not “kitchen.” All.

See, in order to get more out of Alexa, I use Home Assistant as an intermediary to expose a bunch of things to it, for remote control purposes. Since these devices don’t talk to Alexa by themselves — like my Z-Wave light switches, for example — my Home Assistant server creates fake virtual devices for them, in the form of devices that Alexa can understand. Basically, Home Assistant makes Alexa think every device I expose to it is a Phillips Hue light, because Alexa knows how to talk to Phillips Hue lights.

This includes scripts — sets of actions in Home Assistant, that allow us to give one command to have a bunch of things happen. One of the scripts we use every day, for example, is called “night mode” — it contains a sequence of actions that power off a bunch of lights, notify me if the garage doors are open, set the house into a special night mode, etc. Because I have the script exposed to Alexa as if it’s a Phillips Hue light (a language Alexa understands) named “Night mode,” we can say “Alexa, turn on night mode” when we go to bed, and the script will be triggered when Alexa turns on what it thinks is just a Hue light. I have many other scripts, as well as scenes (which are similar but are limited to lighting, whereas my scripts do more than just lighting such as turning on the TV). For reasons not worth going into right now, I use a feature called “off maps to on” as part of this Home Assistant/Alexa integration for scripts and scenes, so if you tell Alexa to turn one of these things “off”, it still runs the script the same as if you said to turn it “on.”

What’s the net effect of all this? When my mom said “all lights,” Alexa took that to mean all the things it thinks are lights. And so, in addition to every actual light I have connected to it, it triggered scripts and scenes. Dozens of them. I have lots of scripts and lighting scenes, and it triggered them all.

Every. Single. One.

All at once, Home Assistant was processing commands to turn groups of lights on as part of a scene, to turn them off because of one script, turn them on because of another script, etc. In the kitchen and family room alone, I have over 10 scripts and scenes that in some way affect the lighting. Double that for the basement. And I have a script that starts my Roomba, which obviously also got triggered.

Now, Alexa is smart enough to scope commands. If you create Alexa Smart Home Groups with your Echo devices and select lights you want associated to that specific Echo device, you can say non-specific commands like “Alexa, turn on the lights” and she’ll know you mean just the lights in the room you’re currently in (which would be the lights you put in the same group as that Echo device). And I have done that. I can say, for example, “Alexa, turn off the lights” to the basement Echo and she’ll know just to turn off the lights in the basement. But because my mother added the simple word “all,” Alexa didn’t limit herself to just one area. She went full HAL and flipped all the “switches” (and scripts, and scenes) at once.

Just because of the word “all.”

I have had my home setup this way with Alexa for a long time now, and I’ve never encountered this before…because I’ve never given Alexa a command for “all” lights. Since I originally setup this Home Assistant/Alexa integration, I’ve learned there are now new device types (besides lights) that I can use when I expose scripts/scenes to Alexa, which clearly I need to investigate.

But that’s a topic for another post. For now…I hope you had a laugh at my expense.

 

Leave a Reply

Theme by Anders Norén