esphome:
name: [your choice]
friendly_name: [your choice]
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret api_key
ota:
password: !secret ota_pw
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
domain: ".local"
manual_ip: # static IPs are a musthave - imo
static_ip: 192.168.1.51
gateway: 192.168.1.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: !secret ap_ssid
password: !secret ap_pw
captive_portal:
################################################################################
# #
# U S E F U L L I N F O R M A T I O N ? #
# #
################################################################################
# #
# First i tried this : #
# binary_sensor: #
# ... #
# - platform: gpio #
# ... #
# pin: #
# ... #
# inverted: true #
# ... #
# - light.turn_on: kontroll_led_reed_wz #
# ... #
# - light.turn_off: kontroll_led_reed_wz #
# ... #
# #
# BUT: #
# * on Dashboard (HA-Overview) : #
# - turns on led-icon, if switch-parts are far away from each other => OK! #
# - texted "reed_wz_pin - closed" => physically OK, but could force #
# individual brain-errors of confusion #
# (led on: means door is open, but switch called 'closed' => LOL) #
# #
# So i changed the code to below ;-) : #
# NOW: #
# led on -> door open, switch called 'open' #
# => no confusion by this anymore (?) #
# #
################################################################################
binary_sensor:
- platform: status
name: "Reed-WZ Status"
id: reed_wz_status
- platform: gpio
name: Reed-WZ-Pin
id: reed_wz_pin
pin:
number: GPIO14 # Switch: connect one wire to this, the other to GND
mode: INPUT_PULLUP
# inverted: true # doesn't work the way you want? -> set to false or comment
device_class: door
on_press: # reed-contact physically closed ? => YES
then:
- light.turn_on: kontroll_led_reed_wz
on_release: # reed-contact physically open ? => YES
then:
- light.turn_off: kontroll_led_reed_wz
output:
- id: led_output
platform: gpio
pin: GPIO12
# inverted: true
light:
- platform: binary
name: Kontroll-LED-Reed-WZ
id: kontroll_led_reed_wz
output: led_output
I hope, it helps somebody …
So long