{
    "key": "yf-s201",
    "kind": "sensor",
    "model": {
        "aliases": [
            "yf-s201"
        ]
    },
    "driver": {
        "runtime": {
            "init": {
                "args": {
                    "chip": "{gpio_chip}",
                    "line": "{signal_pin}",
                    "pulses_per_litre": "{pulses_per_litre}"
                },
                "class": "drivers.yfs201.YFS201"
            },
            "apt_packages": [
                "python3-libgpiod"
            ],
            "pip_packages": [
                "gpiod"
            ],
            "python_module": "drivers.yfs201"
        },
        "targets": [
            "raspberrypi"
        ],
        "verified": {
            "by": null,
            "os": null,
            "date": null,
            "board": null,
            "reviewed_by": null,
            "evidence_url": null
        },
        "interface": "gpio-pulse-count",
        "connection": {
            "pins": [
                {
                    "role": "signal",
                    "notes": "Open collector output. Requires a pull-up and level shifting or division from 5V to 3.3V.",
                    "required": true
                }
            ],
            "supply_voltage": "5V",
            "level_shift_required": "Required on signal"
        },
        "constraints": {
            "warmup_seconds": null,
            "read_timeout_seconds": null,
            "min_read_interval_seconds": 1
        },
        "failure_modes": [
            "Output swings to 5V and must be divided or level shifted before a Raspberry Pi GPIO input.",
            "Flow rate is derived from pulse frequency counted over a window. Polling the pin returns a level, not a rate, and yields nothing useful.",
            "The pulses per litre constant varies between units and with flow rate. The nominal figure is an approximation and per-unit calibration is required for volume totals.",
            "Below the minimum rated flow the impeller stalls and reports zero rather than a small flow."
        ]
    },
    "source": "platform-seed",
    "status": "draft",
    "platform": {
        "name": "YF-S201 Water Flow Sensor",
        "protocol": "gpio",
        "readings": [
            {
                "slug": "flow-rate",
                "unit": "litres per minute",
                "label": "Flow Rate",
                "data_type": "float",
                "range_max": 30,
                "range_min": 1,
                "unit_symbol": "L/min",
                "device_class": "volume_flow_rate",
                "decimal_places": 2,
                "threshold_crit_low": null,
                "threshold_warn_low": null,
                "threshold_crit_high": 30,
                "threshold_warn_high": 25
            }
        ],
        "description": "Hall-effect water flow sensor. Outputs pulses proportional to flow rate. GPIO interrupt counting.",
        "sensor_type": "fluid",
        "manufacturer": null,
        "model_number": "YF-S201",
        "datasheet_url": null,
        "read_interval_seconds": 10
    },
    "revision": 1
}