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}
#esp32:
Enableboard: Homeesp32dev
Assistantframework:
APItype: api:
encryption:
key: "XXXX"esp-idf
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"xxx"
esp32:api:
board:encryption:
esp32devkey: framework:
type: esp-idf"xxxxxx"
ota:
- platform: esphome
password: "XXXX"
# Enable loggingxxxxx"
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:
# --- SWITCHESRelays (RELAYS)momentary button press) ---
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
# --- BINARYReed SENSORS (REED SWITCHES)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
device_class: garage_door
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
device_class: garage_door
icon: "mdi:garage"
device_class: garage_door
filters:
- delayed_on: 100ms
- delayed_off: 100ms
# --- HOMEGarage ASSISTANTDoor COVERSCovers ---
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
