mib

miband

MiBand 2 JS library for Node.JS and HTML5 (WebBluetooth)

Showing:

Popularity

Downloads/wk

9

GitHub Stars

305

Maintenance

Last Commit

3yrs ago

Contributors

1

Package

Dependencies

2

Size (min+gzip)

20.6KB

License

GPL-3.0

Type Definitions

Tree-Shakeable

No?

Categories

Readme

NPM version NPM download GitHub issues GitHub license

Mi Band 2 JS library

A clean implementation of Mi Band 2 library for Browsers and Node.js, using WebBluetooth API. demo

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

LIVE DEMO

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-features flag must be enabled)

Node.js

npm install miband -g
miband-test

This 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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100