Esp8266 and magnetic door sensors

I have a few esp8266 boards laying around and would like to connect one to some pre-existing wired alarm sensors, 2 windows and 1 door in order to get their open/closed status.
All existing sensors have two wires and just wondering, how do I go about connecting them to the esp8266 board and adding them to esphome/HA?

Am I interpreting this correctly, that the gnd cables can be joined together and connected to the GND pin and then I can connect the other cables to pins D0, D1, D2 as explained here

Yes. Two things:

  1. Make sure you enable the input pull-up resistors in your binary sensor configurations. As shown in guide you linked to.
  2. If the cables are particularly long and subject to noise you may have to add some filtering. I’ve got essentially the same thing but connected to two raspi3bs all over my house. I used standard 2 pair alarm/telephone cable and it is 100% reliable. So it’s unlikely unless you live next door to an AM broadcast station or your cabling is too close to the mains.

Good to know and yes each cable would be under 4m long so not too long