Hello everyone,
I have a water meter implementation based on ESP, and build following this (very helpful by the way) site: Build a cheap water usage sensor using ESPhome and a proximity sensor - PieterBrinkman.com
The sensor that I use is this one:
My problem is that from time to time the water consumption readings are incredibly high and the displayed values could never be real, in my situation.
As we can see in the following graphs, between 5:00 and 6:00 in the morning there is a consumption of 4191 liters of water, while in reality it should be something like 25L (usually used by the water softener for internal cleaning)
On the same graph, a little later (between 6:00 and 7:00) we can see a consumption of 26L and between 7:00 and 8:00 a reading of 57L, which are more realistic.
Here are the graphs:
And this is the code that I use for this ESP sensor:
esphome:
name: compteur-deau
friendly_name: Compteur d'Eau
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "xxxxx"
ota:
password: "xxxxxxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Compteur-Deau Fallback Hotspot"
password: "xxxxxxx"
captive_portal:
sensor:
- platform: pulse_counter
pin:
number: GPIO12
allow_other_uses: true
update_interval : 6s
name: "water pulse"
id: water_pulse
- platform: pulse_meter
pin:
number: GPIO12
allow_other_uses: true
name: "Water Pulse Meter"
unit_of_measurement: "liter/min"
icon: "mdi:water"
total:
name: "Water Total"
unit_of_measurement: "liter"
id: water_total
state_class: measurement
- platform: pulse_meter
pin:
number: GPIO12
allow_other_uses: true
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
state_class: measurement
As this phenomenon is random, I was wandering if this is caused when the metallic part of the water meter, the one that turns when water is used, is stopped just below the sensor. When this happens, the red LED of the sensor remains on.
My thoughts is that it could make that in this situation the system continues to count as long as the sensor remains activated by this metallic part, even if there is no water consumption.
Maybe there is something else, or maybe there is a parameter to avoid this continuous count.
Any help would be greatly appreciated
Thank you