Skip to content

vshymanskyy/miband2-python-test

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Mi Band 2 python test

Playing around with the Mi Band 2 and Linux.

demo

Note: This is a fixed and improved version of a sample script, provided by Leo Soares.
He also wrote a nice article here: Mi Band 2, Part 1: Authentication

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 ;)

Next, install Python 2 or Python 3 and the bluepy library:

pip install bluepy --user

We're good to go!
On the first run, you need to init your device with a new key:

miband2.py YOUR_MAC --init

Now you can run some samples:

miband2.py YOUR_MAC --notify
miband2.py YOUR_MAC --heart

Cheatsheet

List all visible BLE devices to find out the MAC address:

sudo hcitool lescan

To list all descriptors of a device:

sudo gatttool -b YOUR_MAC -I -t random
> connect
> char-desc

Sometimes, BLE stack might fail, and the reset is needed:

sudo hciconfig hci0 reset

About

Playing around with the Mi Band 2 and Linux

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%