I am thinking of using the ESP-01S relay (ESP-01S-1-channel-relay | ESPHome-Devices) as my sewers overflow sensor + alarm silencer. I have one 220v circuit that I need to switch to turn the alarm sound on/off, but I’d also like to receive notifications in Home Assistant about an imminent poopstorm. Is it possible to use the esphome configuration linked above but specify an additional pin to use as an input / binary sensor?
Esp01 has only two output pins: gpio0 and gpio2. Additionally you can use RxD and TxD pins (gpio1 and 3) by disabling uart in yaml. Just check out for possible mandatory pull-ups on those pins and make sure you’ll have correctly wired so you don’t get boot problems.
Theoretically, other pins CAN be accessible, but it requires microscope and precise soldering directly on esp pins… (i’ve done it).
gpio0 and 2 have to be in certain states for the ESP to boot up
See the table a little ways down in this link:
Makes it hard to use a ESP-01 for discrete inputs.
Gotcha, thanks! This confirms my suspicions. I have s few Nodemcus lying around. Will try to use one of them instead.
It’s no problem using these pins as inputs if you add pull-up resistors (and connect button to gnd when active) and make sure that they are not pressed/active at bootup. Sonoff devices have all on/off buttons connected to gpio0. (Gpio0 through gpio4 all requires to be high at boot).
So the only troublesome corner case would be when my alarm is triggering (i.e. gpio0/2 is high) when my ESP-01 boots up?
Yep, just that. But, i guess that this to happen is pretty small chance, right? I mean…when you update/reset… you module you generally know what you’re doing (and when), so only “risky” time is possible power blackout. But, as said, chances are pretty slim.
Yup. Plus, I have an audible alarm as a fallback anyway. Thanks, everybody for the thoughts! I’ll try the ESP-01 route as the small form factor and an integrated relay is a big bonus.