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

@bfforward/wled-client

v1.1.5

Published

This package is a work in progress, and not yet complete. The README will be updated when it is ready for use.

Downloads

25

Readme

@bfforward/wled-client

npm version License: MIT

A TypeScript client for interacting with WLED devices via their JSON API.

Installation

npm install @bfforward/wled-client
# or
yarn add @bfforward/wled-client

Usage

import WLEDClient from "@bfforward/wled-client";

// Initialize the client
const wled = new WLEDClient({
  baseUrl: "YOUR_WLED_IP_OR_HOSTNAME", // e.g., '192.168.1.100'
  // port: 80, // Optional, defaults to 80
  // ssl: false, // Optional, defaults to false
});

async function main() {
  try {
    // Connect and fetch initial data
    await wled.connect();
    console.log("Connected to WLED:", wled.info?.name);
    console.log("Current state:", wled.state);

    // Listen for changes
    wled.on("statusChange", () => {
      console.log("Client status changed:", wled.status);
    });

    wled.on("stateChange", () => {
      console.log("WLED state changed:", wled.state);
    });

    wled.on("infoChange", () => {
      console.log("WLED info changed:", wled.info);
    });

    // Example: Turn the light on
    await wled.setState({ on: true, bri: 128 });
    console.log("Light turned on");

    // Example: Get effects list
    const effects = wled.effects; // Already fetched on connect/getAll
    // Or fetch manually: await wled.getEffects();
    console.log("Available effects:", effects);

    // Disconnect when done (optional, client doesn't maintain a persistent connection)
    await wled.disconnect();
    console.log("Client disconnected");
  } catch (error) {
    console.error("Error interacting with WLED:", error);
  }
}

main();

API

The WLEDClient class provides methods to interact with the WLED JSON API.

Connection:

  • connect(): Establishes connection and fetches all initial data (info, state, effects, palettes). Emits statusChange.
  • disconnect(): Sets the client status to disconnected. Emits statusChange.
  • status: Getter property for the current client status (disconnected, connected, failed).

Data Fetching/Updating:

  • getAll(): Fetches all data (info, state, effects, palettes) and updates the respective properties. Emits infoChange, stateChange, effectsChange, palettesChange.
  • getInfo(): Fetches device information. Updates info. Emits infoChange.
  • getState(): Fetches the current device state. Updates state. Emits stateChange.
  • getEffects(): Fetches the list of effects. Updates effects. Emits effectsChange.
  • getPalettes(): Fetches the list of palettes. Updates palettes. Emits palettesChange.
  • setState(newState: WLEDUpdatableState): Sends commands to update the WLED state.
  • rename(newName: string): Renames the WLED device. Fetches updated info afterwards.

Properties:

  • info: Stores the latest WLEDInfo.
  • state: Stores the latest WLEDState.
  • effects: Stores the list of WLEDEffects.
  • palettes: Stores the list of WLEDPalettes.

Events:

The client is an EventEmitter and emits the following events:

  • statusChange: When the client connection status changes.
  • infoChange: When the info property is updated.
  • stateChange: When the state property is updated.
  • effectsChange: When the effects property is updated.
  • palettesChange: When the palettes property is updated.

(For detailed type information, please refer to the source code or generated documentation.)

Development

  • Build: npm run build (Compiles TypeScript to JavaScript in dist/)
  • Test: npm run test
  • Generate Docs: npm run docs (Generates TypeDoc documentation in docs/)

Contributing

Issues and pull requests are welcome. Please refer to the GitHub repository.

License

This project is licensed under the MIT License - see the LICENSE file for details (Note: LICENSE file needs to be created if one doesn't exist).