Skip to content

Instantly share code, notes, and snippets.

@toomone
Last active July 25, 2022 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toomone/819112ea1b04937912664996d7c29985 to your computer and use it in GitHub Desktop.
Save toomone/819112ea1b04937912664996d7c29985 to your computer and use it in GitHub Desktop.
ESPHome firmware for ESP8266
esphome:
name: electric-gate
platform: ESP8266
board: d1_mini
wifi:
ssid: "persossid"
password: "strongpassword"
manual_ip:
static_ip: 192.168.68.54
gateway: 192.168.68.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Electric Gate Fallback Hotspot"
password: "password"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
services:
- service: open_portal_pedestrian
then:
- switch.turn_on: relay
- delay: 500ms
- switch.turn_off: relay
ota:
# Text sensors with general information.
text_sensor:
# Expose ESPHome version as sensor.
- platform: version
name: Electric Gate ESPHome Version
# Expose WiFi information as sensors.
- platform: wifi_info
ip_address:
name: Relay IP
bssid:
name: Relay BSSID
# Sensors with general information.
sensor:
# Uptime sensor.
- platform: uptime
name: Relay Uptime
# WiFi Signal sensor.
- platform: wifi_signal
name: Relay WiFi Signal
update_interval: 60s
switch:
- platform: gpio
pin: D3
id: relay
restore_mode: ALWAYS_OFF
- platform: template
name: "Gate Pedestrian Remote"
icon: "mdi:walk"
turn_on_action:
- switch.turn_on: relay
- delay: 500ms
- switch.turn_off: relay
- platform: gpio
pin: D2
id: relay_car
restore_mode: ALWAYS_OFF
- platform: template
name: "Gate Car Remote"
icon: "mdi:car"
turn_on_action:
- switch.turn_on: relay_car
- delay: 500ms
- switch.turn_off: relay_car
binary_sensor:
- platform: gpio
pin:
number: D1
inverted: true
name: "Open sensor"
id: open_sensor
device_class: garage_door
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment