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

homebridge-prom-sensors

v0.1.0

Published

Expose Prometheus metrics as HomeKit sensors

Readme

homebridge-prom-sensors

A Homebridge plugin that exposes Prometheus metrics as HomeKit sensors.

Features

  • Query any Prometheus metric using PromQL
  • Support for multiple HomeKit sensor types
  • Configurable polling intervals
  • Threshold-based binary sensors
  • Full Homebridge Config UI X support

Supported Sensor Types

| Type | HomeKit Service | Use Case | |------|-----------------|----------| | temperature | Temperature Sensor | Server temps, room temps, device temps | | humidity | Humidity Sensor | Environment humidity | | battery | Battery Service | UPS charge, device batteries | | contact | Contact Sensor | Service up/down, binary states | | motion | Motion Sensor | Alert thresholds (CPU > 80%) | | leak | Leak Sensor | Water/leak detection alerts | | light | Light Sensor | Ambient light levels (lux) | | occupancy | Occupancy Sensor | Presence detection |

Installation

npm install -g homebridge-prom-sensors

Or search for "prometheus" in the Homebridge Config UI X plugin browser.

Configuration

Add to your Homebridge config.json:

{
  "platforms": [
    {
      "platform": "PrometheusMetrics",
      "name": "Prometheus",
      "prometheusUrl": "http://192.168.1.100:9090",
      "defaultPollingInterval": 30,
      "sensors": [
        {
          "name": "Anker Battery",
          "query": "anker_battery_soc_percent",
          "type": "battery",
          "lowThreshold": 20
        },
        {
          "name": "Anker Temperature",
          "query": "anker_temperature_celsius",
          "type": "temperature"
        },
        {
          "name": "Server Online",
          "query": "up{job=\"node\"}",
          "type": "contact",
          "threshold": 1
        }
      ]
    }
  ]
}

Sensor Configuration

| Option | Required | Default | Description | |--------|----------|---------|-------------| | name | Yes | - | Display name in HomeKit | | query | Yes | - | PromQL query (must return single value) | | type | Yes | - | Sensor type (see supported types above) | | pollingInterval | No | 30 | Seconds between queries | | threshold | No | 0.5 | For binary sensors: value >= threshold = triggered | | lowThreshold | No | 20 | For battery: level below this = low battery warning |

Examples

Monitor a UPS battery

{
  "name": "UPS Battery",
  "query": "apcupsd_battery_charge_percent",
  "type": "battery",
  "lowThreshold": 30
}

Alert when CPU is high

{
  "name": "High CPU Alert",
  "query": "100 - (avg(rate(node_cpu_seconds_total{mode=\"idle\"}[5m])) * 100)",
  "type": "motion",
  "threshold": 80,
  "pollingInterval": 60
}

Monitor service availability

{
  "name": "Web Server",
  "query": "up{job=\"webserver\"}",
  "type": "contact",
  "threshold": 1,
  "pollingInterval": 10
}

Room temperature from multiple sensors

{
  "name": "Living Room Temp",
  "query": "avg(temperature_celsius{room=\"living_room\"})",
  "type": "temperature"
}

Development

# Clone the repo
git clone https://github.com/yourusername/homebridge-prom-sensors
cd homebridge-prom-sensors

# Install dependencies
npm install

# Build
npm run build

# Link for local development
npm link

# In your Homebridge directory
npm link homebridge-prom-sensors

License

MIT