Garage Door wired button stops working when esp connected

Hi so I am running into a strange issue when attempting to connect my garage door opener to an esp8266 with a relay module. With everything connected I am able to operate the door through Home Assistant, but the wired wall switch stops working. If I power down the esp8266 and relay the wired button works correctly again.

From the esp8266 to the relay I’ve connected:

GPIO4 to IN1
Vin to VOC
Gnd to GND

Then from the relay to the garage door opener terminals

1st channel middle terminal to garage door terminal
1st channel inner most terminal to garage door terminal

The wires for the garage door button are connected each to one of the garage door opener terminals.

The garage door is an older genie model and I can trigger operation by touching the a wire to both the garage door screw terminals.

Here is my esphome config

esphome:
  name: garage-opener
  platform: ESP8266
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: REMOVED

wifi:
  ssid: REMOVED
  password: REMOVED

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: REMOVED
    password: REMOVED

captive_portal:

# Enable Web server.
web_server:
  port: 80
# Sync time with Home Assistant.
time:
  - platform: homeassistant
    id: homeassistant_time

# Text sensors with general information.
text_sensor:
  # Expose ESPHome version as sensor.
  - platform: version
    name: garage_opener_switch ESPHome Version
  # Expose WiFi information as sensors.
  - platform: wifi_info
    ip_address:
      name: garage_opener_switch IP
    ssid:
      name: garage_opener_switch SSID
    bssid:
      name: garage_opener_switch BSSID

sensor:
  # Uptime sensor.
  - platform: uptime
    name: "garage_opener_sensor Uptime"

  # WiFi Signal sensor.
  - platform: wifi_signal
    name: garage_opener_switch WiFi Signal
    update_interval: 60s

# Exposed switches.
switch:
  - platform: restart
    name: "garage_opener_switch Restart"
  - platform: gpio
    id: relay
    pin:
      number: GPIO4
      inverted: False
    restore_mode: ALWAYS_OFF

  - platform: template
    name: "Garage Door Switch"
    icon: "mdi:garage"
    turn_on_action:
      - switch.turn_on: relay
      - delay: 1s
      - switch.turn_off: relay

I’ve looked around and seen a lot of examples and tutorials but if didn’t see anyone having this same issue with the wired button. I am think this might be more of a physical wiring issue then a software issue, I have tried reconnecting everything a few times, but wanted to be sure and include as much information as I could. Hopefully it all makes sense.

Any thoughts or advice would be appreciated. Or let me know if I left out any information or was unclear. Thanks!

1 Like

More detail required, maybe a photo of the existing setup?

1 Like

Sure, thanks.

Currently the relay is not connected to the garage door opener so the wall switch is working.

This is the terminals on the garage door opener, the top two are connected to the wired wall switch. Currently only the wired wall switch is connected.

This is the relay, the two wires at the top were landed along with the wires from the wired wall switch on the garage door opener screw terminals, currently not connected.

The wires at the bottom are connected to the esp8266 board.

This is the esp8266 board, with the other side of the wires connecting from the terminal.

From the esp8266 to the relay

GPIO4 to IN1 Yellow Wire
Vin to VOC Red Wire
Gnd to GND Orange Wire

Green and brown wires are for connecting to the garage door opener screw terminals, but currently are not connected.

I think i would be playing around with a multimeter, checking connections etc.

1 Like

Do you have the garage connected as NC (normally closed) on esp relay K1? Should be NO, two outside terminals not using the middle I’m sure.

I did and I noticed too that plugging in the esp8266 would cause the door to operate so obviously not right. Nothing was happening with the wires on the other terminal.

I looked around some and seeing some comments on the Amazon page looks like the relay pins need to be pulled LOW in order to turn them on and pull them HIGH to shut them off, which I was thinking was the other way around. Not sure if that would be a good idea with operating a garage door so might look into getting a different relay.

Thanks so much for all the help.

try changing inverted: False to True, my relays look identical and were inverted too

I had another issue of the supply current of the garage door opener only being able to power the ESP, as soon as the relay powered on the supply voltage dropped to nothing.

Thanks for the suggestion, I don’t think my esp board had enough power to work with it. Looking into getting a relay board that will work with 3.3 volts. Possibly this one.

the blue jumper at the bottom of your relay boards not for selecting voltage?

Some of the comments are saying that you can remove the jumper and then connect 5 volts and also mention soldering a bypass for the led, for me I think it might be simpler to just get another relay that will work with 3,3 volts.

Thanks, I am learning a lot here.

That jumper only selects if you want to use 5V for relays and optocoupler or you want a separate power for relay. If you remove it you must connect a separate 5V power to pins Vcc and GND, which is only usefull and sensable if your design requires isolated ESP and relay side, which is not needed in you case.

That relay on your amazon link is exaclty the same type, the onyl difference is that it’s a single model. And, no relay will directly work on 3.3V. (not that i know off… they work from 5V upwards)

I think that your relay energizes as soon you connect power, correct? You can hear it’s click if you listen carefully. That’s why garage door’s button no longer work, because “button” is always in a pressed state.

I have some of those relays and they are inverted, so you have two options:

  • first (better): just change config to “inverted: true” in your ESPHome switch and you’re done.
  • second (not good, since relay will always be energized in this case): connect garage door to C and NC (instead C and NO) contacts of relay.
1 Like

It took me a while do to some problems of my own making (esp8266 stopped working but I had another, the jumper was only on one pin on the relay), but Protoncek advice worked. Setting inverted: True and using the C and NO on the relay got everything going.

Thanks again to everyone for the help and patience with explaining all of this to me. I had been stuck on this for a while and just now had the time to come back and with all of your help get it going.

2 Likes

Great! Just one another advice: turn power off from garage doors AND ESPmodule. (with module connected to garage switch, of course!). Then re-apply power to both devices at the same time (simulate power outage) and check if garage door opens. Why? Some of GPIO’s tend to briefly send pulse at boot, thus causing a short trigger of relay and opening garage door. If this happens change GPIO pin of ESP. From my experience ports 0, 2, 10 and 15 all does such short pulse at bootup, making them unusable for this purpose. Pins GPIO4 and 5, then 12,13,and 14 are ok (again, from my experience).

You definitely don’t want to come home and find open garage doors…

3 Likes

hey!! I have the same issue and I can´t resolve the “pulse on boot” problem.
Also 4 channel relay, esp2866.
the code:


esp8266:
  board: nodemcuv2

switch:

  - platform: gpio
    pin: 
      number: GPIO14   # D5
      mode:
        output: true
    id: relay_0
    inverted: true
    restore_mode: ALWAYS_OFF

  - platform: gpio
    pin: 
      number: GPIO5   # D1
      mode:
        output: true
    id: relay_1
    inverted: true
    interlock: [relay_2]
    restore_mode: ALWAYS_OFF
    on_turn_on:
        then:
          - switch.turn_on: relay_0
    on_turn_off:
        then:
          - switch.turn_off: relay_0
    
  

  - platform: gpio
    pin: 
      number: GPIO4   # D2
      mode:
        output: true
    id: relay_2
    inverted: true
    interlock: [relay_1]
    restore_mode: ALWAYS_OFF
    on_turn_on:
        then:
          - switch.turn_on: relay_0
    on_turn_off:
        then:
          - switch.turn_off: relay_0

  - platform: gpio
    pin: GPIO0    # D3 
    id: led_1
    restore_mode: ALWAYS_OFF

  - platform: gpio
    pin: GPIO2    # D4
    id: led_2
    restore_mode: ALWAYS_OFF

  - platform: template
    name: "HA_button_1"
    id: ha_button_1
    optimistic: true
    on_turn_on:
      then:
        - switch.turn_off: ha_button_2
        - delay: 100 ms
        - switch.turn_on: relay_1
        - switch.turn_on: led_1
        - delay: 1 h
        - switch.turn_off: ha_button_1

    on_turn_off:
      then:
        - switch.turn_off: relay_1
        - switch.turn_off: led_1
    

  - platform: template
    name: "HA_button_2"
    id: ha_button_2
    optimistic: true
    on_turn_on:
      then:
        - switch.turn_off: ha_button_1
        - delay: 100 ms
        - switch.turn_on: relay_2
        - switch.turn_on: led_1
        - switch.turn_on: led_2
        - delay: 1 h
        - switch.turn_off: ha_button_2
    on_turn_off:
      then:
        - switch.turn_off: relay_2
        - switch.turn_off: led_1
        - switch.turn_off: led_2


binary_sensor:
  - platform: gpio
    
    id: button_1
    pin:
      number: GPIO12   # D6
      mode:
          input: true
          pullup: true
          
    on_press:
      then:
        if:
          condition:
            and:
              - switch.is_off: ha_button_1
              - switch.is_off: ha_button_2
          then:
            switch.turn_on: ha_button_1
          else:
            if:
              condition:
                switch.is_on: ha_button_1
              then:
                - switch.turn_off: ha_button_1
                - switch.turn_on: ha_button_2
              else:
                switch.turn_off: ha_button_2

There are two leds indicating the state and a push button…

I’m using this project but have the same issue, was previously using GarageQTPi until the pi died on me.
I had this exact issue but resolved it on GarageQTPi but not sure how can do here?
I’d prefer to use MQTT so i didnt have to reinvent any automations/sensors…etc and this was the easiest way I could port my stuff from the original PI to the nodemcu…any ideas how to add this inversion?

You mean you’d want to invert relay output? Sorry, can’t help with this language…Arduino is not my strong side.

1 Like