Following up on a question about switch
vs light
in a Sonoff running ESPHome, I ended up with the following configuration:
esphome:
name: ${name}
platform: ESP8266
board: esp8285
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: ${name}
on_press:
- switch.toggle: relay
switch:
- platform: gpio
name: ${name}
pin: GPIO12
id: relay
status_led:
pin:
number: GPIO13
inverted: yes
sensor:
- platform: wifi_signal
name: ${name}
update_interval: 60s
output:
- platform: gpio
pin: GPIO12
id: switch_status
light:
- platform: binary
name: ${name}
output: switch_status
This is visible in HA as:
The last switch is the light
one, the one before is the switch
.
I am now trying to understand how from the ESPHome configuration I get the elements in the screenshot.
binary_sensor
is the physical button on the Sonoff.
switch
is the actual electrical relay
output
is an internal status of GPIO13
← I am not sure of this one
light
is a component which is driven (and which drives) the output.
If the above is correct:
- is
switch
only needed bybinary_sensor
to act upon a physical press? - since I can toggle via the light component, does
output
actually change the state of the GPIO? (I think so) → I am asking becauseoutput
would suggest that this is just an indication of a state