May 10, 2020

DIY Garage Door Opener

I wanted to incorporate my garage doors into my Home Automation system. With a simple wall button that causes the garage door to open and close, surely I could build something that does this and is controllable by Home Assistant.

Well I can :D

So I have a Chamberlain 1000SDR manufactured in 2001. After some investigation, I found that there’s normally ~16 VDC between the two wires that go the the wall button. Pressing the wall button causes this to drop to zero, and when that happens, the garage door opens.

Hardware

I thought this would be a perfect use of a ESP8266. I still have a few NodMCU units on hand that would be perfect.

To achieve some electrical isolation, I figured it would be best to use a relay to trigger the garage door. I got a module with two relays because I have two garage doors to control.

I also ordered two generic reed switches so I could detect if each garage door was closed or not. In hindsight, it would have been better to use two reed switches per door. This would allow me to detect both “fully closed” and “fully open”. (With one reed switch, I can only detect “fully closed” or “not fully closed”. That might mean fully open, or stuck halfway.)

Everything is wired to the NodeMCU. I soldered directly to pins because I thought it would be secure than using jumper cables. The relays are connected to pins D1 and D2, and the reed switches are connected to D5 and D6. Power for the relay module comes directly from the Vin of the NodeMCU.

One good idea I had was to use quick-connect connectors on the wires going to the relays and reed switches. This lets me work on the opener unit without dealing with long wires to the other components.

Nothing secures the components inside the enclosure box. The unit is reasonably held together by the white wires tied together. I wouldn’t call it secure, but it’s secure enough to be handled. Between that and the fact there’s not much space in the enclosure box, everything stays together, there’s not much wiggle room or opportunity for something to be pulled apart.

Software

I’ve great experiences with ESPHome for ESP8266 devices. You tell ESPHome what you want the device to do, ESPHome will then compile a firmware that does all those things. ESPHome was designed to make ESP8266 devices interface with Home Assistant. It makes the software side really simple, you don’t have to dive into code, you don’t have to figure out how to compile and upload the firmware.

MQTT is the default way for to communicate. ESPHome reports the the status of the relays and reed witches. ESPHome also handles working with Home Assistant’s MQTT Auto-Discovery feature, so everything show up with no configuration necessary.

Full ESPHome configuration available here.

Garage Installation

I bought some generic “security wire” to connect the relays and reed switches. The “security wire” is a plain cable with two 22 AWG wires in it. I run one cable to each garage door motor unit and one wire to each reed sensor.

No snags on this step. Just measuring/cutting the wires and mounting the sensors, and connecting to the garage door motor unit.

I was fortunate that there was a spare outlet available, I didn’t have to worry about finding a 5 VDC source.

Home Assistant

Using the Lovelace picture-entity and custom:button-card cards, I created a nice looking control interface.

- type: vertical-stack
  cards:
    - type: picture-entity
      title: Garage Door Primary
      entity: binary_sensor.garage_door_primary_sensor
      state_image:
        "on": /local/garage_door_primary_open.jpg
        "off": /local/garage_door_primary_closed.jpg
    - type: custom:button-card
      entity: switch.garage_door_primary_switch
      show_state: false
      name: '[[[ if (states["binary_sensor.garage_door_primary_sensor"].state == "on" ) return "Close Garage"; else return "Open Garage" ]]]'
      icon: '[[[ if (states["binary_sensor.garage_door_primary_sensor"].state == "on" ) return "mdi:garage-variant"; else return "mdi:garage-open-variant" ]]]'
      state:
        - value: 'on'
          icon: mdi:garage-alert
          color: rgb(255, 0, 0)

Video

Coming soon…

Automation Ideas

  • If garage door is open for 10 minutes and nobody is home,
    • Close the garage
    • Send push notifications
  • If garage door is open for more than 30 minutes and somebody is home,
    • Send push notifications to everybody (or only people that are home)
    • (Alternate) Say a TTS message over the house intercom