Hi,
I wrote my first lines of ESPHome code today for a possible future large project. Physical momentary pushbuttons configured as binary sensors is supposed to toggle GPIO Switches (for lamps). The GPIO switches shall also be able to be controlled by switches in Home Assistant Lovelace interface.
This code is working for me. Is it ok written or do you have other suggestions?
switch:
- platform: gpio
pin: 25
name: "Testswitch1"
id: Testswitch1
binary_sensor:
- platform: gpio
name: "Button 1"
pin:
number: 32
mode: INPUT_PULLUP
inverted: False
on_press:
- switch.toggle: Testswitch1
internal: True