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

nanoleaves

v1.2.0

Published

An API client & command-line tool for the Nanoleaf Aurora light.

Downloads

22

Readme

nanoleaves

A command-line tool for interacting with your Nanoleaf Aurora. Also includes a full API client for the Aurora!

Build Status Coverage Status on npm

CLI usage

Provide the IP address of your Aurora in the environment variable AURORA_HOST and your API access token in AURORA_TOKEN. If your AURORA is listening on an unusual port, use AURORA_PORT.

To generate a token, hold the power key until the light starts flashing, then run nanoleaves token.

$ nanoleaves --help
Commands:
  animation <name>          get details about the given animation effect
  brightness [number]       get or set the overall brightness
  effect [name]             get or set the current effect
  effects                   list available effects
  hsb <hue> <sat> <bright>  set the hue, sat, and brightness for all panels
  hue [number]              get or set the hue for all panels
  info                      get all available info about your Aurora
  layout                    show the panel layout
  mode                      get the current color mode for the Aurora
  off                       turn your Aurora off
  on                        turn your Aurora on
  panels                    show the panel ids
  random                    run a randomly-chosen effect
  saturation [number]       get or set the overall saturation
  temp [number]             get or set the overall color temperature
  token                     generate a new API access token
  upload <filename>         upload a json file containing a new animation effect

Options:
  --version  Show version number                                       [boolean]
  --help     Show help                                                 [boolean]

API usage

const AuroraAPI = require('nanoleaves');
const aurora = new AuroraAPI({
    host: '10.0.0.2',
    token: 'your-api-token'
});

aurora.info().then(info =>
{
    console.log(info);
});

The constructor will default to the values in the above-mentioned environment variables if present.

All API functions return promises.

  • newToken() - generate a new API token
  • info() - return all info about the Aurora
  • identify() - flash panels
  • animation(name) - get detailed information about a specific animation effect
  • brightness() - get the brightness for all panels
  • setBrightness(v) - set the brightness for all panels; 0-100
  • effect() - get the name of the current effect
  • effects() - return a list of the names of all effects
  • setEffect(name) - set the active effect by name
  • hue() - get the hue for all panels
  • setHue(v) - set the hue for all panels; 0-360
  • layout() - get panel layout data
  • mode() - get the Aurora's current color mode
  • off() - turn the Aurora off
  • on() - turn the Aurora on
  • orientation() - get the global orientation; 0-360
  • saturation() - get the saturation for all panels
  • setSaturation(v) - set the saturation for all panels; 0-100
  • temperature() - get the color temperature for all panels
  • setTemperature(v) - set the color temperature for all panels; 1200-6500
  • addAnimation(json) - store a new animation effect on the Aurora
  • setStaticPanel(data) - set a panel or a list of panels to a static color; see below

Static panel structure

The setStaticPanel() function pokes a single color into a specific panel. It is only useful for single frame static displays. You can call this a couple of ways. This snippet sets panel id 100 to black:

const panel = { id: '100', r: 0,  g: 0,  b: 0 };
aurora.setStaticPanel(panel);

This code does the equivalent with a full panel object:

const Aurora = require('nanoleaves');

const aurora = new Aurora();
const panel = new Aurora.Panel('100');
panel.frames = [{ r: 0, g: 0, b: 0, w: 0, transition: 50}];

aurora.setStaticPanel(panel);

You can also send a list of panels to setStaticPanel():

const list = [
	{ id: 71, r: 255, g: 0, b: 0, transition: 50 },
	{ id: 26, r: 255, g: 51, b: 17, transition: 50 },
	{ id: 72, r: 255, g: 102, b: 68, transition: 50 },
	{ id: 167, r: 255, g: 153, b: 51, transition: 50 },
];
aurora.setStaticPanel(list);

There's an example of setting an entire static animation display in examples/static-display.js. Use nanoleaves panels to get a list of valid panel ids for your setup.

License

ISC