Esphome example delay

From Notebook
Jump to navigation Jump to search

This example toggles the LED when the physical button is pressed, then 2 seconds later toggles it back.
The virtual button on the Home Assistant card is not effected.

# Physical Button on D1 (GPIO5)  
binary_sensor:
  - platform: gpio
    pin: 
      number: D1
      inverted: False
      mode: INPUT_PULLUP
    name: "Wemos Test Button"
    on_press:
      then:
      - switch.toggle: led
      - delay: 2s
      - switch.toggle: led



(TOP)

Navigation[edit]

Return to the ESPHome page