lumen

node.js lib for the Tabu Lumen

node-lumen

node.js lib for the Tabu Lumen

npm install lumen

var Lumen = require('lumen');

Discover

Lumen.discover(callback(lumen));

Connect

lumen.connect(callback);

Disconnect

lumen.disconnect(callback);

Discover Services and Characteristics

Run after connect.

lumen.discoverServicesAndCharacteristics(callback);

Setup

Run after discover services and characteristics.

lumen.setup(callback);

Device Info

lumen.readDeviceName(callback(deviceName));

lumen.readSystemId(callback(systemId));

lumen.readSerialNumber(callback(serialNumber));

lumen.readModelNumber(callback(modelNumber));

lumen.readFirmwareRevision(callback(firmwareRevision));

lumen.readHardwareRevision(callback(hardwareRevision));

lumen.readSoftwareRevision(callback(softwareRevision));

lumen.readManufacturerName(callback(manufacturerName));

Battery Level

// batteryLevel range is 0 - 100
lumen.readBatteryLevel(callback(batteryLevel));

Turn off/on

lumen.turnOff(callback);

lumen.turnOn(callback);

Set modes

lumen.coolMode(callback); // cycles cool colors

lumen.warmMode(callback); // cycles warm colors

lumen.disco2Mode(callback); // cycles RGB quickly

lumen.disco1Mode(callback); // cycles RGB slowly

lumen.normalMode(callback);

Warm White

// Closest percentage to is used:
//   0, 30, 50, 70, 90, 100

var percentage = 100;

lumen.warmWhite(percentage, callback);

Color

var cyan    = 1.0; // 0.0 -> 100.0
var magenta = 0.0; // 0.0 -> 100.0
var yellow  = 1.0; // 0.0 -> 100.0
var white   = 0.0; // 0.0 -> 100.0

lumen.color(cyan, magenta, yellow, white, callback);

State

lumen.readState(callback(state));

State structure:

{
    on: true | false,

    mode: 'unknown' | 'normal' | 'cool' | 'warm' | 'disco1' | 'disco2' | 'warmWhite' | 'color',

    // if mode is 'warmWhite'
    warmWhitePercentage: 'unknown' | 100 | 90 | 70 | 50 | 30 | 0,

    // if mode is 'color'
    colorC: 0.0 - 1.0,
    colorM: 0.0 - 1.0,
    colorY: 0.0 - 1.0,
    colorW: 0.0 - 1.0
}

Connect

lumen.on('connect', callback);

Disconnect

lumen.on('disconnect', callback);