We currently building our new home and I wanted to install recessed reed switches throughout connected to some form of ESPHome microcontroller. My initial concerns was around voltage drop over distance and whether I would be able to get reliable state changes from every switch. I have come up with the below design using an octocoupler I would love to hear from those who may have already attempted this or anyone can advise whether this setup will work or not.
Your picture conveys little useful information, like what optocoupler? What distances? A schematic would tell much more.
Generally, data does not suffer from moderately long distances. Look at Ethernet- high speed data over hundreds of feet is normal. The GPIO pins would consider any voltage above approximately 2.31V as a logic high and the pin input impedance is in the megohms. So the current at the GPIO pin would be nanoamps. A few ohms of wire resistance is nearly nothing. If you have switches on a GPIO pin with a pullup resistor*, I would expect no problem over the distances in a normal home. Just avoid running the wires parallel to power (Romex).
I don’t see how an optocoupler would help with inputs. Outputs, yes, but not inputs.
ALso, I would use multiple ESP devices around the house, each monitoring a few of the nearby switches rather than run long wires to one central processor. But that’s a personal preference.
The internal pullup on ESP processors is pretty weak which would make a long wire susceptible to outside interference, so use a strong pullup resistor. 4K7 to 10K should work.