Water Level Sensor does not work with ESPHome?

In theory it should, but I tried all possible ways … but the water level sensor just doesn’t work reliable. ESPHome is using Arduino under the hood (so the software should be good).

I believe I connected the it correctly:
VCC -> 3.3V
GND -> GND
D1 -> D0 (ESP8266) - with 4.7k resistor connected to the VCC
D2 -> D1 (ESP8266) - with 4.7k resistor connected to the VCC
Using the following code:

Please let me know if I wired it correctly … If not, I will try again otherwise the water sensors can go in the garbage bin :frowning: It is a pity, the Grove sensor had huge potential.