What I Have:
- ESP-32s (Original AI Thinker)
- Sonoff Basic (Vanilla)
- Home Assistant on Rpi 3B+
What I wanted:
To control the sonoff basic via physical button on ESP-32s
Current state:
WORKING!
Sonoff app is integrated to HA so now I can control all devices linked to sonoff account from HA.
EspHome integrated and setup a binary sensor…
binary_sensor:
- platform: gpio
pin:
number: 27
mode: INPUT_PULLUP
inverted: True
name: 'Sonoff Test'
filters:
- delayed_on: 10ms
on_press:
- homeassistant.service:
service: homeassistant.toggle
data:
entity_id: switch.sonoff_100045b780
As is, this code takes the button press and translates to (kitchen light in this case) required format to tell HA entity what to do.
Yes, this is not a question but is something that I have been investigating for weeks!
This is just to give an idea to anybody else that wants to do something similar.