Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A node.js library for the BluetoothBulb

branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

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));
Something went wrong with that request. Please try again.