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

Hi,
you could create a sensor.
For example:

  - platform: template
    sensors:
      consommation_eau_volume_en_m3:
        value_template: >
          {% set Appareil = 'counter.eau_impulsion' %}
          {{ states(Appareil) | multiply(0.001) | round(0) }}
        unit_of_measurement: 'm3'

Hi everybody,

I’ve got a problem with my inductive sensor.
It is counting very well my consumption:

- platform: pulse_counter
    pin: GPIO26
    name: "water_pulse"
    count_mode:
      rising_edge: DISABLE
      falling_edge: INCREMENT
    update_interval: 1.0s
    id: water_pulse

But sometimes (1 time by day), it count frenetically with unconsistant value, so it fucked totally my consumption:

I was sleeping, so I’m certain no one used water, and even if, flow is really inconsistent (my home is not a factory :slight_smile: )
Could you help me ?

Hi
same here: no Water Usage Liter nor water pulse.
@Pieter: your example configuration (on your website) does have 2 yaml formating errors: the first 2 “-platform:” lines to missing 2 spaces upfront the text.
Furthermore: is it correct that you have 2 times the “- platform: pulse_meter”? This sounds like an error in your documentation?

But i´m mainly concerned why “- platform: pulse_counter” doesnt provide any return code - while “pulse_meter” does. As “water_pulse” stays 0 the “Water Usage Liter” does also says 0.

Kind regards
Thorsten

1 Like

[19:24:16][C][pulse_meter:069]: Pulse Meter ‘Water Pulse Meter’
[19:24:16][C][pulse_meter:069]: State Class: ‘measurement’
[19:24:16][C][pulse_meter:069]: Unit of Measurement: ‘liter/min’
[19:24:16][C][pulse_meter:069]: Accuracy Decimals: 2
[19:24:16][C][pulse_meter:069]: Icon: ‘mdi:water’
[19:24:16][C][pulse_meter:070]: Pin: GPIO12
[19:24:16][C][pulse_meter:072]: Filtering rising edges less than 13 µs apart
[19:24:16][C][pulse_meter:076]: Assuming 0 pulses/min after not receiving a pulse for 300s

Same here :slight_smile:
Also fixed the same yaml formatting issue.

What ever I do, the Pulse meter works, but the pulse counter doesn’t. I test with a small piece of metal, slow/fast doesn’t matter.
Any additional config required?

Couldn’t make the pulse counter work, but It’s also not needed. Both the flow rate as usage can be derived from the pulse meter. The additional template sensor (in M3) is used because HA energy dashboard expects an M3 value.

sensor:
  - platform: pulse_meter
    pin: D6
    name: "Water Flow Rate"
    unit_of_measurement: "l/min"
    icon: "mdi:pulse"
    timeout: 120s
    total:
      name: "Water Usage"
      unit_of_measurement: "L"
      icon: mdi:water
      id: water_meter_total
      accuracy_decimals: 0
      device_class: water
      state_class: total_increasing

  - platform: template
    name: "Water Usage M3"
    id: water_usage_m3
    accuracy_decimals: 3
    unit_of_measurement: "m³"
    device_class: water
    state_class: total_increasing
    icon: "mdi:water"
    lambda: return (id(water_meter_total).state * 0.001);
    update_interval: 60s
1 Like

My code is working properly but I have 2 issues.
I’m working with a wemos D1 mini, and this is my sensor :
image

It has no LED to show when it’s detecting a pulse. Is it possible to blink the blue onboard LED every time a pulse is detected? How do I do that?

Is there a way to hold the values when rebooting/ reflashing? now it always starts from zero. For the energy dashboard that’s no problem, but i’d like to use those values for calculations.

This is my code :

sensor:
- platform: pulse_counter
  pin:
    number: GPIO4
    mode:
      input: true
      pullup: true
  update_interval : 5s
  name: "water pulse"
  id: water_pulse

- platform: pulse_meter
  pin: 
    number: GPIO4
    mode:
      input: true
      pullup: true
  name: "Water Pulse Meter"
  unit_of_measurement: "liter/min"
  icon: "mdi:water"
 
- platform: pulse_meter
  pin: 
    number: GPIO4
    mode:
      input: true
      pullup: true
  name: "Water Liter Meter"
  unit_of_measurement: "liter/min"
  icon: "mdi:water"
  total:
    name: "Water Meter Total" 
    unit_of_measurement: "m³"
    id: water_meter_total_esp
    accuracy_decimals: 3
    device_class: water
    state_class: total_increasing
    filters:
      - multiply: 0.001

- platform: template
  name: "Water Usage Total"
  id: water_usage_total_esp
  accuracy_decimals: 0
  unit_of_measurement: "liter"
  icon: "mdi:water"
  device_class: water
  state_class: total_increasing
  lambda: return (id(water_meter_total_esp).state * 1000);
  update_interval: 10s

Erwin

Hi! Did you solve this? I am struggling with the same issue (not the same meter, though). My behavior is oposite; constant red led when I point the sensor at the glass, and no light when on the metal underneath it

1 Like

I have this meter: https://www-elstermetering-com.dyn.elster.com/assets/products/products_elster_files/D_M130_0104e_1016_1_0_0.pdf

I am not able to get a signal anywhere on the glass surface (just constant led red). Anyone see something obvious I don’t? :slight_smile:

1 Like

No unfortunately I gave up on the proximity sensor. I was trying an AI esp32 camera setup that worked ok but not great, it needed a lot of tweaking.

I might just give up on water meter readings until my city replaces all the water meters with smart ones in the next several years.

1 Like

I have the opposite problem (no light on top of glass but illuminates if I put it on top of the brass coloured ring or against other metal objects) but I have a suspicion that we both are hit by the same underlying reason.

I think the whole brass coloured fitting alongside the seal is put there to prevent tampering with the meter and the spinning magnet. I never knew this but apparently it’s a thing to get “free” (until you are caught) water by stopping the wheel and thus meter with a strong magnet in some countries.

Most builds that I have seen are on meters that lack this brass fitting, thus it probably interferes with the proximity sensor. If it is by distance or other means is beyond me but I wouldn’t put it past the nordic countries to be this controlling.

Given by your name I assume you are from Norway and me being in Sweden I think we could be in the same boat.

Unless someone has a solution for us? (and yes this is a cry for help)


1 Like

Hi, have the same problem. Did you found a solution?

Hi there. Interessant to read.
At the moment I’m looking for a water flow meter which can be used as a calorie meter, so I would have to be able to sens(or) the temperature as well.

Could a port/connection like this be used for that? And what’s the deal for?

I would be planning to log the water flow in combination with the temperature which would give me the total energy flowing through the pipes as well.

Thanks!

there is no metal plate to register the proximity sensor and thus a pulse

1 Like

I have a meter that gives a pulse every 10Liters but I cant seem to get the math right. can somebody shed a light (pulse) on this?

sensor:
  - platform: pulse_counter
    pin: 21
    update_interval : 6s
    name: "water pulse"
    id: water_pulse
    
  - platform: pulse_meter
    pin: 21
    name: "Water Pulse Meter"
    unit_of_measurement: "liter/min"
    icon: "mdi:water"
    total:
      name: "Water Total"
      unit_of_measurement: "liter"
    
  - platform: pulse_meter
    pin: 21
    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: **???**
    
  - 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 * **??**);
    update_interval: 6s

Don’t think so. My guess is that it’s not even a data port/connection.
I did a quick search online and it looks like some kind of mechanical flow adjustment screw to me at least.

Anyone tried to connect a Kent V100 (also known as Elster V100 or so called grenade meter?) with this setup?

You can use a Hall sensor instead. I’m trying it out now and just plugged it in.

Not sure if values are correct with the usage (maybe it’s 2 pulses every liter instead of 1)

1 Like

Hi,
one revolution of the spinning wheel is 10. Multiply that with ,01 (as seen on the meter) and you’re at 0,1 gallon per revolution

Can confirm it works but with hall sensor.

I used this one: Hall Effect Sensor - Unipolar - 3V to 28V

Although config doesn’t work. Only 2 / 5 sensors are working

1 Like

I have a Sensus, but not sure the model. it’s a 25-30 year home, so could be original meter. Does anyone know if the pulse reader would work?

1 Like