Water Level Sensor (XKC-Y25-NPN) - sends wet-dry-wet-dry ten times per seconds

Hi there,

I have a problem with esphome and the water level sensor. The Model is XKC-Y25-NPN (see picture).
It measures correctly, since the led on the sensor lights up and the binary-sensor “wet” and “dry” is also shown correctly in the dashboard.

The problem is, that when its in the “wet”-area, it doesn’t send “wet” to the esp-board once, it sends “wet-dry-wet-dry-wet” around 10 times per seconds to the esp32. The LED on the esp32 is also indicating this constant change in signal.

Does someone know whats the problem here?

Many greetings, Chris

2022-05-25 21_21_59-Settings – Zuhause

3 Likes

Ok I found the solution by myself: I had to activate the pull-up to make it work. Here is the code which works, if others have the same problem:

  • platform: gpio
    pin:
    number: 14
    mode:
    input: true
    pullup: true
    device_class: moisture
    name: “espbalkon_liquiddetection_02”
1 Like

Hi there, thank you. Do you mind sharing more info on your setup? I want to try doing this using an esp8266 and two sensors, but pretty clueless on how to put it all together, help is appreciated.

I used this and work!!!

binary_sensor:

  • platform: gpio
    pin:
    number: D2
    mode: INPUT_PULLUP
    name: “Plants Water Tank Low Level”

Hi, can anyone tell me how to connect this Y25-NPN sensor to the ESP32-C3?