Playing around with the Mi Band 2 and Linux.
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
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 --userWe're good to go!
On the first run, you need to init your device with a new key:
miband2.py YOUR_MAC --initNow you can run some samples:
miband2.py YOUR_MAC --notify
miband2.py YOUR_MAC --heartList all visible BLE devices to find out the MAC address:
sudo hcitool lescanTo list all descriptors of a device:
sudo gatttool -b YOUR_MAC -I -t random
> connect
> char-descSometimes, BLE stack might fail, and the reset is needed:
sudo hciconfig hci0 reset