node.js lib for the Chipolo
npm install chipolo
var Chipolo = require('chipolo');
Discover
Chipolo.discover(callback(chipolo));
Color:
var color = chipolo.color;
Connect
chipolo.connect(callback);
Disconnect
chipolo.disconnect(callback);
Discover Services and Characteristics
chipolo.discoverServicesAndCharacteristics(callback);
Pair
Make sure Chipolo is not "paired" with other device first. Otherwise success
will always return false
.
chipolo.pair(callback(success)); // success: true | false
Device Info
chipolo.readModelNumber(callback(modelNumber));
chipolo.readSerialNumber(callback(serialNumber));
chipolo.readFirmwareRevision(callback(firmwareRevision));
chipolo.readHardwareRevision(callback(hardwareRevision));
chipolo.readSoftwareRevision(callback(softwareRevision));
chipolo.readManufacturerName(callback(manufacturerName));
Temperature_
chipolo.readTemperature(callback(temperature)); // temperature in °C
Battery
chipolo.readIsBatteryLow(callback(isBatteryLow)); // isBatteryLow: true | false
Audio notifications
// inRange, outOfRange, shakeAndFind: true | false
chipolo.setAudioNotifications(inRange, outOfRange, shakeAndFind, callback);
Beep
chipolo.beep(callback);
Distance
chipolo.estimateDistance(callback(estimatedDistance));
Disconnect
chipolo.on('disconnect', callback);