Created
October 16, 2023 11:42
-
-
Save faelenor/80ca8c992a681809f70374e631dcf3a7 to your computer and use it in GitHub Desktop.
ESPHome garage door cover without relay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
esphome: | |
name: garage | |
esp8266: | |
board: nodemcuv2 | |
# Enable logging | |
logger: | |
# Enable Home Assistant API | |
api: | |
password: "" | |
ota: | |
password: "" | |
wifi: | |
ssid: "********" | |
password: "********" | |
# Enable fallback hotspot (captive portal) in case wifi connection fails | |
ap: | |
ssid: "Garage Fallback Hotspot" | |
password: "********" | |
captive_portal: | |
switch: | |
- platform: gpio | |
pin: | |
number: D1 | |
mode: OUTPUT_OPEN_DRAIN | |
inverted: true | |
name: "Garage Door Switch 1" | |
id: garage_switch_1 | |
internal: true | |
- platform: gpio | |
pin: | |
number: D2 | |
mode: OUTPUT_OPEN_DRAIN | |
inverted: true | |
name: "Garage Door Switch 2" | |
id: garage_switch_2 | |
internal: true | |
binary_sensor: | |
- platform: gpio | |
pin: | |
number: D5 | |
mode: | |
input: true | |
pullup: true | |
name: "Garage Door Sensor 1" | |
id: door_sensor_1 | |
internal: true | |
filters: | |
# Debounce the contact sensor to prevent rapid on/off/on events | |
- delayed_on_off: 200ms | |
- platform: gpio | |
pin: | |
number: D6 | |
mode: | |
input: true | |
pullup: true | |
name: "Garage Door Sensor 2" | |
id: door_sensor_2 | |
internal: true | |
filters: | |
# Debounce the contact sensor to prevent rapid on/off/on events | |
- delayed_on_off: 200ms | |
cover: | |
- platform: template | |
device_class: garage | |
name: "Garage Door 1" | |
id: garage_door_1 | |
lambda: |- | |
if (id(door_sensor_1).state) { | |
return COVER_OPEN; | |
} else { | |
return COVER_CLOSED; | |
} | |
open_action: | |
- switch.turn_on: garage_switch_1 | |
- delay: 0.2s | |
- switch.turn_off: garage_switch_1 | |
close_action: | |
- switch.turn_on: garage_switch_1 | |
- delay: 0.2s | |
- switch.turn_off: garage_switch_1 | |
- platform: template | |
device_class: garage | |
name: "Garage Door 2" | |
id: garage_door_2 | |
lambda: |- | |
if (id(door_sensor_2).state) { | |
return COVER_OPEN; | |
} else { | |
return COVER_CLOSED; | |
} | |
open_action: | |
- switch.turn_on: garage_switch_2 | |
- delay: 0.2s | |
- switch.turn_off: garage_switch_2 | |
close_action: | |
- switch.turn_on: garage_switch_2 | |
- delay: 0.2s | |
- switch.turn_off: garage_switch_2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is an ESPHome implementation of a 2-door garage cover that doesn't need a relay. You just have to connect the D1 and D2 pins to the buttons inside your garage door controller. I connected mine to the wall controller, but I suppose that you can use a remote. If you want to use another ESP board or other pins, make sure that you use pins that are not used by special functions or toggled at boot, otherwise your door might open when the device restart after a power outage. The sensors connected to the D5 and D6 pins are standard reed magnetic switches.