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 🙏

© 2024 – Pkg Stats / Ryan Hefner

wled

v1.1.0

Published

npm package for controlling wled lights easily.

Downloads

24

Readme

wled

npm package for controlling wled lights easily.

const { WLED, Preset } = require("wled");

// New WLED instance
const myLamp = new WLED("ip_adress");

// New preset instance
const myPreset = new Preset({presetJsonFromWledPanel})

// Get state from lamp
myLamp.getState().then(data => { console.log(data) });

// Get info from lamp (true -> return raw data, false -> return reorganized data (default false))
myLamp.getInfo(true).then(data => { console.log(data) });

// Get effects list from lamp
myLamp.getEffects().then(data => { console.log(data) });

// Get palettes list from lamp
myLamp.getPalettes().then(data => { console.log(data) });

// Turn lamp on
myLamp.setOn(true);

// Check if lamp is on
myLamp.isOn().then(data => { console.log(data) });

// Set brightness to 128
myLamp.setBrightness(128);

// Returns current brightness
myLamp.getBrightness().then(data => { console.log(data) });

// Set transition duration to 700ms
myLamp.setTransitionDuration(7);

// Get transition duration
myLamp.getTransitionDuration().then(data => { console.log(data) });

// Set current preset to id 3
myLamp.setActivePreset(3);

// Get current preset id
myLamp.getActivePreset().then(data => { console.log(data) });

// Save current state to preset id 3
myLamp.savePreset(3);

// Play playlist
myLamp.setPlaylistPlay(true);

// Check if playlist is playing
myLamp.isPlaylistPlay().then(data => { console.log(data) });

// Set nightlight on
myLamp.setNightlightOn(true);

// Check if nightlight is on
myLamp.isNightlightOn().then(data => { console.log(data) });

// Set nightlight duration to 7 minutes
myLamp.setNightlightDuration(7)

// Get nightlight duration
myLamp.getNightlightDuration().then(data => { console.log(data) });

// Set nightlight mode (instant, fade, color_fade, sunrise)
myLamp.setNightlightMode("fade");

// Get nightlight mode (name -> return name, id -> return id)
myLamp.getNightlightMode("name").then(data => { console.log(data) });

// Set nightlight brightness
myLamp.setNightlightBrightness(128);

// Get nightlight brightness
myLamp.getNightlightBrightness().then(data => { console.log(data) });

// lamp reboot
myLamp.restart();

// Set lamp color
myLamp.setColor([255,0,0]);
myLamp.setColor([255,0,0], [0,255,0]);
myLamp.setColor([255,0,0], [0,255,0], [0,0,255]);

// Set chosen leds color
myLamp.setLedColor([2,[255,0,0]]) // Led 2 to red
myLamp.setLedColor([2,5,[255,0,0]]) // Leds between 2 and 5 to red

// Starts new playlist
myLamp.setPlaylist(presetsIds, durations, transistionTimes, repeat, end );

// Set saved Preset to current state
myLamp.setPreset(myPreset);

// Create new Preset from current state
myLamp.createPreset().then(data => { console.log(data) });

// Set effect
myLamp.setEffect(id);
myLamp.setEffect(~); // Effect 1 up
myLamp.setEffect(~-); // Effect 1 down
myLamp.setEffect("r"); // Random effect

// Set effect speed
myLamp.setEffectSpeed(128);

// Set effect intensity
myLamp.setEffectIntensity(128);

// Set palette
myLamp.setPalette(id);
myLamp.setPalette(~); // Palette 1 up
myLamp.setPalette(~-); // Palette 1 down
myLamp.setPalette("r"); // Random palette

// Custom api calls
myLamp.exec({"message": "hello world"});