mydocker/esphome/light_driveway.yaml

80 lines
1.8 KiB
YAML

esphome:
name: sonoff-driveway
friendly_name: Driveway light
esp8266:
board: esp01_1m
wifi:
# --- KEY TO SUCCESS (ANCHOR) ---
# Tells Home Assistant: "Do not use mDNS/Discovery, the device is definitely at this IP".
# CRITICAL: Ensure you create a DHCP Reservation for this MAC address
# on your router (MikroTik/UniFi) for the VLAN 20 subnet before uploading!
# I assumed .8 to match your old .8, but adjust as needed.
use_address: 192.168.20.3
min_auth_mode: WPA2
networks:
# 1. Priority: New IoT Network (VLAN 20)
- ssid: !secret wifi_ssid_iot
password: !secret wifi_pw_iot
# --- MANUAL_IP REMOVED ---
# Relying on Router DHCP to assign the IP defined in 'use_address' above.
ap:
ssid: 'sonoff-driveway'
password: !secret fallback_ap_password
packages:
common_core: !include packages/common_core.yaml
web_server:
port: 80
status_led:
pin:
number: GPIO13
inverted: true
output:
- platform: gpio
id: relay_1
pin: GPIO12
light:
- platform: binary
id: light_driveway
name: 'Driveway Light' # Clean English name
output: relay_1
restore_mode: RESTORE_DEFAULT_OFF
binary_sensor:
# Internal physical button (usually GPIO0 on Sonoffs)
- platform: gpio
pin: GPIO00
id: reset
internal: true
filters:
- invert:
- delayed_off: 10ms
on_press:
- light.toggle:
id: light_driveway
# External Wall Switch Connection (GPIO4/GPIO14 usually)
- platform: gpio
name: 'Driveway Switch'
pin: GPIO04
id: switch_driveway_sensor
# Debouncing filters to prevent ghost switching (matches your office config)
filters:
- delayed_on: 50ms
- delayed_off: 50ms
# 'on_state' handles both flipping up and flipping down (toggle behavior)
on_state:
then:
- light.toggle:
id: light_driveway