(Thanks for the excellent Gadgetbridge app)
UPDATE: I now believe it is a bug related to Live Activity causing the step inflation. See DB extract below.
Note with my MiBand1S, with _0.13.x_ app versions up through _0.15.1_, the activity step counts seem reasonable when synchronizing step counts in the foreground, but when running Live Activity, the step counts become hugely inflated even to the hundreds of thousands or millions; see attached screenshot from yesterday running _0.14.4_ for one day with step count 2,755,847, actual steps about 14,000. I've gone back to version _0.12.2_, which to my knowledge has accurate step counts. The previous step count over 100,000 was from running _0.14.3_ for one day.
*The inflated step counts once they occur are persistent.
Hardware:
MiBand 1S FW: 4.16.4.22, HR: 1.3.76.22 (1.3.76.18 when bug first occurred)
Phone Moto G 2nd Edition (no Google Play) with Android 5.0.2

Wow, that's tough for competing runners :grin:
Do I understand this right that the values are correct when synchronizing in the foreground, and they are completely wrong when synchronizing in the background?
I.e. it is not just a display problem, but the wrong values persist in the database?
I have had the same experience with the 1s inflating the count tremendously. For me it occurred when I had Live Activity running. It seemed OK for a while and then went high -- perhaps when I got to the step goal.
I think I started with version 13 and am now at 14.3.
i've been unable to reproduce the issue with my 1S with the same version of FW (just the HR version differs, got 1.3.76.22), However I've noticed (and filed) another issue on the Live Activity page:
https://github.com/Freeyourgadget/Gadgetbridge/issues/450
@cpfeiffer On GB 0.14.4 (and also previous versions in the 0.13.x and 0.14.x line) when I manually synchronize in the foreground, the returned step counts seem reasonable. After using other foreground apps* with GB connected to the MiBand and then bringing GB to the foreground again some time later and then syncing step counts in the foreground, the step count was 2.7 million. After the count becomes inflated, it persists. Even re-installing the 0.12.2 version will persist the inflated step count if downgrading is successful. I don't think it is a display issue.
@rplevka Your phone has how much RAM?
*my Moto G has 1GB RAM; RAM available for multitasking is a possible constraint though I run it pretty lean
@velowander, my trusty prestigio multiphone 5455 duo has got 1GB RAM afaik.
@velowander, I've actually managed to reproduce the issue last Wednesday but noticed that just today. I usually don't use Live Activity but this time i did. Still don't know the exact reproducer, however I can see there are really values with a high number of steps during the live activity was active (extracted from DB):
"1481124801" "1" "1" "-1" "5433" "-1" "-1"
"1481124802" "1" "1" "-1" "5436" "-1" "45"
"1481124803" "1" "1" "-1" "5439" "-1" "47"
"1481124804" "1" "1" "-1" "5440" "-1" "49"
"1481124852" "1" "1" "-1" "5450" "-1" "-1"
@rplevka Thanks for investigating this bug.
Which tool did you use to read the DB export file (for Android, Linux, or Windows)? I'd like to try looking at my DB export log too.
@velowander since the export file itself is a sqlite3 db, any sql browser should do, I personally use sqlitebrowser on Fedora linux. I have no preference in browsers, this one was simply in fedora repos and works just fine. It should also work on all platforms (written in java).
@rplevka I exported a partial database from my Gadgetbridge version 0.12.2, the last relatively trouble-free version for my MiBand1S. Using DB Browser on the MI_BAND_ACTIVITY_SAMPLE table, I see an average of 13.33 and a maximum steps of 194 for one minute periods.
When the new GB 0.15.1 version arrives on f-droid, I'll collect some new data. If the step inflation recurs, I'll export the DB and take a look.
@rplevka Using GB 0.15.1 and Live Activity, I quickly reproduced the step inflation. After just a few moments, my steps went from about 4,500 to over 50,000.
The inflated step counts are right there in the DB extract, just like your findings.
Query: 'select timestamp, steps from MI_BAND_ACTIVITY_SAMPLE where steps>200'
TIMESTAMP STEPS
1482378424 4736
1482378426 4737
1482398429 4740
1482378430 4742
1482378431 4743
1482378432 4744
1482378433 4745
1482378434 4746
1482378470 4756
1482378472 4757
Since LiveActivity timestamps are every second or close to it, in a few seconds you could have a very large step count.
(Note that the LiveActivity app screen didn't actually display the step activity - see issue #450, but apparently it was adding the counts to the database)
Thanks, I'll have a look at it this evening. Might be the algorithm does not properly handle the sub-minute samples in the db.
TODO: check how Mi2 behaves
@cpfeiffer Wonderful, thanks so much. When the next version arrives, I'll test the Live Activity.
Fixed.
Most helpful comment
Thanks, I'll have a look at it this evening. Might be the algorithm does not properly handle the sub-minute samples in the db.