Giter Site home page Giter Site logo

chez14 / miband-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vshymanskyy/miband-js

0.0 1.0 0.0 666 KB

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

License: GNU General Public License v3.0

JavaScript 85.82% HTML 6.32% CSS 7.86%

miband-js's Introduction

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

miband-js's People

Contributors

vshymanskyy avatar dnbard avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.