Package Exports
- miband
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (miband) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Mi Band 2 JS library
A clean implementation of Mi Band 2 library for Browsers and Node.js, using WebBluetooth API.

Setting up
It's best to unbind your Mi Band 2 from MiFit App first.
You should be able to bind it back again, but no guaranee here ;)
Browser
You need a browser with WebBluetooth support. Tested with:
- Chrome on OS X (Yosemite or later)
- Chrome on Android (6.0 Marshmallow or later)
- Chrome on Linux (the
chrome://flags/#enable-experimental-web-platform-featuresflag must be enabled)
Node.js
npm install miband -g
miband-testThis should work on Windows, Linux and OSX.
On Linux, you need to grant Bluetooth access for Node.js:
sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)Features
- Authentication
- Device info: time, battery status, hw/sw versions, etc.
- Button tap event
- Notifications: message, phone, vibrate
- Heart Rate Monitor
- Realtime data (soon)
API usage example
const MiBand = require('miband');
const device = await bluetooth.requestDevice({
filters: [
{ services: [ MiBand.advertisementService ] }
],
optionalServices: MiBand.optionalServices
});
const server = await device.gatt.connect();
let miband = new MiBand(server);
await miband.init();
log('Notifications demo...')
await miband.showNotification('message');Here you can find more API examples
Contributing
Please check out DEVELOPMENT.md
