I’m using an esp32 and trying to control a 2ch impulse relay, where only a short pulse as a control signal is required to change state of the relay, this means that the state of the output pin does not correspond to the state of the relay as the relay could also be toggled manually. I’ve been using 1 of the 2 chanels to provide feedback to my esp32 on a separate gpio input pin. Later I realized that if I put a series resistor in the feedback circuit it’s possible to both read state and output relay toggle with 1 gpio.
My approach has been tested using micropython and is to have the gpio as an input pull_down as default but when I want to change the relay state I reinitialize the gpio to an output, send a pulse and then reinitialize back to an input.
This is working well but I would rather use esphome instead of micrpython if possible.
I found that I could use allow_other_uses: true
to reuse same gpio several times in the config yaml but don’t get that to work and what I’ve seen in other examples it’s only used for multiple inputs not input/output. Guess it might be possible maybe using lambdas?
Would appreciate any ideas or hints.