It has been quite a while when I use Mi band, a wonderful and inteligent sensor at remarkably acceptable price. The sensor records sleep and step data everyday, and I am quite curious about visualizing the large set of data.
Mi band does not provide api now, which I think is not a smart step towards larger success of the company, so getting the data becomes difficult.
But in Android platform, everything is managable.
I locate the app database storage file, which is in
It seems quite obvious that it is a sqlite database.
The table "date_data" stores all the data I need.
Soon, I copied the data out and uploaded the database in my database in this website and wrote an api myself.
And with the help of Chart and Highchart, the result:
Fig 1. Sleep duration and deep sleep duration
Fig 2. Sleep time and Wake time
Fig 3. Step in a day
Some abnormal dots are easy to recall. The peak in fig.1 and the left large dot in fig. 2 is the first time I worked over night for the mathematical model contest , I slepted for 13 hours that night....In fig. 3 the period of higher number of steps happens to be the days when I went travelling, easily walking more than 10000 steps a day.
Here is the link to view these figures:
There is another problem when I receiving data like this. Each time I have to copy the database and upload to the web mannually, which is quite troublesome, so I wrote an app to do the upload. I soon found the database is in 660 mode, which is not permitted to be viewed by another app. It seems only by elevating the permission of my app to root can I access the database. It is very difficult to do get root permission, by in xiaomi, the root permission is controlled by system and available to my app. Using such app, data is able to upload with much convenience.
The number of sleep duration, wake time and steps each day is also available to Module Profile with api.