用esp8266-01s连接门禁开门控制线,用于远程开门。目前功能正常,但实际使用还是担心出问题,烦请各位大佬查看一下代码是否正确。另外这个esp8266-01s继电器通电瞬间会跳动,有没有什么办法可以改善呢?
小白一枚,感谢各位
esphome:
name: esp8266-1fdoor
friendly_name: esp8266-1fdoor
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "***cx2HT+N/aJTp5NZuCwc1TCGkh4="
ota:
password: "****68be26a"
wifi:
ssid: "****"
password: "****"
power_save_mode: none
manual_ip:
static_ip: 192.168.2.32
gateway: 192.168.2.1
subnet: 255.255.255.0
dns1: 192.168.2.1
dns2: 223.5.5.5
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp8266-1Fdoor Fallback Hotspot"
password: "****"
# Example configuration entry
web_server:
port: 80
auth:
username: "root"
password: "****"
captive_portal:
switch:
- platform: gpio
pin: 0
id: relay
name: "1楼门禁"
icon: "mdi:gate"
inverted: True
on_turn_on:
- delay: 100ms
- switch.turn_off: relay
binary_sensor:
- platform: gpio
pin: GPIO2
name: "press_switch_lib1"
device_class: opening
filters:
- delayed_on_off: 100ms
on_state:
then:
- switch.toggle: relay
|