How to add a second garage door

Hi, first post and very new to ESPHome and HA. Been considering trying to get to grips with HA for a while, but the need has accelerated by the Blynk server/app shutting at the end of the year and having several devices controlled by it.

They’re all D1 Minis or NodeMCUs connected to relays and/or reed switches and I want to carry on using the same hardware. I’m starting with the garage, it has 2 doors (just toggled rather than separate open and close) and i want to replicate the functionality of being able to open and close on the phone and using the reed switches to display their open/closed state. Also to send me a notification if I forget to close one.

I’ve managed to get the first step done, I’ve got a card on the dashboard that will operate the door and show its status as open or closed (just simulated on a breadboard with an LED and grounding the sensor pin) but I can’t for the life of me work out how to add the second one. I’ve looked at a lot of partial examples I’ve found online but everyone seems to use different methods and every time I try and adapt the code to add a second one I end up with errors, I’ve found how fussy it is with the indentation too and have spent time moving stuff around as errors move about the code.
Anyway this is what I’ve got so far and I’d be grateful for any help getting past this hurdle.

esphome:
  name: esphome-web-0be404

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.5.200
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.5.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-0Be404"
    password: "SgowVPsCVOSa"

captive_portal:

output:
- platform: gpio
  id: "door1"
  pin: D8

light:
- platform: binary
  output: "door1"
  name: "Door 1"

binary_sensor:
  - platform: status
    name: "door1status"
  - platform: gpio
    pin:
      number: D4
    
      inverted: False
    name: "door"
    device_class: door

If the above code worked, this one should add the second door after you correct the Pin numbers (replace all instances of Pin 99).

esphome:
  name: esphome-web-0be404

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.5.200
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.5.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-0Be404"
    password: "SgowVPsCVOSa"

captive_portal:

output:
  - platform: gpio
    id: "door1"
    pin: D8
  - platform: gpio
    id: "door2"
    pin: D99 #Add the correct Pin here

light:
#Door #1
  - platform: binary
    output: "door1"
    name: "Door 1"
#Door #2
  - platform: binary
    output: "door2"
    name: "Door 2"

binary_sensor:
# Board Connection Status
  - platform: status
    name: "door1status" # You may want to make this more generic as its the status of the board, not door 1
#Door 1 Open/Closed Status
  - platform: gpio
    pin:
      number: D4
      inverted: False
    name: "door"
    device_class: door
#Door 2 Open/Closed Status
  - platform: gpio
    pin:
      number: D99 #Add the correct Pin here
      inverted: False
    name: "door"
    device_class: door
1 Like

Great, thank you, I hadn’t been declaring “platform” before each one.
I need to study the syntax a lot more.

Not wanting say anything is wrong (if it works, it works!). However you might be better to use the cover platform. That is how doors/windows/blinds are depicted in ha and esphome. See

ESPHome — ESPHome and particularly Endstop Cover — ESPHome

1 Like

Thank you, I’ll read those now. I must admit that I’ve been taking the “quick and dirty” approach to try and get everything working before the Blynk shutdown. I’ve no doubt I’ll want to go back afterwards and refine it, which at least is easy using OTA. But yes, it does work and displays ok on my dashboard.

The Endstop cover wouldn’t really work for me, my doors only need a 1 second pulse to toggle open or closed (for which I’m using a script) and the open/closed status is detected by reed switches, closed by a magnet on the door.