Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

miband5 activity log is not correct #57

Open
janvda opened this issue Dec 5, 2021 · 3 comments
Open

miband5 activity log is not correct #57

janvda opened this issue Dec 5, 2021 · 3 comments

Comments

@janvda
Copy link

janvda commented Dec 5, 2021

Here below the activity log retrieved for the last hour for my miband 5 device.
You can see it is not correctly interpreting the odd minute timestamps are totally different from the even minute timestamps.

2021-12-05 23:38:11,165 miband (INFO) > Enabling Fetch Char notifications status...
2021-12-05 23:38:11,321 miband (INFO) > Enabling Activity Char notifications status...
2021-12-05 23:38:11,461 miband (DEBUG) > start_get_previews_data(2021-12-05 23:00:00)...
2021-12-05 23:38:11,541 miband (DEBUG) > _char_fetch.getHandle(): 15 bytes received, processing them ...
2021-12-05 23:38:11,541 miband (DEBUG) >   > Fetch data from 2021-12-5 23:0
2021-12-05 23:38:11,581 miband (DEBUG) > _char_activity.getHandle(): 17 bytes received, processing them ...
  > 2021-12-05 23:00: category: 243; intensity 5; steps 0; heart rate 255
  > 2021-12-05 23:01: category: 4; intensity 59; steps 128; heart rate 0
  > 2021-12-05 23:02: category: 243; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:03: category: 4; intensity 60; steps 128; heart rate 0
2021-12-05 23:38:11,582 miband (DEBUG) > _char_activity.getHandle(): 17 bytes received, processing them ...
  > 2021-12-05 23:04: category: 243; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:05: category: 4; intensity 61; steps 128; heart rate 0
  > 2021-12-05 23:06: category: 243; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:07: category: 4; intensity 61; steps 128; heart rate 0
2021-12-05 23:38:11,600 miband (DEBUG) > _char_activity.getHandle(): 17 bytes received, processing them ...
  > 2021-12-05 23:08: category: 243; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:09: category: 4; intensity 61; steps 128; heart rate 0
  > 2021-12-05 23:10: category: 243; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:11: category: 4; intensity 61; steps 128; heart rate 0
2021-12-05 23:38:11,601 miband (DEBUG) > _char_activity.getHandle(): 17 bytes received, processing them ...
  > 2021-12-05 23:12: category: 243; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:13: category: 4; intensity 61; steps 128; heart rate 0
  > 2021-12-05 23:14: category: 243; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:15: category: 4; intensity 62; steps 128; heart rate 0
2021-12-05 23:38:11,602 miband (DEBUG) > _char_activity.getHandle(): 17 bytes received, processing them ...
  > 2021-12-05 23:16: category: 243; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:17: category: 4; intensity 61; steps 128; heart rate 0
  > 2021-12-05 23:18: category: 243; intensity 3; steps 0; heart rate 255
  > 2021-12-05 23:19: category: 4; intensity 61; steps 128; heart rate 0
2021-12-05 23:38:11,603 miband (DEBUG) > _char_activity.getHandle(): 17 bytes received, processing them ...
  > 2021-12-05 23:20: category: 243; intensity 1; steps 0; heart rate 255
  > 2021-12-05 23:21: category: 4; intensity 61; steps 128; heart rate 0
  > 2021-12-05 23:22: category: 243; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:23: category: 4; intensity 61; steps 128; heart rate 0

FYI the info for my miband5:

MiBand
Soft revision: V1.0.2.58
Hardware revision: V0.44.23.2
Serial: 2c1049507e9d
Battery: 51
Time: 2021-12-05T23:43:43
Press a key to continue
@janvda
Copy link
Author

janvda commented Dec 5, 2021

FYI I tried the same with my miband4 device and activity log is working as you can see below

my miband4 info:

MiBand
Soft revision: V1.0.9.48
Hardware revision: V0.25.19.5
Serial: 79fb17e114e8
Battery: 54
Time: 2021-12-05T23:53:46
Press a key to continue

paritally extract of my miband4 activity log (in this case I was not wearing the miband4) for the last hour which looks good:

2021-12-05 23:50:39,305 miband (INFO) > Enabling Fetch Char notifications status...
2021-12-05 23:50:39,497 miband (INFO) > Enabling Activity Char notifications status...
2021-12-05 23:50:39,688 miband (DEBUG) > start_get_previews_data(2021-12-05 23:00:00)...
2021-12-05 23:50:39,857 miband (DEBUG) > _char_fetch.getHandle(): 15 bytes received, processing them ...
2021-12-05 23:50:39,858 miband (DEBUG) >   > Fetch data from 2021-12-5 23:0
2021-12-05 23:50:39,947 miband (DEBUG) > _char_activity.getHandle(): 17 bytes received, processing them ...
  > 2021-12-05 23:00: category: 112; intensity 2; steps 0; heart rate 255
  > 2021-12-05 23:01: category: 115; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:02: category: 115; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:03: category: 115; intensity 0; steps 0; heart rate 255
2021-12-05 23:50:39,949 miband (DEBUG) > _char_activity.getHandle(): 17 bytes received, processing them ...
  > 2021-12-05 23:04: category: 115; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:05: category: 115; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:06: category: 115; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:07: category: 115; intensity 0; steps 0; heart rate 255
2021-12-05 23:50:39,950 miband (DEBUG) > _char_activity.getHandle(): 17 bytes received, processing them ...
  > 2021-12-05 23:08: category: 115; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:09: category: 115; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:10: category: 112; intensity 7; steps 0; heart rate 255
  > 2021-12-05 23:11: category: 115; intensity 0; steps 0; heart rate 255
2021-12-05 23:50:39,951 miband (DEBUG) > _char_activity.getHandle(): 17 bytes received, processing them ...
  > 2021-12-05 23:12: category: 115; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:13: category: 115; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:14: category: 115; intensity 0; steps 0; heart rate 255
  > 2021-12-05 23:15: category: 115; intensity 0; steps 0; heart rate 255

@janvda
Copy link
Author

janvda commented Dec 7, 2021

wireshark output of my miband5 covering retrieval of the activity log

image

When analyzing the last 17 bytes of the packet I recognize the following information:

01 <= sequence number, starting with 00
50 19 00 FF  <= activity / intensity / steps / heart rate    
04 00 80 00  <=  NEW fixed sequence (which doesn't exist on my miband 4)
50 0F 00 FF  <= activity / intensity / steps / heart rate   
04 00 80 00  <=  NEW fixed sequence (which doesn't exist on my miband 4)

So it looks like that a minute of activity is no longer represented by 4 bytes but by 8 bytes of which the last 4 bytes is 04 00 80 00 (for other retrievals it might be different).

It also seems that gadgetbridge is not properly recognizing this packet (assuming I understand the code properly) : see

@janvda
Copy link
Author

janvda commented Dec 14, 2021

I have fixed this in my fork : see

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant