Esphome example switch

From Notebook
Revision as of 22:10, 27 August 2023 by WikiSteve (talk | contribs) (Created page with "This example shows a toggle switch. It is either on or it's off. That is the LED follows the switch state. <nowiki># A physical switch or button should be a binary sensor if you are detecting something like grounding the pin. # 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.turn_on: led on_release:...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This example shows a toggle switch. It is either on or it's off. That is the LED follows the switch state.

# A physical switch or button should be a binary sensor if you are detecting something like grounding the pin.    
# 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.turn_on: led
    on_release:
      then:
      - switch.turn_off: led



(TOP)