S0 pulse counter help

Hi there,
i have a “heat Meter” that has a pulse output function. For every 1 kWh of heat, there is one pulse.
I want to integrate this in Home Assistant. After reading for quite a bit and watching some videos on this topic i think this is a S0 output and that i can read that with a Wemos D1 mini and feed that data into HA.
The manual of the heat meter show this:



Do i have to put the two wires on GND and D5 on the wemos or do i need to put a resistance anywhere in there?

I have never done anything with ESP Abut as i understand, that should be pretty straight forward with the ESPHome add-on.
Does anybody have a manual or something for the kind of thing i’d like to do here? Its hard for me to find because I don’t really know the right english words for all that stuff…

Thanks!