npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

irrigationsystem

v0.0.4

Published

HomeKit irrigation system using HAP-NodeJS library

Downloads

770

Readme

HomeKit Irrigation System

npm npm npm


Overview

Standalone HomeKit-enabled irrigation system built using HAP-NodeJS.

Provides:

  • Multi-zone irrigation control
  • Water tank level monitoring (ultrasonic)
  • Flow-based leak detection
  • EveHome history support
  • Built-in Web UI (HomeKitUI)
  • No Homebridge required

Web UI (HomeKitUI)

This project includes a built-in web interface powered by HomeKitUI.

Features

  • Dashboard with live water tank levels
  • Irrigation zone configuration
  • Tank configuration
  • System options
  • Live log streaming
  • HomeKit pairing management
  • Configuration backup/restore
  • Optional bearer-token authentication

Access

http://<device-ip>:8582

Port is configurable via:

options.webUIPort

Authentication

HomeKitUI supports optional bearer-token authentication.

When configured:

  • API access requires a bearer token
  • Browser UI stores the token locally after first authentication
  • Live log streaming remains supported via secure SSE token fallback

Example:

"webUIBearerToken": "your-secret-token"

To disable authentication:

"webUIBearerToken": ""

Dashboard

Displays:

  • Water tank levels (percentage + litres)
  • Tank capacity
  • Last updated readings
  • Zone runtime state
  • Water usage information

Tank data is updated automatically from sensor events.

Notes

  • Fully self-contained UI (no external frontend)
  • Config changes may require restart
  • Log sources (priority):
    1. journald (systemd)
    2. log file (if configured)
    3. console (fallback)

Parts

Built with readily available off-the-shelf components, housed in a sealed ABS enclosure.

As the system is installed externally, mains wiring (240v → 24v transformer) is isolated in a separate enclosure.

  • Raspberry Pi Zero W
  • 24v AC transformer (Hunter irrigation)
  • LM2596HV AC/DC step-down converter (5v output)
  • JSN-SR04T waterproof ultrasonic sensor
  • 8-channel solid-state relay board (high-level trigger)
  • Water flow sensor (pulse output)
  • Waterproof push-on/push-off LED switch
  • Mains power cable
  • Irrigation wiring

Water Tank Configuration

Defined in IrrigationSystem_config.json under tanks.

Example:

"tanks": [
  {
    "name": "Rainwater Tank",
    "enabled": true,
    "capacity": 5000,
    "sensorTrigPin": 20,
    "sensorEchoPin": 21,
    "sensorHeight": 1970,
    "minimumLevel": 200
  }
]

| Name | Description | |------|-------------| | name | Tank name | | enabled | Enable/disable tank | | capacity | Tank capacity (litres) | | minimumLevel | Minimum measurable level (mm) | | sensorEchoPin | GPIO echo pin | | sensorTrigPin | GPIO trigger pin | | sensorHeight | Sensor height above tank base (mm) | | uuid | Auto-generated (DO NOT CHANGE) |

Tank Behaviour

  • Ultrasonic sensor measures water distance
  • Readings are smoothed internally
  • Percentage is calculated from:
    • sensor height
    • minimum usable level
  • Dashboard displays:
    • % full
    • litres remaining
    • last updated time

Irrigation Zone Configuration

Defined in zones.

"zones": [
  {
    "name": "Back Lawn",
    "enabled": true,
    "runtime": 300,
    "relayPin": 14
  }
]

| Name | Description | |------|-------------| | name | Zone name | | enabled | Enable/disable zone | | relayPin | GPIO relay control pin or array of pins | | runtime | Default runtime (seconds) | | uuid | Auto-generated |


Configuration Options

Defined under options.

| Name | Description | Default | |------|-------------|---------| | debug | Enable debug logging | false | | elevation | Height above sea level | 0 | | eveHistory | Enable EveHome history | true | | flowRate | Flow sensor rate (L/min @1Hz) | — | | latitude | Location latitude | 0 | | longitude | Location longitude | 0 | | leakSensor | Enable leak sensor | false | | powerSwitch | Virtual power switch | false | | maxRuntime | Maximum zone runtime (seconds) | 7200 | | sensorFlowPin | Flow sensor GPIO | — | | usonicBinary | Path to ultrasonic measurement binary | ./usonic_measure | | waterLeakAlert | Trigger HomeKit alert | false | | webUIPort | HomeKitUI port | 8581 | | webUIBearerToken | Optional HomeKitUI bearer token | "" |


Ultrasonic Water Level Measurement

Includes usonic_measure.c for accurate ultrasonic sensor timing.

Requires:

sudo apt install wiringPi

Compile:

gcc -o dist/usonic_measure src/usonic_measure.c -l wiringPi

Sensor used:

  • JSN-SR04T
  • Minimum distance: ~200mm
  • Maximum distance: ~4500mm

HomeKit Integration

Exposes:

  • IrrigationSystem service
  • Valve services (zones)

Optional services:

  • Leak sensor
  • Power switch

Supports:

  • Siri control
  • EveHome advanced features
  • History logging

Disclaimer

This is a personal hobby project provided "as-is", with no warranty whatsoever, express or implied, including but not limited to warranties of merchantability or fitness for a particular purpose.

Building and running this project is done entirely at your own risk.

⚠️ This project involves mains power wiring. It is strongly recommended that you engage a licensed electrician where required and ensure all installations comply with local regulations.

I am not affiliated with any companies such as Apple or other related entities. The author of this project shall not be held liable for any damages or issues arising from its use.

If you find this project useful, sponsorship to support ongoing development is always appreciated.