Dual Garage Door Opener
Using ESPHome
This is code for dual garage door opener and will show red when door is opened
Dashboard
This is built using a
ESP32
and some magnet switches
REED
The REED is only one per door
substitutions:
name: sfl-garage-001
friendly_name: SFL-GARAGE-001
esphome:
name: ${name}
name_add_mac_suffix: false
friendly_name: ${friendly_name}
# Enable Home Assistant API
api:
encryption:
key: "XXXX"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Sfl-Garage-001 Fallback Hotspot"
password: "XXX"
esp32:
board: esp32dev
framework:
type: esp-idf
ota:
- platform: esphome
password: "XXXX"
# Enable logging
logger:
level: ERROR
# Enable Web Server (optional, for testing)
web_server:
port: 80
# Enable Bluetooth Proxy
bluetooth_proxy:
active: true # Enables active connections to devices like locks and SwitchBots
captive_portal:
# --- SWITCHES (RELAYS) ---
switch:
- platform: gpio
pin: GPIO25
inverted: true
name: "Door 1 Button"
id: garage_button_1
on_turn_on:
- delay: 500ms
- switch.turn_off: garage_button_1
- platform: gpio
pin: GPIO32
inverted: true
name: "Door 2 Button"
id: garage_button_2
on_turn_on:
- delay: 500ms
- switch.turn_off: garage_button_2
# --- BINARY SENSORS (REED SWITCHES) ---
binary_sensor:
- platform: gpio
pin:
number: GPIO05
mode: INPUT_PULLUP
inverted: false # or false, depending on your wiring
name: "Door 1 Sensor"
id: garage_sensor_1
icon: "mdi:garage"
device_class: garage_door
filters:
- delayed_on: 100ms
- delayed_off: 100ms
- platform: gpio
pin:
number: GPIO04
mode: INPUT_PULLUP
inverted: false # or false, depending on your wiring
name: "Door 2 Sensor"
id: garage_sensor_2
icon: "mdi:garage"
device_class: garage_door
filters:
- delayed_on: 100ms
- delayed_off: 100ms
# --- HOME ASSISTANT COVERS ---
cover:
- platform: template
name: "Door 1"
device_class: garage
optimistic: false # Let the sensor drive the state (more reliable)
lambda: |-
if (id(garage_sensor_1).state) {
return COVER_CLOSED;
} else {
return COVER_OPEN;
}
open_action:
- switch.turn_on: garage_button_1
close_action:
- switch.turn_on: garage_button_1
stop_action:
- switch.turn_on: garage_button_1
- platform: template
name: "Door 2"
device_class: garage
optimistic: false # Let the sensor drive the state (more reliable)
lambda: |-
if (id(garage_sensor_2).state) {
return COVER_CLOSED;
} else {
return COVER_OPEN;
}
open_action:
- switch.turn_on: garage_button_2
close_action:
- switch.turn_on: garage_button_2
stop_action:
- switch.turn_on: garage_button_2