esphome:
name: switch
platform: ESP8266
board: esp01_1m
esp8266_restore_from_flash: yes
wifi:
ssid: “你的ssid”
password: “你的密码”
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "switch"
password: "00000000"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "2020"
ota:
password: "2020"
web_server:
port: 80
binary_sensor:
- platform: gpio
pin:
number: GPIO2
mode: INPUT_PULLUP
inverted: True
name: "Button"
on_press:
- switch.toggle: relay
switch:
- platform: gpio
name: "switch"
pin: GPIO0
id: relay
inverted: yes
|