Hello Community - I’m trying to setup a reed switch to track water meter usage. I thought this was going to be a super simple project, but nothing ever is.
I’m a noob, but I’ve been reading for days on this topic. Here is what I have:
- 2-wire reed switch (I confirmed it works using a continuity tester and a magnet)
- ESP32 Mini Board
I have created the following ESPHome code:
# Reed switch between GPIO and GND
sensor:
- platform: pulse_counter
unit_of_measurement: 'Gallons'
name: 'Water Meter'
pin:
number: GPIO22
inverted: true
mode:
input: true
pullup: true
I have tried both GPIO21 and GPIO22. It is my understand that both of these should have pullup functionality. I have also confirmed that both of these GPIOs work when I connect them to a ESPHome LED Switch.
My wiring is Black Wire from Reed switch to GND/TXD on ESP32 board; Red wire from Reed switch to GPIO22.
When I pass a magnet over the reed switch nothing trips a count in HA or the ESPHome logs. Is there something I am missing in my setup?
Also, as a side question, can you help me understand why I have multiple designations for each pin on the mini board? For example my board shows IO25 and IO22 for the same pin. When I setup up a simple LED light switch, only GPIO22 seems to work to trigger the on/off switch.