参考下面这个esphome的代码,是2秒的浇水,我这个对应的是sonoff basic
esphome:
name: waterpump
platform: ESP8266
board: esp01_1m
wifi:
ssid: 'wifissid'
password: 'wifipassword'
# Enable logging
logger:
# Enable Home Assistant API
api:
password: 'apipassword'
web_server:
port: 80
switch:
- platform: gpio
name: "waterpump2s"
pin: GPIO12
id: relay
on_turn_on:
- delay: 2s
- switch.turn_off: relay
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "button"
on_press:
- switch.toggle: relay
status_led:
pin:
number: GPIO13
inverted: yes
|