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

wiz-light-core

v5.2.0

Published

Local WiZ light engine: protocol, discovery, colour math, and persisted state. Zero runtime dependencies.

Readme

wiz-light-core

The engine behind WiZ Light Controller: a small, dependency-free JavaScript library for controlling Philips WiZ smart bulbs over the LAN (UDP, port 38899) — no cloud, no account. It has zero runtime dependencies (Node built-ins only) and is the single, tested implementation shared by the wiz CLI and the native macOS app.

Install

pnpm add wiz-light-core

Requires Node 24+. ESM-only ("type": "module").

What's inside

  • protocol.js — the UDP transport. sendPilot (fire-and-forget setPilot), queryPilot (getPilot, resolving to the bulb's state or null on timeout — it never rejects), and the stateful WizLight controller, which debounces rapid updates (slider drags) into one send and retries it to ride out UDP loss and firmware micro-sleeps. The socket factory is injectable, so the protocol is testable without real sockets.
  • discovery.jsdiscover() broadcasts getSystemConfig and resolves the set of bulbs on the LAN, deduplicated by MAC. Supports an onFound callback, an AbortSignal, and an injectable socket.
  • color.js — pure colour maths: rgbToHsv / hsvToRgb, rgbToHex / hexToRgb, kelvinToRgb, and colour-wheel geometry (wheelToHS / hsToWheel).
  • validate.js — input guards and clamps: isValidIp, isValidHex, normalizeHex, formatMac, clampBrightness, clampTemp, clampRgb, and toDimming (the firmware-valid dimming >= 10 floor).
  • model.js — the logical LightState and its translation to/from the wire format (parsePilot / buildSetPilotParams), per-device capability parsing from getModelConfig (deviceBoundsFromConfig, describeDevice, dimToWarmCurveFromConfig), the Warm-Glow curve (warmGlowKelvin), and presets.
  • stores — corruption-tolerant, atomic JSON persistence (settings, presets, saved lights, last state), wired to one directory by createStores(dir).

The pure, browser-safe modules are also published as subpath exports — wiz-light-core/color, wiz-light-core/validate, wiz-light-core/model — so a UI layer can import the colour maths and the model without pulling in any Node built-ins.

Example

import { WizLight, discover } from 'wiz-light-core';

const bulbs = await discover(); // [{ ip, mac, moduleName }, …]
const light = new WizLight(bulbs[0].ip);

light.apply({ on: true, mode: 'rgb', rgb: [255, 0, 128], brightness: 80 });
const live = await light.getPilot(); // current state, or null if unreachable
light.close();

Tests

node --test        # from this package (or `pnpm test:core` from the repo root)