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

Has anyone been able to make this work on a Badger Model 25 water meter? I have an ESP32 with a LJ18A3-8Z/BX but I’m not able to figure out where to mount it to get a reading. I’ve tried holding the sensor over all parts of the meter, with water running, without any luck.

If I hold the sensor up to the metal (brass?) bottom section, the sensor lights up and stays lit no matter where on the metal I hold it. If I hold it up to the plastic housing on top, I get nothing at all.

I’m sure there’s a magnet inside the meter somewhere, I just can’t figure out where.

1 Like

Hello,

Does anyone know if we can buy a decent holder for the flowsensor. I like the design which dddesign have created, can we place a order for this one? :slightly_smiling_face:

My water meter already has a device attached to it that I assume is a proximity sensor. It covers the dial.

Would a second proximity sensor offset from the dial have a chance of working?

hello!

nice design, exactly what i search :wink:

anychance you share it on thingiverse or somewhere else please?

thanks

Would anyone be able to help me with adapting the code for the units on my meter? Looks like one revolution would be 0.2 gallons?

Thanks

hello
thank you for sharing this great project.

maybe someone can help me?

is it possible to add a water leak test
ex: if for a while (1 hour)we receive impulses without stopping
it means that there is a leak, then we send a message (alarm)

thanks
Fred.

I’ve built this water meter some time ago, took me some time to succesfully tie-wrap it to the water meter :slight_smile:.

After the meter was up and running I tried adding it to the utility dashboard. However, HA did not like the way the variables were defined, so I made some slight adjustments per instructions I found elsewhere. The sensor part in ESP-home now looks like this:

sensor:
  - platform: pulse_counter
    pin: GPIO12
    update_interval: 6s
    name: "water pulse"
    id: water_pulse
  - platform: pulse_meter
    pin: GPIO12
    name: "Water Pulse Meter"
    unit_of_measurement: "liter/min"
    icon: "mdi:water"
    total:
      name: "Water Meter Total"
      unit_of_measurement: "m³"
      id: water_meter_total
      accuracy_decimals: 3
      device_class: water
      state_class: total_increasing
      filters:
        - multiply: 0.001
  - platform: template
    name: "Water Usage Liter"
    id: water_flow_rate
    accuracy_decimals: 1
    unit_of_measurement: "l/min"
    icon: "mdi:water"
    lambda: return (id(water_pulse).state * 10);
    update_interval: 6s
    device_class: water

Thanks again for your great instructions @pbrink :grinning:

3 Likes

Thanks @MJV, I noticed the same issue yesterday. This was on my list to address.

I will try your configuration and will update the article to help out others (and will give you all the credits of course :+1:).

Hi @pbrink

Thanks a lot for the great project! I was not able to test it yet just bought all the items and currently waiting for the shipment to arrive.

Just one question, how do you set the initial value as the water meter don’t start with 0?

Thanks again

@pbrink Hi, thank you for the great project.
I have succesfully made watermeter. but I have a little issue with the sensors.

There are 2 sensors that succesfull post info: sensor.water_meter_total & sensor.water_pulse_meter.
But the other 3 (sensor.water_total & sensor.water_usage_liter & sensor.water_pulse) always stay 0, do you have an idea what goes wrong?

 - platform: pulse_meter
    pin: GPIO12
    name: "Water Pulse Meter"
    unit_of_measurement: "liter/min"
    icon: "mdi:water"

I do not understand how a pulse meter can have the unit of liter/min. Could you please explain? In your configuration, there are two sensors with liter/min.

1 Like

Thanks for this @pbrink.
I am using similar solution but my water meter has reed switch (2 wires) and it says it is 1 impulse/liter, but it turned out that it sends 3 impulses per liter (one rotation of dial is 1 liter, when that happened, I counted 3 liters which was not ok) so I adjusted code a bit.
I am struggling to understand the difference between pulse_counter and pulse_meter

My current definition is:

sensor:
  - platform: pulse_counter
    pin:
      number: 12
      inverted: true
      mode:
        input: true
        pullup: true
    name: "Instant water consumption"
    unit_of_measurement: "L/min"
    icon: "mdi:water"
    update_interval: 6s
    accuracy_decimals: 3
    filters:
      - lambda: return (x / 3.0);
    total:
      name: "Total water consumption"
      unit_of_measurement: "m³"
      device_class: water
      state_class: total_increasing
      accuracy_decimals: 3
      icon: "mdi:water"
      filters:
        - lambda: return (x / 3000.0);

When testing, it seems OK as I get update every 6 seconds (if I let 1l flow, I will see it within 6 seconds, also flow rate L/min seems OK (updating every 6 seconds also).
However when I for instance have 0,020m3 of water, and I restart ESP, I then get 0,000 again. Is that expected behavior for the “total”? If I create utility meter for water usage, then it is OK, but I would expect that ESP would “keep” the value (or HA)

Hi @hackex, It’s been a long time since I build this sensor. I’m pretty unsure about the L/min value. The values look fine, I remember it was a bit of a puzzle. I need to find some time to digg in :slight_smile:

hi @b4ker and @stomko,

You both asked a question that has the same answer.

However when I for instance have 0,020m3 of water, and I restart ESP, I then get 0,000 again. Is that expected behavior for the “total”? If I create utility meter for water usage, then it is OK, but I would expect that ESP would “keep” the value (or HA)

Just one question, how do you set the initial value as the water meter don’t start with 0?

The total values from the ESP will always be 0 after a power cycle / restart. This is expected value. The definition of “state_class: total_increasing” in ESP creates a sensor with the state class total_increasing. This means that HA will calculate the increase based on the positive delta.
The sensor when it’'s first added to Home Assistant is used as an initial zero-point. When a new meter cycle is detected, in our case after the ESP is restarted, the zero-point will be set to 0.

More info: New sensor state class: total_increasing | Home Assistant Developer Docs (home-assistant.io)

1 Like

HI @Dinges28,

Try a restart of HA.

@stomko I would use the multiply filter. Lambda is an overkill for this.

Multiply by 0.3333 should do the trick.

      filters:
        - multiply: 0.333;

See the Converting Units section in the ESPHome docs.
Pulse Counter Sensor — ESPHome

Tried, does not work :frowning:

Could it be I had to solder the + to the VU pin instead of VIN, because VIN on a lolin ESP8266 is 3.3 volt, which is too low for the proximity sensor

Hi,

When I use my water between 11pm and 1am. It increases a lot the water consumption. But not according to what I really use. for example I use 5-6l but it shows then 61l. But during the day. I have no problem. Can anyone tell me why ? And when I tray to follow my hourly usage in the UI. It shows up in m3 and not in L.

Thanks

Correct, the sensor needs 5v.

Hi, How did you get the m3 into L ?