Hardware Matrix

Is YF-S201 Water Flow Meter Sensor Compatible with Home Assistant (ESPHome)?

Verdict Badge
VERDICT: [ COMPATIBLE (MANUAL CONFIG REQUIRED) ]
Protocol: Pulse Counter / 5V
Bridge Needed: NO

Electrical Specifications

Always confirm pin assignments against the manufacturer datasheet before wiring.

Not yet documented. Electrical specifications for this device have not been confirmed against a manufacturer datasheet, so none are shown here rather than showing estimates. Submit verified specifications if you have the datasheet to hand.

Compatibility Overview

1/2-inch hall effect turbine water flow sensor measuring water consumption rate and total volume in Home Assistant.

Wiring YF-S201 Water Flow Meter Sensor to ESP32

Module pin ESP32 Note
Red 5V
Black GND
Yellow (signal) GPIO27 Through a 1kΩ/2kΩ divider. The Hall output swings to the 5V rail and the ESP32 pin is not 5V-tolerant.

Host pins are the ones the configuration on this page uses. Move a pin here and change it in the YAML — they are documented together so they cannot disagree.

Technical Specification Matrix

Feature / Attribute Specification / Status
Hardware Protocol Pulse Counter / 5V
Bridge Required NO
Border Router Needed None
Hardware Capabilities & Peripherals
Flow Rate (L/min) Total Volume Consumed (Liters)

Note: these entities come from the ESPHome configuration you flash — each one needs its matching component in that YAML before it appears.

Pairing Complexity Plug-and-Play
Factory Reset Instruction Hold BOOT button for 3s.

Wire, Flash, Adopt, Check

1

Wire it up

Follow the wiring table above. The ESP32 pins there are the ones the configuration uses, so if you move one, change it in both places.

2

Flash the configuration

Create a new device in the ESPHome dashboard (the Home Assistant add-on) and paste the configuration below into it, or save it as emb_esp32_water_flow_ha.yaml and run esphome run emb_esp32_water_flow_ha.yaml. The first flash goes over USB. If it is not detected, hold BOOT button for 3s to put it in download mode. Every update after that is over the air.

3

Adopt it in Home Assistant

Settings → Devices & Services. A node on the same network shows up as a discovered ESPHome device within a minute of joining Wi-Fi; choose Configure and enter the API encryption key from your secrets.yaml. If discovery does not find it, add the ESPHome integration by hand with the node's IP address.

4

Check it works

Open a tap downstream: Water Flow rises within a second or two and Water Total climbs. Shut the tap: flow returns to zero within ten seconds. A flow that reads but a total that stays at zero is the second lambda missing.

ESPHome Configuration

Starting configuration for YF-S201 Water Flow Meter Sensor on ESP32. Untested on hardware — verify wiring and pins against your own board.

# ESPHome configuration for YF-S201 Water Flow Meter Sensor
# Host: ESP32. Pin numbers below are host-side defaults — any free
# GPIO will do, and you should change them to match your own wiring.

esphome:
  name: emb_esp32_water_flow_ha
  friendly_name: "YF-S201 Water Flow Meter Sensor"

esp32:
  board: esp32dev
  framework:
    type: esp-idf

logger:

api:
  encryption:
    key: !secret api_encryption_key

ota:
  - platform: esphome
    password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

sensor:
  - platform: pulse_meter
    pin: GPIO27
    name: "Water Flow"
    unit_of_measurement: "L/min"
    # pulse_meter reports the rate from the gap between pulses, so it only
    # falls to zero after this long with no pulse. The 5-minute default
    # leaves a tap reading "flowing" long after it is shut.
    timeout: 10s
    filters:
      # YF-S201 datasheet figure: 450 pulses per litre.
      - lambda: return x / 450.0;
    # Pulse count since boot, scaled to litres. device_class water and
    # state_class total_increasing let Home Assistant's Energy dashboard
    # track it as water consumption; the total survives reboots through
    # the statistics HA keeps, not on the node.
    total:
      name: "Water Total"
      unit_of_measurement: "L"
      device_class: water
      state_class: total_increasing
      accuracy_decimals: 2
      filters:
        - lambda: return x / 450.0;

Before you flash: the !secret values come from your secrets.yaml, and the GPIO numbers are host-side defaults rather than properties of this part — change them to match how you actually wired it.

What Appears in Home Assistant

Water Flow
sensor

Litres per minute, from the interval between pulses. Drops to zero within the 10s timeout after the last pulse.

Water Total
sensor

Litres since boot, with device_class water and state_class total_increasing so Home Assistant's Energy dashboard can track it as water use. The node restarts from zero; HA's statistics handle that as a meter reset.

Known Problems and Fixes

450 pulses per litre is nominal

The datasheet quotes F = 7.5 × Q and ±10% — and the error is not constant across the range. Run a known volume through it (a 10-litre bucket), compare, and adjust the divisor in both lambdas. That turns ±10% into a few percent.

It does not see drips

The turbine needs about a litre a minute before it turns reliably. A dripping tap or a slow leak reads as zero. Treat the total as a guide to consumption, not a leak detector.

Mount it right

Arrow in the direction of flow, and a straight run of pipe before the inlet steadies the reading. Rated to 80°C and 1.75MPa; it is a cold-water part in practice.

pulse_meter versus pulse_counter

pulse_counter reports pulses per interval and is slow to respond at low rates. pulse_meter times the gap between pulses, which is why the config uses it — but that is also why it needs a timeout to fall back to zero, and why the default five minutes is wrong for a tap.

🛠️ Hardware Correction & Field Contributions

Report a Pinout Error or Submit Tested Code Snippets

Found a pin mapping quirk or built a custom ESPHome YAML driver for YF-S201 Water Flow Meter Sensor? Submit a pull request or report corrections to our index.

Frequently Asked Questions

Does YF-S201 Water Flow Meter Sensor work without an internet connection?
100% local pulse counting.
How is YF-S201 Water Flow Meter Sensor powered and wired to the host board?
5V VCC Signal=GPIO14 (requires 1k/2k resistor voltage divider to 3.3V).
How does the host board reach Home Assistant (ESPHome)?
Wi-Fi 2.4GHz.

Alternatives

Related Compatibility Matrix Guides