esphome: name: garagedoorsensor friendly_name: GarageDoorSensor esp8266: board: d1_mini early_pin_init: false # Enable logging logger: # Enable Home Assistant API api: encryption: key: "YOUR_KEY_HERE" ota: password: "ANOTHER_PASSWORD_HERE" wifi: fast_connect: on ssid: !secret wifi_ssid password: !secret wifi_password use_address: YOUR_IP_HERE on_connect: - then: # Because of the circuit on the esp8266, switch.turn_on actually turns the LED OFF. # So look for the LED to turn OFF once it has successfully connected to wifi. - switch.turn_on: led # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "Garagedoorsensor" password: "YOUR_PASSWORD_HERE" captive_portal: binary_sensor: - platform: gpio pin: 12 name: "Right Garage Door" device_class: garage_door - platform: gpio pin: 14 name: "Left Garage Door" device_class: garage_door switch: - platform: gpio pin: 5 id: right_garage restore_mode: ALWAYS_OFF - platform: gpio pin: 4 id: left_garage restore_mode: ALWAYS_OFF - platform: gpio pin: 2 id: led button: - platform: template name: Left Garage Button on_press: - then: - logger.log: "Left garage door toggled" - switch.turn_on: left_garage - delay: 500ms - switch.turn_off: left_garage - platform: template name: Right Garage Button on_press: - then: - logger.log: "Right garage door toggled" - switch.turn_on: right_garage - delay: 500ms - switch.turn_off: right_garage