This is a case for a D0 Counter.
I used a Wemos D1 Mini with a Phototransistor and a Resistor (1k) directly Soldered to the PCB of the Wemos D1 Mini. Use 1 or 2 8mm Magnets to Connect it.
I used this Thread to configure it:
https://forum.creationx.de/forum/index.php?thread/1095-d0-z%C3%A4hler-sml-auslesen-mit-tasmota/&pageNo=1