A command-line tool for interacting with your Nanoleaf Aurora. Also includes a full API client for the Aurora!
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]
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 tokeninfo()
- return all info about the Auroraidentify()
- flash panelsanimation(name)
- get detailed information about a specific animation effectbrightness()
- get the brightness for all panelssetBrightness(v)
- set the brightness for all panels; 0-100effect()
- get the name of the current effecteffects()
- return a list of the names of all effectssetEffect(name)
- set the active effect by namehue()
- get the hue for all panelssetHue(v)
- set the hue for all panels; 0-360layout()
- get panel layout datamode()
- get the Aurora's current color modeoff()
- turn the Aurora offon()
- turn the Aurora onorientation()
- get the global orientation; 0-360saturation()
- get the saturation for all panelssetSaturation(v)
- set the saturation for all panels; 0-100temperature()
- get the color temperature for all panelssetTemperature(v)
- set the color temperature for all panels; 1200-6500addAnimation(json)
- store a new animation effect on the AurorasetStaticPanel(data)
- set a panel or a list of panels to a static color; see below
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.
ISC