I have installed a Sonoff Basic behind a wall switch. I don’t need the relay portion as I only want to know when the switch is toggled, so there’s nothing connected to the output side of the Sonoff. I want to expose the position of the switch as on/off in HA frontend, but don’t know how to configure it in the code. Below is what I have currently. Any help is appreciated. Thanks!
binary_sensor:
- platform: gpio
pin:
number: GPIO14
mode: INPUT_PULLUP
inverted: True
id: relay
on_state:
then:
- switch.toggle: relay1
switch:
- platform: gpio
name: "Master Light"
pin: GPIO12
id: relay1