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

4 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”
2 Likes

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”
1 Like

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

@cwein

i am also working a Water Level Sensor Tank…

Could you share your code?

i was able to get 2 sensor (PNP) on the esp8266 but would love to add one more

web_server:
port: 80

binary_sensor:

  • platform: gpio
    pin:
    number: GPIO16
    mode:
    input: true
    pulldown: true
    device_class: moisture
    name: “Liquid Sensor GPIO16”

  • platform: gpio
    pin:
    number: GPIO15
    mode: INPUT_PULLUP
    device_class: moisture
    name: “Liquid Sensor GPIO15”

Just read the documentation and learn it yourself. You gain nothing from copying everyone else’s code.

By chance, does anyone know how to disable the LED on this thing - short of ripping it out?