misfit-bolt
Misfit Bolt Javascript Interface
Thin wrapper on the top of sandeepmistry/noble, that discovers Misfit Bolt bulbs, and allows turning them on/off and changing their color, as well as reading their currently set color.
Prerequisites
To connect to the Misfit Bolt, you need BLE capabilities.
See sandeepmistry/noble prerequisites for more details.
Setup
npm install
Test
npm test
API
Discover
Bolt.discover(callback(bolt));
Connect
bolt.connect(callback);
On
bolt.on();
Off
bolt.off();
Set
bolt.set("228,41,15,10");
SetRGBA
bolt.setRGBA(228,41,15,10);
Get
bolt.get(callback(currentValue));
GetRGBA
bolt.get(callback(currentRGBAValue));
Example
Bolt.discover(function(bolt) {
bolt.connect(function() {
var i = 0,
colors = [[228,41,15,10],
[216,62,36,10],
[205,55,56,10],
[211,27,76,10],
[166,18,97,10]];
setInterval(function(){
var color = colors[i++ % colors.length];
bolt.setRGBA.apply(bolt, color);
}, 500);
});
});
Notes
Inspired by fayep's Python implementation