GeekSocket Plug in and be Geekified

Using Gadgetbridge and openScale Amazfit Bip

Around 6 months ago the wrist watch that I was using from last 11 years broke. It was not possible to get it repaired as company does not manufacture any parts of it now. I was looking for an alternative but didn’t like any other normal watches available. So I decided to buy Amazfit Bit by Huami. Huami is brand by Xiaomi. While I’m not really interested in the steps count, sleep count, I liked the design of the watch. So I decided to buy it. Though I always wanted to have something similar to Pebble, this watch has few interesting features and a long battery life.

About Amazfit Bip

The watch is not that big in size (~3.8 mm x ~3.3 mm). It has a ‘Reflective color display screen’, which is more brighter in sunlight. Bip comes with a Gorilla Glass. I get battery life of average 3 months. I don’t connect the watch to phone frequently (once or twice in a month). It does work of showing you the time really well. Sometimes I connect it when I’m walking or I’m away from phone, so that I don’t miss any important calls or notifications.

Amazfit Bip Product page

Connecting watch to phone

When I bought Bip, I decided not to connect the watch to official Mi Fit application. The device has a lot of data like number of steps, heart rate, sleep patterns and this watch even has GPS, Barometer and compass. Mi Fit application stores all this data to their servers. I wanted my data to be saved offline in the phone itself. Three years ago, I had Mi band 1A paired with Mi Fit application. I found the app called Gadgetbridge later when the band stopped working. So I decided to use Gadgetbridge to pair Bip with my phone. Later we will see how I exported data from Mi Fit application.

Gadgetbridge

Gadgetbridge does not have permission to connect to internet. The community around the application is really nice. They have IRC channel #gadgetbridge. Also the wiki pages have detailed information for all the supported devices and features. People try to hack on different devices and keep adding support for new devices to the application. It shows you steps, sleep count, heart rate data. You can set alarms, sync weather with the watch (using an external plugin). Basically it has almost all the features which Mi Fit provides.

Gadgetbridge on F-Droid

Gadgetbridge interface

Updating the watch firmware

As I decided not connect the watch to Mi Fit at all, I used Gadgetbridge to update the device firmware. The wiki page provides list of tested firmware files, their hash and versions. Also the application itself has a list of tested firmwares. So even if you don’t see the version listed on wiki and you try to flash a firmware file, it will show you warning if it’s a untested one.

Amazfit Bip Firmware Update wiki page

Every watch/band by Xiaomi has a code name and the firmware file names contain that code name. These files are under apk file of Mi Fit. Amazfit Bip has name chaohu and the files will have name Mili_chaohu.*

1. Extract the firmware files from the apk

You can download the Mi Fit apk file from this link. If you have the application installed in your phone, follow the instructions below.

Install X-plore, on the right side go to App manager panel, find Mi Fit and long tap on it. Then click on ‘Open as ZIP’. Go to assets folder and copy the files Mili_chaohu.fw, Mili_chaohu.res, Mili_chaohu.gps and Mili_chaohu.ft to a new folder.

  • Mili_chaohu.fw: Firmware file
  • Mili_chaohu.res: Resources file (it has watch faces etc)
  • Mili_chaohu.gps: GPS related data
  • Mili_chaohu.ft/Mili_chaohu.ft.latin: File which has fonts

2. Installing the files on device

Make sure your device has charging more than 50% or just plug it in for charging. Click on the *.fw file copied in step 1, if that opens up ‘Open as’ dialog box click on the */*.

If it does not open ‘Open as’ box and starts some other application, just close that application, long tap on file and select ‘Open by…’ -> ‘Open as’.

Now select ‘Open with FW/App installer’. This will open the file in Gadgetbridge’s FW installer. Read the details carefully and proceed.

This process may take some time don’t try to turn off Bluetooth. Keep the device near to your phone.

Once device is restarted it will ask to connect the phone. This only happens if you have old resources version on your device. Similar to *.fw file open *.res file and install it. When the flashing is done you can install *.gps file in same way.

You will have to repeat 1 and 2 when there is new update. Checking for FW updates once in 2 or 3 months if fine.

openScale

While I was using Gadgetbridge to connect my device with phone, I was still using Mi Fit application to log my weight. I don’t have any smart scale but I was manually entering my weight in the application. While searching for something on F-Droid I found the application called openScale.

All I require is the graph of my weight and BMI, so this application is something which suites my needs. It can also connect with different weighing scales. openScale also stores all the data locally.

Only thing now I wanted was to find some way to import my weight readings from Mi Fit to openScale. openScale can import CSV files.

openScale on F-Droid

Exporting all the data from Mi Fit

As I said, Mi Fit stores all the data to their servers. While searching about way to export data I found that there is a section in the application where you can request archive of all of your data (Reference). This section can also be accessed from web. Let’s export the data.

If you have the application installed, Go to ‘Profile’ -> ‘Settings’ -> ‘About’ -> ‘Exercising user rights’ (the last option). You can also open this URL in the browser and follow the instructions given there. Login with you Mi account which you used to login with the Mi Fit application. You can give same mail address you used while signing up for the service when asked at the end.

After doing this, I received link to a zip file. It was an encrypted file. Running unzip over it failed with Compression method 99 error. The zip was encrypted using AES encryption which is not supported by unzip. Solution is to use 7zip to extract the zip file. You can read more about the error here and here

On Fedora it can be installed with sudo dnf install p7zip. To extract the zip file run the following command.

$ 7za x -p<password> <name_of_file>.zip 

And I had a folder with all my data of past 2 years when I had Mi Band 1A. It has all the sleep details, steps per day in CSV format.

Importing the weight data to openScale

The weight related data is under BODY directory in exported data of Mi Fit. The CSV format which openScale supports is a bit different. Also it does not record height in every entry [#340]. To convert the data from Mi Fit format to openScale compatible CSV, I wrote a small Go code.

https://gitlab.com/bhavin192/mftoos

Once the data is converted it can be imported by going to ‘More options’ which is in top right corner and then ‘Import’.

Note: the exported data from Mi Fit does not have information about the user in every entry, so the only way to filter the entries of different users is based on height.

openScale interface

References


Comments

comments powered by Disqus