bluetooth-bulb

0.0.3 • Public • Published

node-bluetooth-bulb

A node.js library for the BlueClick Bluetooth Bulb

Special thanks to @mrose17 for sending me a bulb!

Notes:

  • currently only works on Linux, due to the follow issues with CoreBluetooth on OS X:
    • bulb disconnects during characteristic discover
    • cannot write to hande without response

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 key 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(key, callback); // key must be 0 - 255

Get Brightness

// value range is: 0 - 125

bluetoothBulb.getGreenBrightness(callback(value));

bluetoothBulb.getRedBrightness(callback(value));

bluetoothBulb.getWhiteBrightness(callback(value));

bluetoothBulb.getBlueBrightness(callback(value));

Set Brightness

// value range is: 0 - 125

bluetoothBulb.setGreenBrightness(value, callback);

bluetoothBulb.setRedBrightness(value, callback);

bluetoothBulb.setWhiteBrightness(value, callback);

bluetoothBulb.setBlueBrightness(value, callback);

Get Friendly Name

bluetoothBulb.getFriendlyName(callback(friendlyName));

Get Pair Counter

// how many pair keys are there

bluetoothBulb.getPairCounter(callback(pairCounter));

Disconnect Workaround

// no-op, keeps connection alive

bluetoothBulb.disconnectWorkaround(callback);

Get Bulb State

// get the current state of the bulb

bluetoothBulb.getBulbState(callback(bulbState));

Remove Pairs

// Remove all pair keys from the bulb (will need to set a new pair key after operation)

bluetoothBulb.removePairs(callback);

Get Device Name

bluetoothBulb.getDeviceName(callback(deviceName));

Get Model Number

bluetoothBulb.getModelNumber(callback(modelNumber));

Get Firmware Revision

bluetoothBulb.getFirmwareRevision(callback(firmwareRevision));

Get Hardware Revision

bluetoothBulb.getHardwareRevision(callback(hardwareRevision));

Get Manufacturer Name

bluetoothBulb.getManufacturerName(callback(manufacturerName));

Readme

Keywords

none

Package Sidebar

Install

npm i bluetooth-bulb

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • sandeepmistry