Build a water meter with ESPHome and proximity sensor (no soldering required)

These days it’s all about insights. The last part missing for me was water usage. Although water in the Netherlands is not really expensive I wanted to get more insights on how much water are we using and is there anyway to save some water. Unfortunately water delivery doesn’t come with a smart meter. There’s just a analog counter. So how do you measure the water usage and make this analog meter smart?

During research I’ve found multiple different solutions for water meters. Most solutions where for Arduino and using proximity sensors that need resistors soldering and some even required external power supply.

ESPHome has been great for me, I’m just loving it. It’s powerful, easy and stable! For this solution I used a proximity sensor, a ESP8266 and ESPHome. Most important is the LJ18A3-8Z/BX proximity sensor, this sensor can run directly from the ESP board and has the resistor already included in the sensor, so no soldering needs.

The full guide can be found here:
Build a cheap water usage sensor using ESPhome and a proximity sensor -

The final result.

Let me know if this worked for you and if you have any questions.


Really interested in looking at this project, but the link you have posted is to your admin area unfortunately.


Thanks Craig, my bad. Copied the link from the wrong browser, the link should work now. Goodluck building out the water meter, let me know if you run into any issues.



    lambda: return (id(water_pulse).state * 10);

this one shows error, maybe wrong id?

Sorry for the delayed responds, I have been traveling for work.

You’re absolutly correct. I forgot to add a piece of the yaml. You need to add following sensor:

  - platform: pulse_counter
    pin: GPIO12
    update_interval : 6s
    name: "water pulse"
    id: water_pulse

I’ve also updated the article. Let me know if it works now.

Seems my water meter is non magnetic so I receive no data, but this code is ok

EDIT: Seems code is not ok… I get pulses every 1 litr (LED blinks) but I have no data on logs.
@pbrink could you check? Or post your full code?

Great work there @pbrink
I have Hall Sensor connected to ESPHome ESP8266
I’ve found the number I need to put for pulse to liter calculation
but why don’t you use that number on the meter sensor ? It’s counting pulses too.

Hey Pieter, thanks for putting this together, I’ve followed your guide and everything is working but I can’t seem to find the magnet on my water meter.

I know the sensor is working because when I touch it to metal I see the red LED light up and the esp device log shows another litre counted but for the life of me I can’t seem to find where the magnet is.

I have a Neptune ProCoder T-10 5/8 Meter (Neptune ProCoder T-10 Meter 5/8 x 3/4 – ABT Water Store) any idea where to place the sensor to detect the magnet??? I’ve sat there holding the sensor in many different places while running water and I’m not getting any readings…



Hi, I have build the watermeter. I see on the sensor the red led blinking when water is used.
I have set the up the yaml files exactly as you have indicated in the article. The sensors in ESP configuration file and the rest in the HA configuration yaml file.
But the readings are not correct, it is not counting but the figures are continuously changing and adding.
I expect stable figures when the water is not used end adding figures when water is used.
The logs file shows a continuous stream of log entries (scrolling fast like picking up noise).
The water Pulse meter indication is erratic and shows values up in the 10000.
Do you know what is wrong?

I managed to get a pulse for every 0.1 liter!
so I use this code for esphome node:

  - platform: pulse_meter
    pin: 12
    name: "water flow rate"
    icon: "mdi:water-sync"
    id: water_flow_rate
    accuracy_decimals: 1
    unit_of_measurement: "l/min"
    timeout: 15s
      - multiply: 0.1
      name: "Water Total"
      icon: "mdi:water"
      unit_of_measurement: "liter"
      accuracy_decimals: 1
        - multiply: 0.1

now I have to mount my sensor on my water meter. I think I will 3d-print a mount that fits.
thanks a lot for this guide!!

hi @leptop, thanks for your ‘kind’ responds and your ‘constructive’ feedback.

A community is about sharing knowledge and helping each other.

If you don’t like the writing, don’t read the article.
If you don’t need the solutions, don’t read the article.

Don’t criticize on contributors, if you can do it better start contributing.

Looking forward to see your contributions to the Home Assistant community.


3d printing is a more stable solution than my tyraps solution. Although the tyraps are still going strong after more than a year :slight_smile:

In my opinion, 3D printing is not strictly necessary for robust and clean installation. Simple metal brackets for these sensors are common in industrial machinery and factories, and they provide great adjustment space. Similar brackets are available for purchase on AliExpress or can even be made from flat iron. It’s basically just a piece of metal, either straight or bent, with holes for the sensor and a fastening to the surface.

The sensor you advised I order did come this week. Unfortunately, my Zenner brand water meter did not respond properly to it. After several hours of attempting, I was unable to make it read consistently. I’m not giving up, though, and I have just bought a reed sensor because that is the type of sensor that the manufacturer uses. I would be willing to pay cash for an OEM sensor, but it appears that it is no longer available for this specific model.

I was going to write a thank-you message after my installation was completed and functioning, but after reading another user’s unfavorable comment, I decided to do so now. I believe that we need to do this kind of stuff to help handle the energy crisis and everything else that is crazy right now.

1 Like

Thanks for your contribution Pieter! I’ve saved your blog post for future reference

And please ignore the zeiksnorren die hier rondhangen.

1 Like

Thanks for the clear description of the water meter you build. I build it and it works great. I first started with the ty-raps but found another solution which I want to share. I used two pvc pieces which i could fix on top of the water meter:

In the lid I could place the sensor. I used tape to fix the house on the water meter, no need to fix the lid, so it is possible to look inside:

The two pvc pieced can be found in the diy store (bouwmarkt).


That is an amazing solution. Thanks for sharing.

see my 3d printed mount:


Hi, thanks for the idea.
I have a problem with number of pulse, in my case the LJ18A3-8Z/BX send more of one pulse per revolution of the indicator. The sensor send same pulses from when magnet is recognized until leaves his field. So I get a wrong value.

Is there a way to limit the number of reading? For example, after the first impulse, wait 2 seconds before considering another one. Is there other solutione to avoid this problem?

You could try adjusting the internal_filter to adjust the length of pulses that trigger. Detailed in the documentation: Pulse Counter Sensor — ESPHome

1 Like

I have made another type of water meter

Nex step is make port to Home Assistant