Turning a standard garage door into a smart one rarely requires replacing the opener — most units already have dry-contact inputs for the wall button. This recipe wires a small ESP board to two relay channels (one to trigger “open”, one to trigger “close”) and a magnetic reed switch to detect whether the door is actually up or down. The result is a native Home Assistant Cover entity with open, close, and stop actions that reflects real door state.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/esphome/esphome.io/llms.txt
Use this file to discover all available pages before exploring further.
Hardware needed
| Component | Notes |
|---|---|
| ESP8266 or ESP32 board | D1 Mini, NodeMCU, or similar |
| Dual-channel relay module | 5 V coil, normally-open contacts |
| Magnetic reed switch | Any NO or NC reed switch rated for 3.3 V GPIO |
| Jumper wires | For relay signal lines and reed switch |
| 12 V → 5 V buck converter (optional) | Power from the opener’s 12 V supply |
Wiring overview
Many garage-door openers use a single button terminal that toggles state
rather than separate open/close terminals. If your opener works that way,
use the single-relay variant shown in the alternative YAML below.
Complete YAML configuration
Two-relay (separate open and close) variant
This is the most common pattern for commercial openers with discrete open/close inputs.Single-relay (toggle button) variant
If your opener has only one wall-button terminal that toggles the door each time it is momentarily closed, simplify to a single switch:The toggle variant uses
assumed_state: true because there is no position
sensor. Home Assistant will show the door as “open” or “closed” based purely
on which command was last sent — not on what the door is physically doing.
Adding a reed switch (as in the two-relay variant) removes this limitation.Configuration walk-through
Binary sensor — reed switch
The reed switch reports physical door state.
pullup: true uses the ESP’s
internal pull-up resistor so no external resistor is needed. inverted: true
flips the logic if your switch is normally-open (reads LOW when the magnet
is present). The 50 ms delayed_on / delayed_off filters eliminate
contact bounce so Home Assistant does not see rapid open/close flickers.Relay switches
Each relay is a plain
gpio switch. restore_mode: ALWAYS_OFF ensures
relays start de-energised after a reboot — important for safety. The
switches are exposed to HA but are primarily controlled by the cover
actions rather than directly.Template cover lambda
The
lambda block maps reed switch state to COVER_OPEN /
COVER_CLOSED so Home Assistant always reflects the real physical
position. If the door is mid-travel (neither fully open nor closed), the
lambda returns no value and HA shows the door as “opening” or “closing”
based on the last command.Open and close actions
Each action first cancels the opposite relay (belt-and-suspenders safety),
then pulses its own relay for 150 ms. This mimics pressing a wall button.
Adjust the delay if your opener requires a longer or shorter pulse.