A Seeed XIAO ESP32-C6 counts the pulses of a G3/4 Hall flow sensor and sends live flow and the running total to Home Assistant over Zigbee. It keeps counting on its 18650 backup when the power goes out.
Same sensor, same numbers as an ESPHome build. It joins the Zigbee mesh your other sensors already use, and it doesn't stop counting when something else does.
Live flow in L/min and a total in litres, ready for the Home Assistant Energy dashboard.
Runs from USB with an 18650 backup. The total lives in flash and survives reboots too.
The ESP32-C6 PCNT counter with a glitch filter. No pulse is lost while the radio talks.
Water running non-stop, used overnight, meter offline, running on battery. All in the HA package.
Pulses per litre are stored on the device. Two scripts compute the right value for you.
Always powered, so it relays Zigbee traffic for the devices around your utility room.
Temperature, humidity and pressure, detected at boot. No sensor, no empty entities to fight with.
Unit tests, two firmware builds, converter tests on Z2M's own library, Home Assistant's config checker.
Water turns a small turbine in the G3/4 sensor. A magnet on it passes a Hall sensor once per turn.
yellow wire → D2The PCNT peripheral counts every rising edge and drops spikes under 10 µs. The CPU just reads it once a second.
PCNT · 1 sFlow is averaged over 5 s. The total is kept as a double, exact to the millilitre for decades, and saved when the water stops.
flow_logic.hStart and stop go out at once; while flowing, every 5 s if something changed; everything again every 5 min.
Analog InputZigbee2MQTT exposes flow and water_consumed, which Home Assistant knows as volume flow rate and water.
One Zigbee2MQTT converter, one package file. You get native entities, utility meters for today, this month and this year, and alerts that catch what a monthly bill never will.
Continuous flow. Water running without a break for an hour (you pick the delay): a leak, a hose or a tap left open.
Night usage. More than 2 L between 01:00 and 06:00: a dripping tap or a running toilet.
On battery. USB power is gone and the backup cell is draining. Plus meter offline after 15 minutes of silence.
Water has been flowing without a break for 60 minutes (0.6 L/min right now). Leak or tap left open?
sensor.water_meter_flowvolume flow ratesensor.water_meter_water_consumedwater · totalnumber.water_meter_pulses_per_literconfigsensor.water_today · _this_month · _this_yearutility metersHall sensors are sold with a rough "F = 5.5 × Q". The real number varies from unit to unit. Ten minutes with a bucket and the meter matches your utility bill.
Run Water calibration - start in Home Assistant. It remembers the current total.
10 L, at your usual flow, with nothing else using water in the house.
Close the tap and wait until the flow reads 0, so the last litres are reported.
Enter the real volume and run Water calibration - finish. The new value is written to the meter.
Recalibrating never rewrites the litres already counted.
Install the latest firmware from this page with Chrome or Edge on a computer. Prefer to build it yourself? It's one pio run away.
OUT+ wire, then plug the XIAO into your computer.Zigbee router, pulse counter on D2, optional BME280. Calibration and total stay on the device across updates; only a full erase resets them.
The TP4056 charges the cell and powers everything from it, so the meter doesn't even notice a power cut.
ESP32-C6 pins take 3.6 V at most, and many Hall sensors pull their signal up to their own supply. A Schottky diode (bar towards the sensor) and a 10 kΩ pull-up to 3V3 make any sensor safe. Why and how
To flash over USB, disconnect the TP4056 OUT+ wire first: the XIAO's 5V pin is its USB port.
| Part | Role | Notes |
|---|---|---|
| Seeed XIAO ESP32-C6 | Zigbee radio + MCU | The firmware switches to the external antenna |
| 2.4 GHz U.FL antenna | Range from a utility room | Pipes and metal eat 2.4 GHz |
| G3/4 Hall flow sensor | The sensor | 1–30 L/min, ~490 pulses/L to start with |
| TP4056 USB-C module | Charging and power | The 6-pin version with protection (B± and OUT±) |
| 18650 cell + holder | Backup | One to two days without USB |
| BAT85 diode + 10 kΩ | Safe pulse signal | A few cents |
| BME280optional | Temperature, humidity, pressure | I2C, address 0x76 or 0x77 |
| 2 × 100 kΩ + 100 nFoptional | Battery voltage | Enables the on-battery alert |
No. Counting is done by hardware and the total is kept on the device. When the network comes back, Home Assistant gets the new total, and total_increasing statistics catch up on their own.
Not for long. The Hall sensor draws 5–15 mA all the time and a router never sleeps, so an 18650 lasts one to two days. The battery is there to ride through power cuts.
Yes. Publish the reading in litres once, for example {"water_consumed": 254318} to zigbee2mqtt/water_meter/set. Use 0 to reset.
No. A new pulses_per_liter applies only to the water counted from then on.
No credentials, no IP address, no API key: it joins the mesh your other sensors already use and keeps working when the WiFi doesn't. You give up WiFi OTA updates and the web UI; updates go over USB, which is rare once it's calibrated.
Sometimes. A 1–30 L/min turbine may not spin below about 1 L/min. The night usage alert catches slow leaks anyway, because even a few litres over five hours add up on the total.
Open source, MIT licensed, built from parts you can order today.