0.0.3 • Published 11 years ago

bluetooth-bulb v0.0.3

Weekly downloads
3
License
-
Repository
github
Last release
11 years ago

node-bluetooth-bulb

A node.js library for the blue bulb Bluetooth Bulb

Special thanks to @mrose17 for sending me a bulb!

Notes:

  • the module is very unstable, the Bluetooth Bulb has very picky timing
  • currently only works on Linux, due to timing issues with CoreBluetooth on OS X (bulb disconnects during characteristic discover)

Install

npm install bluetooth-bulb

Usage

var BlueoothBulb = require('bluetooth-bulb');

Discover

BlueoothBulb.discover(callback(bluetoothBulb));

Connect

bluetoothBulb.connect(callback);

Disconnect

bluetoothBulb.disconnect(callback);

Pair

// If pair code has not been set previously, it must be set within 10s of powering the bulb.
// Otherwise, pair must be called, immediately after connect (otherwise the bulb will terminate the connection)

bluetoothBulb.pair(code, callback); // code must be 0 - 255

Get Lights

// value range is: 0 - 125

bluetoothBulb.getGreen(callback(value));

bluetoothBulb.getRed(callback(value));

bluetoothBulb.getWhite(callback(value));

bluetoothBulb.getBlue(callback(value));

Set Lights

// value range is: 0 - 125

bluetoothBulb.setGreen(value, callback);

bluetoothBulb.setRed(value, callback);

bluetoothBulb.setWhite(value, callback);

bluetoothBulb.setBlue(value, callback);

Get Name

bbluetoothBulb.getName(callback(name));

Has Paired

// is the bulb paired with any devices (pair codes stored)

bluetoothBulb.hasPaired(callback(hasPaired));

Keep Alive

// no-op, keeps connection alive

bluetoothBulb.keepAlive(callback);

Is Paired

// is the bulb pair now (current connection)

bluetoothBulb.isPaired(callback(isPaired));

Unpair

// remove the current pair code from the bulb (will need to set a new pair code after operation)

bluetoothBulb.unpair(callback);
0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago