/esp-garage-opener

(DEPRECATED: Use ESPHome instead) Control your garage door over MQTT with Home Assistant.

Primary LanguageC++

DEPRECATED. I've now moved to using ESPHome for my garage door controller. See here for my ESPHome configs (specifically look at garage_door.yaml.

esp-garage-opener

Control and monitor your garage door over MQTT with Home Assistant with an ESP8266, a relay, and a magnetic reed switch.

Open with Siri Open with a button

Uses:

Electronics

The electronics are very simple. The relay is switched by a digital output from the microcontroller (the relay board linked above has a transistor to supply the necessary current to the relay). The reed switch is connected to ground and one of the digital inputs (because the ESP8266 has internal pullups, no extra resistor is necessary). Just connect to the normally disconnected side of your relay to the same two wires running to your existing garage door button.

Fritzing diagram

Compiling the code

First off you'll need to create a src/secrets.h. This file is .gitignore'd so you don't put your passwords on Github.

cp src/secrets.example.h src/secrets.h

Then edit your src/secrets.h file to reflect your wifi ssid/password and Home Assistant password.

The easiest way to build and upload the code is with the PlatformIO IDE.

The first time you program your board you'll want to do it over USB. After that, programming can be done over wifi. To program over USB, change the upload_port in the platformio.ini file to point to the USB-serial device for your board. Probably something like the following will work if you're on a Mac.

upload_port = /dev/tty.cu*

If you're not using the NodeMCU board, you'll also want to update the board line with your board. See here for other PlatformIO supported ESP8266 board. For example, for the Wemos D1 Mini:

board = d1_mini

After that, from the PlatformIO Atom IDE, you should be able to go to PlatformIO->Upload in the menu.

Configuring Home Assistant

Add the following to your Home Assistant configuration.yaml file

cover:
  - platform: mqtt
    name: Garage Door
    friendly_name: Garage
    state_topic: "garage/door"
    command_topic: "garage/button"
    payload_open: "OPEN"
    payload_close: "OPEN"
    payload_stop: "OPEN"
    state_open: "OPENED"
    state_closed: "CLOSED"
    optimistic: false
    retain: false
    value_template: '{{ value }}'

Thanks / Attribution