海风 发表于 2024-1-14 18:28:29

kittyme 发表于 2021-9-3 17:40
感谢各位大佬指点,我也抄作业成功了,这个方法很实用,贴上我的配置写法:
switch:
- platform: gpio


增加一个节能语句和滤波语句,顺便备份一下代码。

wifi:
networks:
    ssid: !secret wifi_ssid
    password: !secret wifi_password
power_save_mode: light#增加节能语句

switch:
- platform: gpio
    name: 'switch_1'      
    pin: GPIO0
    id: relay_1
    inverted: True

binary_sensor:    #翘板开关联动
- platform: gpio
    id: button_1
    pin:
      number: GPIO3   #接RX GPIO3脚和gnd线与翘板开关相连
      inverted: True
      mode: INPUT_PULLUP
    filters:
      - delayed_on_off: 100ms #这里一定要加这个这个起到滤波的作用。
    on_state:
      then:
      - switch.toggle:
            id: relay_1
页: 1 2 3 [4]
查看完整版本: 求助大神esp8266-01s怎么用esphome接普通翘板开关?