How to create a Garage Door Opener in Home Assistant

In this blog post, I’m going to show you how a WiFi relay called Shelly 1 can control your Garage Door opener through home assistant.

New to Home Assistant?

If you are just getting started with home assistant I suggest you enroll in my Free Home Assistant Course !

What you will need

Shelly 1 device which you can get here from Amazon US or UK

Doorbell Wire

12v DC transformer

A contact sensor, I’m using a Aqara contact sensor that I already had.

A garage door opener with the ability to use a push button.

If you are not familiar with home assistant, it is a local open source home automation platform that can integrate locally and on the cloud your devices to create cool routines and automations. Checkout my YouTube channel Smart Home Makers for more information.

Project Steps

The shelly 1 can be powered in two ways either with 12volt DC with a power adapter or with 110-230 AC (24-60v DC). The jumper bridge needs to be toggled for the correct type of use, mine by default was set in AC mode, which is what my electrician installed it as.

shelly wiring diagram

Now take the two bell wire and connect the 0 and I to your garage opener. If you already had a button like in my case you can join them up with some a connector block, so that you physical button keeps working.

WiFI setup

The shelly 1 device connects to the internet via your WiFi access point. It uses the WiFi 802.11 b/g/n protocol. 

To connect the shelly 1 you will need to download the IOS or Android app on your smart device.

In the pairing mode the device create its own AP, follow the instructions on screen and you should be able to pair it to your own WiFi.

We have a couple of things to configure before we move on to home assistant

  1. Set the timer to Auto Off 0.5 seconds
  2. Settings –> Power on default mode OFF
  3. Disable cloud if you are using local connection only

Home Assistant

In home assistant, after release 0.115 the shelly devices can be configured thanks to the UI, find out more here

In my case they were auto discovered, which makes this a much better integration without having to deal with MQTT brokers.

The shelly device will be added in as a switch, we now need to convert it into a Garage Door Cover.

At this stage you can configure your contact sensor and integrate into home assistant if you haven’t already, here is a video review of my contact sensor.

You are going to need to substitute two things:

  1. binary_sensor.garage_door_sensor –> This is the contact sensor entity ID
  2. switch.shelly1_f4cfa2d3a896           –> This is your shelly device for the Garage Door

This is how it will look once the project is complete with its open and closed status. This is achieved by the icon_template logic, if the garage sensor is on then it is open hence we use the mdi (material graphic icon) with an open door.

garage closed

garage open

Add the following code to the configuration.yaml file:

  - platform: template
        device_class: garage
        friendly_name: "Garage Door"
        value_template: >-
          {% if is_state('binary_sensor.garage_door_sensor','on') %}
          {% else %}
          {% endif %}
          service: switch.turn_on
            entity_id: switch.shelly1_garage_door
          service: switch.turn_on
            entity_id: switch.shelly1_garage_door
          service: switch.turn_on
            entity_id: switch.shelly1_garage_door
        icon_template: >-
          {% if is_state('binary_sensor.garage_door_sensor','on') %}
          {% else %}
          {% endif %}

Now open or create if you haven’t got it the customise.yaml

  device_class: garage

In the future, I will be adding more automations to this post so feel free to subscribe if interested.
DISCLAIMER: This blog post contain affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This allows us to continue to make posts like this.


Gio loves rabbits, smart home tech, WWII, travelling to Thailand & my favourite pizza is margherita with parma ham!

Recent Posts