Created
March 10, 2022 22:38
-
-
Save aceat64/85bf858d44b2d340195a9aad9cb8e9c5 to your computer and use it in GitHub Desktop.
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
substitutions: | |
device_name: garage-door | |
friendly_name: Garage Door | |
esphome: | |
name: ${device_name} | |
platform: ESP32 | |
board: featheresp32 | |
wifi: | |
manual_ip: | |
static_ip: 192.168.xxx.xxx | |
gateway: 192.168.xxx.xxx | |
subnet: 255.255.255.0 | |
dns1: 192.168.xxx.xxx | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
# Enable fallback hotspot (captive portal) in case wifi connection fails | |
ap: | |
ssid: ${device_name} | |
password: !secret fallback_password | |
captive_portal: | |
# Enable logging | |
logger: | |
# Make sure logging is not using the serial port | |
baud_rate: 0 | |
# Enable Home Assistant API | |
api: | |
ota: | |
binary_sensor: | |
- platform: gpio | |
pin: | |
number: A0 | |
mode: INPUT_PULLUP | |
name: "Garage Door Contact Sensor" | |
id: contact_sensor | |
internal: true | |
switch: | |
- platform: gpio | |
pin: A1 | |
name: "Garage Door Relay" | |
id: relay | |
internal: true | |
cover: | |
- platform: template | |
device_class: garage | |
name: ${friendly_name} | |
lambda: |- | |
if (id(contact_sensor).state) { | |
return COVER_OPEN; | |
} else { | |
return COVER_CLOSED; | |
} | |
open_action: | |
- switch.turn_on: relay | |
- delay: 0.5s | |
- switch.turn_off: relay | |
close_action: | |
- switch.turn_on: relay | |
- delay: 0.5s | |
- switch.turn_off: relay |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment