- binary_sensor:
- - platform: gpio
- pin: GPIO0
- name: "Push button"
- id: btn_push
- on_press:
- then:
- - switch.toggle: "sw_relay"
- switch:
- - platform: gpio
- pin: GPIO5
- name: "Relay"
- id: "sw_relay"
binary_sensor: - platform: gpio pin: GPIO0 name: "Push button" id: btn_push on_press: then: - switch.toggle: "sw_relay" switch: - platform: gpio pin: GPIO5 name: "Relay" id: "sw_relay"