Making Your Garage Door Smart
By: Paul Newman
Tags: Smart Home, Alexa, Home Automation, IFTTT, Home Assistant

At WW, we try to automate our workflows as much as possible, so it’s not surprising that some of us try to automate our lives.

My first foray into home automation was making my garage door smart. This was born out of necessity: My wife and I have two cars and only one remote, and I wanted the garage door to open automatically when she returned from work after dark. My ultimate goal was to open and close the garage door using Siri, Alexa, and Apple CarPlay. Little did I realize what I was getting myself into.

In the end, my home automation journey took me down the following path:

Installing a smart garage door controller Installing Home Assistant on a Raspberry Pi Enabling Home Assistant Cloud Creating IFTTT webhooks Creating Home Assistant automations Creating Alexa routines Creating Home Assistant webhooks Creating a Home Assistant Template Cover

Does this seem like a lot of work when you can just buy a second remote? You betcha. But that’s not the point. This process reminded me of what I love about software development: the pure satisfaction of finding elegant solutions to complex problems. Puzzle-solving.

Since we’ll have to save steps 7 and 8 for part 2 of this story, let’s get started.

Installing a smart garage door controller

I chose a Tailwind controller because it doesn’t have a monthly fee, but there are lots of other good solutions out there. Most of them tap into the existing wiring of your garage door opener or its wall switch and use sensors to determine the current state of the door (open or closed). Before you buy, make sure that your garage door opener is supported and that the controller offers integrations with services that matter to you, such as Amazon Alexa, Siri, Google Home, or Apple HomeKit.

Since most garage controllers rely on cloud services, read the customer reviews to ensure the product doesn’t suffer from periodic outages.

Installing the controller shouldn’t take more than an hour or two. When you’re done, you should be able to open and close your garage door with the manufacturer’s mobile app. If you want to do more than that, read on.

Installing Home Assistant on a Raspberry Pi

With my new garage door controller, I was able to open and close the garage door with a Siri shortcut. I soon realized that if I also wanted to control the garage door with Alexa and Apple CarPlay, I would need a smart home hub. After researching many different options, I decided on the open-source Home Assistant platform, which typically runs on a Raspberry Pi computer (or a Docker container).

The name Raspberry Pi may sound intimidating — it did to me — but installing Home Assistant on a Pi is much easier than you think. It’s also less expensive than buying a smart home hub, like Hubitat or SmartThings. Best of all, using Home Assistant means you don’t have to commit to a single ecosystem: You can pick and choose what works for you.

For my setup, I purchased the Raspberry Pi 4 Model B with case, power supply, and heat sink for just over $50. To install the Home Assistant operating system, I bought a 64-gigabyte micro SD card (yes, the Home Assistant OS can boot from an SD card) and a portable card reader.

Following these detailed instructions, I used the Balena Etcher app to download the Raspberry Pi’s 64-bit disk image and flash it onto the micro SD card. After that, I simply inserted the SD card into the Pi, connected an Ethernet cable, attached the case, and plugged in the power supply. A few minutes later, Home Assistant was up and running at http://homeassistant.local:8123 .

If you don’t want to fuss with installing Home Assistant on a Raspberry Pi, you can purchase a Home Assistant Blue bundle, which comes with the software preinstalled. All you have to do is plug it in.

Enabling Home Assistant Cloud

I resisted signing up for Home Assistant Cloud (created by Nabu Casa) because I didn’t want to pay for another subscription service, but my WW colleague Ali Illyas reminded me that the monthly $5 fee also supports ongoing Home Assistant development.

What’s the benefit? As you might expect, Home Assistant Cloud provides you with remote access to Home Assistant, which is useful if you want to open the garage door outside of your Wi-Fi network. Home Assistant Cloud also enables two key features: simplified connection to voice assistants (Amazon Alexa and Google Assistant) and webhooks. Plus, Home Assistant Cloud exposes all your Home Assistant automations and scripts, something that will come into play later.

To enable Home Assistant Cloud, go to the Configuration panel in Home Assistant, create an account, and log in. From there, you can turn on remote control and sync entities to Alexa or Google Assistant.

Creating IFTTT webhooks

Since Tailwind has an IFTTT integration, I decided to use IFTTT webhooks to trigger my garage door to open and close via Alexa. (Tailwind has an Alexa skill, but you have to say, “Alexa, ask Tailwind to open garage door 1,” to trigger it.) You’ll find your webhook URL by logging into your IFTTT account and navigating to Webhooks, then Settings. It should look something like this:

Before we create the webhooks, add the IFTTT integration to Home Assistant. In Home Assistant, choose Configuration, then Integrations and click Add Integration. Search for “ifttt” and follow the instructions to install the integration.

Next, we need to save the IFTTT API key to our Home Assistant configuration.yaml file. To do this, complete the following steps:

Install the File Editor add-on. (Find it in Supervisor , then Add-on store .)

, then .) Select File Editor in the menu on the left.

in the menu on the left. Click Browse Filesystem (the folder icon).

(the folder icon). Select configuration.yaml from the list.

from the list. Create a new entry in the file with your API key:

ifttt:

key: [api_key]

Click the red Save button. Restart Home Assistant by choosing Configuration, then Server Controls, and then Restart. It’s good practice to click Check Configuration before you restart to ensure that you don’t have a syntax error in configuration.yaml .

The next step is to create the webhooks that will open and close the garage door.

The Open Garage Door webhook

To create an IFTTT webhook Applet, complete the following steps:

From your IFTTT account, click Create .

. Click Add and search for “webhooks.”

and search for “webhooks.” Click Webhooks , then click Receive a web request .

, then click . Enter an event name (e.g., open_garage_door ) and click Create Trigger .

) and click . Click Add , then search for your garage door controller (in my case, Tailwind).

, then search for your garage door controller (in my case, Tailwind). Choose the Open garage door action.

action. Select your garage door controller and click Create Action .

. Click Continue and enter a title (e.g., Open Garage Door Webhook ).

and enter a title (e.g., ). Click Finish.

Now that you’ve created the webhook Applet, it’s time to test it. The easiest way is to run a cURL command. Append the API key from earlier to the end of the following command:

Notice that the event name you created ( open_garage_door ) is also part of the URL.

Run this on a command line. If you enabled the “Get notifications when this Applet is active” option in IFTTT, you should receive a push notification on your phone. And with any luck, your garage door just opened.

The Close Garage Door webhook

Create a Close Garage Door webhook using the same steps as above, and name the event close_garage_door . Test it using this cURL command:

Did the garage door close? Congratulations!

Creating Home Assistant automations

Now that we have IFTTT webhooks to open and close the garage door, we need to call them from Home Assistant. We do this by creating automations — specifically, scripts that invoke the webhooks.

The Open Garage Door script

To create the Open Garage Door script, navigate to Configuration, then Scripts in Home Assistant and click Add Script.

Name the script Open Garage Door .

. Enter your desired icon. (I entered mdi:garage-open-variant from Material Design Icons.)

from Material Design Icons.) Under “Action type,” choose Call service .

. Under “Service,” choose ifttt.trigger .

. Under “Service data,” enter event: open_garage_door (or whatever you named your IFTTT event).

(or whatever you named your IFTTT event). Click Save Script.

The final Open Garage Door script should look something like this in the visual editor:

Open Garage Door script in Home Assistant visual editor

If you’re curious, you can select the three dots on the top right of the page (not shown above) and choose Edit as YAML to reveal the underlying markup language:

After saving the script, click Run Script to test it. The IFTTT webhook should be called, and your garage door should open.

The Close Garage Door script

Duplicate the script above to create the Close Garage Door script, replacing the service data with event: close_garage_door (or whatever you named your IFTTT event). Save the script and click Run Script to verify that it works.

Exposing the scripts to Alexa

To expose the Home Assistant scripts you just created, navigate to Configuration, then Home Assistant Cloud and scroll down to Alexa. Click Manage Entities. Confirm that your Close Garage Door and Open Garage Door scripts appear. (Home Assistant scripts are called “scenes” in Alexa.)

Garage door entities in Home Assistant Cloud

Now open the Amazon Alexa app on your phone or tablet and tap the Devices tab. Scroll through the list at the top and tap Scenes. You should see your two scripts (mine have been associated with a Garage group in this example):

Garage door scripts in Alexa app

If you don’t see your two scripts, click Sync Entities to Amazon in Home Assistant (go to Configuration, then Home Assistant Cloud) and try again.

Creating Alexa routines

Now that we have access to the garage door scripts from Alexa, let’s create a routine that’s triggered by the phrase, “Alexa, open the garage.”

In the Alexa app, select the More tab and tap Routines .

tab and tap . Click the plus (+) button to create a new routine.

Call the routine “Open the garage” and tap Next .

and tap . Click When this happens and choose Voice .

and choose . Enter the phrase “Alexa, open the garage” and tap Next .

. Tap Add action and choose Smart Home .

and choose . Tap Control Scene and choose Open Garage Door .

and choose . Tap Next, then Save.

The “Open the garage” routine in the Alexa app

To test this routine, tap the blue arrow. If that works, try triggering it with the phrase “Alexa, open the garage.” You may need to alter the phrase slightly if Alexa says, “Garage doesn’t support that.”

Repeat the steps above to create a Close the Garage routine, then test it by saying, “Alexa, close the garage.”

Summary

In part 1 of this article, we installed a smart garage door controller and used Home Assistant and IFTTT to control it with Amazon Alexa. In part 2, we’ll complete this home automation journey and use Home Assistant and IFTTT to integrate the smart garage door with Apple CarPlay, so you can open or close the garage by tapping your car’s dashboard touch screen.

— Paul Newman, senior director of engineering at WW

Interested in joining the WW team? Check out the Careers page to view technology job listings as well as open positions on other teams.