Disclaimer: There are security implications in connecting your garage door to your home network or internet. The below will not grant access to control the door outside of your home network for obvious reasons. If you wish to do this, I would suggest setting up a HomeKit hub or using a VPN.

Contents

  1. Introduction
  2. Required Equipment
  3. Installing Home Assistant on a Raspberry Pi
  4. Wiring up your Garage Door
  5. Configuring Home Assistant to Work

Introduction

There are many pages describing home automation - and making scenes such as dimming lights, turning on the TV, and so forth. From my point of view, this is largely pointless. For me, there are two things I'd like to do: be able to open my garage door from my phone (so I don't need to carry a remote), and program our heating to start (iZone by default has atrociously poor automation without conditionals). This will cover the former, as the latter is actually quite trivial to do from the UI!

Unfortunately, the original manufacturer-made garage door WiFi controllers are generally hot garbage with proprietary apps and cost hundreds of dollars. My garage door shouldn't need an internet connection to work, and shouldn't connect out to some random cloud service written by interns at a garage door company by default. If I want my physical security connected to the cloud, I'll pick something developed by a team that I'm more likely to trust – e.g. by installing a HomeKit Hub later.

Please note, if you already have Z-Wave or ZigBee in your house, there are much easier options than the below. You can also buy off-the-shelf products if you're running HomeKit currently. The major advantage of using Home Assistant on something like a Raspberry Pi is two-fold: you don't need to run a Z-wave or ZigBee network as you can use the GPIO pins on the Raspberry Pi directly, and that you can connect all sorts of things that don't support the standard home automation protocols – and in my case, I already had much of the required parts.

Required Equipment

Please note, these are not affiliate links – buy from where ever you want, I don’t care! Jaycar just happens to be near where I live in Australia.

All up, this should be around the $175AUD mark, of which $150AUD is the Raspberry Pi 3B+ kit. Seeing as I already had the Raspberry Pi sitting on a shelf, this was cheaper than buying a new remote.

Installing Home Assistant on a Raspberry Pi

Simply follow the instructions here: https://www.home-assistant.io/installation/raspberrypi. I used the 64-bit Raspberry Pi 3 image. Pick the appropriate one.

The only issue I had is that I don’t have ethernet to my garage ceiling, or really anywhere else and couldn’t be bothered writing config YAML to set up WiFi. I hooked the Raspberry Pi up to a TV and keyboard, and did these steps:

  1. Login as root, no password.
  2. Run:
    ha net update wlan0 –ipv4-method auto –ipv6-method disabled –wifi-auth wpa-psk –wifi-psk [WIFIPASSWORD] –wifi-ssid [WIFINETWORKNAME]
  3. Reboot and confirm that you can access http://homeassistant.local:8123/
  4. Unplug and get ready to hook stuff up.

Wiring up your Garage Door

I basically followed the diagram from here, which I reproduce below:

Note that in my case, I am only controlling one garage door. I used the following pin connections:

  • Pin 4 - 5V - Relay +
  • Pin 6 - GND - Relay -
  • Pin 16 - GPIO 23 - Relay Signal
  • Pin 14 - GND - Reed Switch Common
  • Pin 18 - GPIO 24 - Reed Switch NO (Normally Open)
  • --
  • Relay Common (Centre Pin) - Garage Door Common
  • Relay NO (Normally Open) - Garage Door Neg

Note 1: The relay was mounted so that it would ONLY be in contact when the door is fully closed. Note the pin connections that you use for later.

Note 2: The Garage Door Common / Neg terminals are the connectors that can be wired to a wall switch. You can confirm that you've got the correct terminals by shorting them with a paper clip for ~1sec. If the door starts opening or closing, they're the right terminals.

Note 3: I very lazily hot-glued the relay into the box, and ran the wiring through it. To connect to the reed switch, I cut one end off some female-female jumper leads and then soldered this end to the longer wire to get the right length to run to the reed switch. I then gaffer-taped the relay box onto the Raspberry Pi Box, and then taped this whole thing onto the top of our garage door opener. If you care, you could mount nice sockets into the relay box and do a pretty job.

Configuring Home Assistant

I followed the following steps:

  1. Plug it in and turn it on.
  2. Complete the initial setup process after browing to http://homeassistant.local:8123/
  3. Install File Editor from Supervisor -> Add-on Store, and add it to the sidebar.
  4. Open the file editor, select the browse button (image of folder), then open configuration.yml
  5. Add the following stanza to configuration.yml:
    cover:
      - platform: rpi_gpio
        invert_relay: true
        invert_state: true
        relay_time: 1
        covers:
          - relay_pin: 23
            state_pin: 24
            name: “Garage door”
    
  6. Save and Reboot Home Assistant from Configuration -> Server Controls
  7. Test your New Garage Door Control from the Overview Dashboard. If all went well, you should now have web-based control of your garage door!

Please note that you don't necessarily need to restart - you can enabled advanced mode in your profile and reload the configuration YAML files instead. Assuming that you've now got this working, you can hook this up to Siri / HomeKit.

Hooking Home Assistant up to Siri

This part is pretty simple - HomeKit bridges really nicely.

  1. Inside HomeKit, browse to Configuration -> Integrations.
  2. Add a new integration: “HomeKit”. Do NOT install “HomeKit Controller” – this works the opposite way!
  3. Open up the Home App on your phone / tablet, and add a device using the QRCode.
  4. Test it! Hey Siri, open the garage door.
  5. Using the Home App, invite your family members to your house, and they can all control the garage door when on your home network.

And that should be it! No python code required, and now you can connect other home devices to your Home Assistant hub.