Need some help with hardware hookup for esphome

Try looking at this long thread Using ESPhome to build a water flow rate meter - #12 by DeeBeeKay