yashsingh1/xdaforums huggingface dataset:
[General Accessories] Bonoboo:
Performing action in Tasker at alarm (when you awake)

Aso check other useful additions for Mi Band

Important!

This is no longer works due changes in Mi Fit app.

Guaranteed working at least on ancient 1.4.341 which support only band with color LED.

And there is dedicated profile for playing sound on phone when alarm on the bracelet

What is this

We can't get info from bracelet that you awake, but we can know that alarm ringing (both types).

So can assume that you actually awaking.

This profile is more actual when using smart alarm – the wake-up time is inaccurate.

For example, the vibration of the bracelet can be supplemented by ringtone to sure to wake up or turn on your PC.

How it works and important information

1. To cover different alarm time at 4:00 monitoring task will start

> Because there's no sense to keep the cycle all the time

> You can run it in before night by your own way, e.g. if airplane mode enabled

2. Debug log file cleared (/sdcard/mili_log.txt)

3. If Bluetooth turned off – it's turning on (important if phone in flight mode)

Further steps performing in loop every minute

This is NOT really affects battery

After 9 hours task running in flight mode phone was awake 10 minutes, it is 2% of the all time and no one percent of battery.

4. Contents of the log reads into variable %log

5. There searching text onDeviceStatusChanged:16 or 17 (smart and normal alarm)

6. If text found, i.e, local variable %wake1 contains it – vibrate and cycle stop

> This action needs to be replaced by yours: play a sound, turn off the airplane mode – all you need to do after wake up in the morning

7. If text not found: wait 1 minute and again check the log

Installation

0. For additional alarm better use this

1. Download profile below post

2. File from ZIP copy to /sdcard/Tasker/profiles

3. Tasker > tap on the tab Profiles > Import > Mi_Band_Wake_Action

4. Replace action 7 for your own and correct monitoring start time
[General Accessories] captkronos:
I'm experiencing the same. I noticed it first when using MiBand_1.2.631_331_en but it may have been present in earlier versions. The bug is still present in MiBand_1.2.663_338_en which I installed today. BetterBatteryStats shows there is Bluetooth related Kernel Wakelock, BT-bt-wake, which looks to be the cause of my phone not sleeping. Hopefully it can be addressed in a future version. I too use it mainly for the unlock feature.
[General Accessories] woofgoo:
Sleep Cycle Alarm

Is it support that? (sleep cycle alarm or sleep as android)
[General Accessories] leemarkin:
I am a new mi-band user but I don't want to use mi-band app, it is from China and probably will censor its users....

Is there any third parties app I can use?

I just need to use the unlock feature, btw.
[General Accessories] Ofthecats:
I work the night shift here in eastern time zone, and it recognizes when I sleep during the day.

However, I slept 4 hours and I detected it today, but didn't detect the 4 hours I slept later in the day.

It seems the band doesn't recognize mixed sleep patterns.

Also, i think steps are inaccurate. Not sure by how much, but counts steps for activities such as brushing teeth.

I think necklace mode may find that though.

Last, I'm using non-notify version and battery drain is minimal both ways. Just unlock feature and vibrate for calls.

Impressive.
[General Accessories] pgptheoriginal:
I can't understand... Which kind of censorship could be in an app? Maybe you're worried about privacy, but your account isn't linked to your name or other personal data ;)

BTW, I think there aren't any 3rd party apps for the Mi Band.

Sent from my Nexus 5

---------- Post added at 07:52 AM ---------- Previous post was at 07:41 AM ----------

I believe sleep recognition is detected by movements, but is also linked to the usual day and night time, so night shift could heavily affect accuracy.

And yes, some kinds of activity are accounted as steps. I'd recommend not to wear your band on the hand you use most. The necklace mode could be a solution but the sensor is a bit too bulky for that IMHO.

Sent from my Nexus 5
[General Accessories] Ofthecats:
Of course sleep is determined by movements. I think there are some fairly sophisticated filters for the data to determine what is sleep and what is not, which probably takes place in the app.

Maybe certain patterns of movement that may indicate a resting state, along with a change in general orientation to indicate laying down.

My question was that since it is fairly accurate at tracking sleep behavior, why did it seem to fail detecting mixed patterns such as two 4 hour periods of sleep? They may have assumed in programming the data filters that everyone sleeps in one lump of time.

I'm also OK with its step count inaccuracies.
[General Accessories] darren1:
I haven't got my Mi Band yet so haven't tried these myself.

OpenBand

https://play.google.com/store/apps/details?id=com.ugopiemontese.openband

Mi Band Notifier

http://xdaforums.com/android/apps-games/app-xiaomi-mi-band-notifier-t2998864
[General Accessories] Ofthecats:
http://en.miui.com/forum.php?mod=viewthread&tid=53761

There are two customized versions of the official app there. One has notification features
[General Accessories] darren1:
I think these two apps are third party apps written from scratch, they have reverse engineered the Mi Band to phone connection.
[General Accessories] viscmad:
:confused::confused: Same problem... makes this feature unusable for me :rolleyes: :(
[General Accessories] slekkas:
This would be a great feature only if the phone stayed unlocked for 10 centimeters. Practically only when the phone is in my hand. Otherwise it's unusable.
[General Accessories] griffin_1:
I don't know how that feature hasn't been implemented for Android that way, only when the Bluetooth device is next to phone. And it's not like it's impossible, xiaomi did it in their miui rom and the miband, it only unlocks when the bracelet is really close to the phone. I really wish there as a mod to use it like that in other phones
[General Accessories] stavrinho:
http://www.xda-developers.com/smart-unlock-your-phone-xda-app-review/

Here is an app that can help you. Maybe if you ask the developer to implement the feature you want.
[General Accessories] griffin_1:
Thank you for the suggestion. I actually left a comment on the thread of the app and suggested that, but didn't got a reply about it. Maybe the dev didn't saw it or is giving priority to other things in the app. There is also a xposed module to unlock with Wi-Fi or Bluetooth, it's called nolockhome, but it doesn't allow to limit range sadly (also left a suggestion for that there)
[General Accessories] Ofthecats:
I have good news!

Last night (or I should say this morning, eastern time) I had broken sleep. But...

The mi band picked up both periods of sleep! It showed I was awake at the correct time I actually got up to the bathroom!

I'm also impressed it's been accurate at determining when I get into bed.
[General Accessories] stavrinho:
I believe it's something easy for them to implement it. If you don't have an answer soon, maybe sent them a pm.

Did you ask this request from the tweaked app developer also?
[General Accessories] griffin_1:
I might do that. For the tweaked app dev, I didn't but a user here said he/she would send that suggestion to the dev of the tweaked app and if the dev replied with feedback on that would let us know but I guess the dev hasn't said anything about it since the user haven't posted back about that. I might still send the dev a pm also to show that they have more people interested on that.
[General Accessories] darren1:
Still looking for a way to sync from Mi Band. Found FitnessSyncer which could be promising.

https://www.fitnesssyncer.com

Can import csv files from Dropbox and sync with Fitbit (and via Fitbit myfitnesspal) and others.

https://www.fitnesssyncer.com/documentation.html

With Bonoboo's Tasker task should be able to write data to a csv file in Dropbox using Tasker.

http://xdaforums.com/showpost.php?p=58140122&postcount=278
[General Accessories] Bonoboo:
Soon I will upload standalone app / profile that can automatically export all stats into CSV or nice HTML with graphs.

Not sure about proper format for FitnessSyncer, but it's nice just to keep stats in simple file.
[General Accessories] Trunkam:
no, would be great but atm there are no info on supporting those.
[General Accessories] darren1:
Here are a couple of screenshots of the variables that can be synced with FitnessSyncer.

https://www.dropbox.com/s/scni5xqn73d58g7/fitnesssynceractivity.png?dl=0

https://www.dropbox.com/s/3kr7mq9yrs2v0te/fitnesssyncersleep.png?dl=0

There is the option of Comma, Tab and Semicolon as separators. I think it might be possible to sync to Google Fit and MyFitnessPal by syncing with MapMyFitness via FitnessSyncer.
[General Accessories] cobyman7035:
How to make it vibrate longer¿? Its too short imo

Via my NeXus™ 7FHD on XDA Premium app
[General Accessories] Bonoboo:
Good find!

Very nice and flexible.

Yes, it's will be very easy to set needed columns and no matter as they named.

But there's data and time in one row.

At call? No way.

At notifications: yes, it's configurable, duration and count of vibrations.
[General Accessories] naeem86:
Hi, I've read on some sites that the battery gets really bad after sometime, is that true? They say after the 1st month or so, it starts getting bad. Can anyone enlighten me with this please. Thanks. .
[General Accessories] Bonoboo:
I know only users who got defected units, they work only 1 day after full charge.

For me after 103 days it works good.

Even with notifications (this affects battery) bracelet lasts 1 month. So I charged it only 3 times.

2 All

Modded app updated to 1.2.811_344

Also Xiaomi renamed it into Mi Fit

Seems it will be hub for other their products.
[General Accessories] dadam30:
The Dev of the tweaked app did say to me in PM that he actualy can't add a feature to limite the range of the smart lock feature due to limitation on the band.
[General Accessories] naeem86:
Also besides notifications, are there any thing more than the modded app provide?
[General Accessories] dadam30:
It does provider smart lock on Android 5 [MENTION=4238792]naeem86[/MENTION]
[General Accessories] naeem86:
Oh ok. Am only on 4.4.2. But it's not like the reading are more accurate or stuffs like that?
[General Accessories] dadam30:
No it is only extra features and translations!
[General Accessories] naeem86:
One more thing, can you use apps that are available on the playstore with the miband?

Edit: I mean other apps besides the mi app and the modded one.
[General Accessories] griffin_1:
Thanks for lettings us know.

Its a shame that this can't be added =( But its weird that its a limitation of the band when on miui/xiaomi phones it works like that (only close to the phone) to unlock
[General Accessories] Bonoboo:
Yep, in fact it's phone-side feature.

It need to measure signal strength from bracelet.

And this request was too big and incorrect.

Hard to do something in app if unlock performed by system, addon in OS (Smart Lock).

App just keeps connection, that's all.

Ask again developer of awesome Xposed plugin No Lock Home to add dbm threshold.
[General Accessories] dadam30:
I'm pretty sure it is possible bacause I can get the atenuation level with an app when the devise is visible by the phone (it is the case when wmart lock is activated). But I'm no Android dev so I can't tell for sure.
[General Accessories] darren1:
What's that mean?
[General Accessories] miodzicho:
I would like to ask if someone have any idea how to get sleep tracking working again. For me says always you didn't wear your band last night. No matter what I do. I uninstalled app, reinstalled original. Wiped data, installed translated one. Even wiped phone and reinstalled rom. Still no go. I'm getting a little frustrated, because was working on very beginning and then just stopped.
[General Accessories] griffin_1:
Thanks.

I just left a message for the dev of the module, hopefully he/she can do that or is not too complicated.
[General Accessories] jpde:
I've been having the same problem for a few days now. Worked just fine before.. haven't found a solution yet, though.
[General Accessories] dvs323:
Sleep Monitoring

Does anyone know how the app/band determines when you fall asleep, whether if you're in deep sleep or light sleep and for how long?
[General Accessories] pgptheoriginal:
I suppose that when you're in deep sleep you hardly make any movements ;)

Sent from my Nexus 5
[General Accessories] Bonoboo:
How to find a lost bracelet

Also check other useful additions for Mi Band

In some cases capsule can very easily press out from the bracelet, especially if it's unoriginal.

You can fasten it inside by many ways. Also we have app for notification if there no connection with bracelet (i.e. it lost)

Also rivet can be opened if touch something.

But if it's already happened, try the tips below.

Note: if bracelet on the cold, battery can quickly discharged, so then can't be searched by signal.

If you lost capsule indoor (search via signal level):

Most easy, but not very effective: in Mi Fit settings tap on "Find band" and search by sound from vibration / light from LED's. Or better:

Remove or better "freeze" (root and Link2SD) application Mi Band / Fit because it "locks" Bluetooth

Disable unlock via bracelet

Install and run app BLE Scanner (red icon)

Move around and watch level signal from device "MI": lower number = bracelet closer

If you lost capsule outdoor (search by location):

Don't try to search by vibration / LED's, this is not useful and very discharge battery on cold

Remove or better "freeze" (root and Link2SD) application Mi Band / Fit because it "locks" Bluetooth

Disable unlock via bracelet

Turn on GPS

Install and run app Bluetooth 4.0 Scanner (BlueScan)

In drop-down list select Low Energy Scan

Click Start Scan

Turn off screen and slowly walk around last route

At the end click Database

If there's in list device "MI" – you walked close to the bracelet

After tap on it in log will be coordinates (two long numbers) – enter them in the search bar of Google Maps

Go to the specified location and carefully look for the device within 10-20 meters around and use first signal-based method
[General Accessories] cobyman7035:
Is it just me but smart lock ? dosnt work all the time… less then 50% for me and nexus6

Via my NeXus™ 7FHD on XDA Premium app
[General Accessories] tssphysicsboi:
I find that if I use greenify with lockscreen it will lock it. But if I set it to just turn off screen then the auto unlock works...
[General Accessories] stavrinho:
I am not sure about the 50% but i also had the same problems from the beginning. So I just stop using it.
[General Accessories] Bonoboo:
2 All

Profile Gathering statistics from Mi Band app for use in Tasker updated to 1.4 version

Changelog

– Profile simplified

– Removed demo notification

– From post removed standalone task: you can take it from profile

– To post added universal sqlite3 binary for manual install
[General Accessories] pgptheoriginal:
For me the smart unlock fails maybe once a week... My phone is a Nexus 5.

Sent from my Nexus 5
[General Accessories] dvs323:
Modded App

Can someone post or provide a link to the latest version of the modded app (1.2.811_344)? I tried registering on the MIMU website for the download but am getting the following error: 403 Error: The current IP restricted or limited by the current account
[General Accessories] xmxm:
EDIT: The version below is outdated, please get newest version from here: http://xdaforums.com/general/accessories/xiaomi-mi-band-data-extraction-t3019156

---------------------------

I wrote a program to synchonize data from Mi Band to desktop. The data is being saved to CSV format so you can open it in Excel. I also provide an html file that can load and show usage charts in the browser. The application should be compatible with both rooted and non-rooted phones as long as you have USB debugging enabled and adb can connect to your phone.

Instructions:

1. Unpack archive to some directory.

2. Connect your phone through USB and make sure USB debugging setting is enabled on your phone.

3. Execute run.bat - if your phone is rooted, the data would be pulled automatically. If your phone is not rooted you would see backup screen and you need to press "Back up my data" button in the bottom left corner.

4. Data from your mi band will be saved to extract.csv file and extract.js. After extraction is complete, mi_data.html will be opened automatically to show charts for your Mi usage. If you do not want browser to be opened automatically, edit run.bat and change OpenHTML setting in line 4 from Y to N.
[General Accessories] jlaunay:
Thanks for sharing, I made a bash script for Linux user (you need to install android-sdk for adb binary, sqlite3 and openssl is using to uncompress zlib data).

run.sh

#!/bin/bash

SDPath=/sdcard
MILNG=eng
OpenHTML=Y

echo "Extract Started" 2>&1 | tee log
echo `date +"%m-%d-%y %H:%M"` 2>&1 | tee -a log

echo "Renaming" 2>&1 | tee -a log
[[ -f ./db/origin_db ]] && mv ./db/origin_db ./origin_db.bak 2>&1 | tee -a log
[[ -f ./db/origin_db-journal ]] && mv ./db/origin_db-journal ./db/origin_db-journal.bak 2>&1 | tee -a log

echo "ADB SU copy to sdcard" 2>&1 | tee -a log
adb shell "su -c 'cp /data/data/com.xiaomi.hm.health/databases/origin_db* $SDPath/.'" 2>&1 | tee -a log
echo "ADB pull" >> log
adb pull $SDPath/origin_db ./db/origin_db 2>&1 | tee -a log
adb pull $SDPath/origin_db-journal ./db/origin_db-journal 2>&1 | tee -a log
adb shell "rm /sdcard/origin_db && rm /sdcard/origin_db-journal" 2>&1 | tee -a log

if [ ! -f ./db/origin_db ]
then
echo "Cannot find database files. Non-rooted phone? Attemting backup approach" 2>&1 | tee -a log
echo "Press "Backup My Data" button on device..." 2>&1 | tee -a log
adb backup -f mi.ab -noapk -noshared com.xiaomi.hm.health
echo "unpacking backup file" 2>&1 | tee -a log
tail -c +25 mi.ab > mi.zlb 2>&1 | tee -a log
cat mi.zlb | openssl zlib -d > mi.tar 2>&1 | tee -a log
tar xvf mi.tar apps/com.xiaomi.hm.health/db/origin_db apps/com.xiaomi.hm.health/db/origin_db-journal 2>&1 | tee -a log

echo "deleting temp file" 2>&1 | tee -a log
rm mi.ab
rm mi.zlb
rm mi.tar
cp -f apps/com.xiaomi.hm.health/db/origin_db* ./db/
rm -rf apps/
fi

if [ ! -f ./db/origin_db ]
then
echo "Extraction failed"
echo "Still cannot find files. Restoring original files"
[[ -f ./db/origin_db.bak ]] && mv ./db/origin_db.bak ./db/origin_db
[[ -f ./db/origin_db-journal.bak ]] && mv ./db/origin_db-journal.bak origin_db-journal
else
echo "sqlite operation started" 2>&1 | tee -a log
sqlite3 ./db/origin_db < ./db/miband_$MILNG.sql | tee -a log
[[ -f ./db/origin_db.bak ]] && rm ./db/origin_db.bak | tee -a log
[[ -f ./db/origin_db-journal.bak ]] && rm ./db/origin_db-journal.bak | tee -a log

[[ $OpenHTML == 'Y' ]] && xdg-open mi_data.html

fi
[General Accessories] taldeital:
is anybody working for an integration with sleep as android and Google fit? I don't if it's worthy to make it through tasker, there should be something to let the MiBand used by a standalone "smart watch".
[General Accessories] RaS_KoR:
[MENTION=5037002]Bonoboo[/MENTION]

Thanks for your useful tools, but the extract.js file contains a mistake, the date in the first column is zero based month. So the html page's dates are worng.
[General Accessories] Bonoboo:
Thanks to all!

Seems xmxm not adapted this code for different locales.

With my non-English locale it's exporting fine without fix.
[General Accessories] jlaunay:
I do not think this is a locale problem, mine is non-English too.

In the database, the month was stored as a value between 1 for January and 12 for December whereas in javascript, the Date method expect a value between 0 for January and 11 for December.
[General Accessories] xmxm:
Thank you, I saw this issue too yesterday. I've replaced month calculation with

cast((cast(strftime('%m',Date) as integer)-1) as text)

There were few more bugs reported and few new features added to the chart - I plan to release new version this weekend. May I incorporate your French translation and Unix script into next release?
[General Accessories] jlaunay:
Using cast instead of case statement make the query more readable, that was a quick & dirty fix from me (especially if you know I'm using SQL every day for 15 yrs :o).

You can incorporate my French translation and my Bash script with pleasure.

Don't hesitate to PM me if you need some help for anything.
[General Accessories] 5nak3:
I actually saw this app doing the rounds in the news before reading too much into the band, the functionality offered was what swayed me to buy the band.

One question I can't seem to answer however is what the "BLE Broadcast" setting within the modded app actually does.

Can anyone shed any light?
[General Accessories] xmxm:
Thank you. I've sent you PM asking to translate few more lables
[General Accessories] xmxm:
EDIT: The version below is outdated, please get newest version from here: http://xdaforums.com/general/accessories/xiaomi-mi-band-data-extraction-t3019156

---------------------------

Here is an updated version for statistics extraction program.

Fixes:

1. Month was calculated incorrectly in HTML version

2. Sometimes data had extra rows with zeroes

3. All localization settings are moved out into single file

New Features:

1. Daily goals added. These are shown as trendlines on charts and sleep/steps columns in table will have green arrow if you passed daily goal and red arrow if you did not. By default the goals are set for 8 hours of sleep and 8,000 daily steps, but these could be changed inside config.js. They can also be changed dynamically in UI with corresponding -/+ buttons.

2. Data grouping data - click day/week/month buttons to group by these periods. Most columns Week and Month grouping show averages, but Walk distance and steps also have totals counters.

3. Added *nix shell script for data extraction (credit goes to jlaunay)

4. Added French localization (thanks to jlaunay) - still missing translation for few items, will complete it in next release.

Screenshot:

[IMG="Screenshot"]http://i.imgur.com/JqZoesU.gif[/IMG]
[General Accessories] Bonoboo:
2 All

App / profile Export all statistics into HTML and/or CSV-table updated to version 1.4

A lot improvements and fixes: changelog above in xmxm's post.

Please, update with clean install app / profile.

It's not feature of modded app.

It shows not for all for some reason.

As dev said it's for connecting future Xiaomi's products.
[General Accessories] 5nak3:
Ah right, I didn't realise that. I went for the modded app right away so I didn't know what was in the official app.

Appreciate the quick response!
[General Accessories] Devo7v:
I'm still waiting for Mi Band to arrive in the mail, but I figured in the meantime I'd do a little research into integration with other apps. If I understand what [MENTION=5037002]Bonoboo[/MENTION] is doing is taking data from the app and parsing it out into a format that's usable with other programs. I've also been able to find other threads where [MENTION=4353095]motioncoding[/MENTION] has partially reverse engineered the band and someone else has created a partial API so that other apps can access the hardware.

I'm not sure if everybody is aware of all these efforts, but hopefully everybody can work together to finally "unlock" this thing for use everywhere. Ideally a fully functional API could be created so that other developers could access the band, or at least someone could create an Xposed module to act as a middle man to relay the information from the band to apps. I appreciate all the work people are doing in trying to liberate our data from the Mi Fit app and hopefully we can use the band with other apps.