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

Xiaomi Mi smartband 6 #87

Open
kmg454 opened this issue Sep 7, 2021 · 14 comments
Open

Xiaomi Mi smartband 6 #87

kmg454 opened this issue Sep 7, 2021 · 14 comments

Comments

@kmg454
Copy link

kmg454 commented Sep 7, 2021

Just bought a Xiaomi MI band 6 and want to read the heartrate.
It will connect to the hub but I see no advertising data at all.
Is there anything I have to change in xiaomi.js to see the values of this device?
Maybe the xiaomiProductName has to been added?

@gfwilliams
Copy link
Member

@G1K do you have any thought on what might need to change?

@kmg454
Copy link
Author

kmg454 commented Sep 13, 2021

I know the product name is XMSH15HM but in the xiaomi.js I see a Hex number in front I have no idea what to add there

@G1K
Copy link
Contributor

G1K commented Sep 13, 2021

I do not have myband 6, but on many previous bracelets and watches it is necessary to turn on 2 switches in the application. 1) for ads, it often has steps 2) for heartbeat data. in order for the bracelet to constantly measure and broadcast the heartbeat, you need to turn on the training mode. maybe it will transmit in the usual mode, but rarely.

@kmg454
Copy link
Author

kmg454 commented Sep 14, 2021

I do not have myband 6, but on many previous bracelets and watches it is necessary to turn on 2 switches in the application. 1) for ads, it often has steps 2) for heartbeat data. in order for the bracelet to constantly measure and broadcast the heartbeat, you need to turn on the training mode. maybe it will transmit in the usual mode, but rarely.

When de Mi smartband 6 is on I can see the name of it in the Espruinohub but there is no advertising data, also no steps which I can see with earlier Mi bands. I do not know how the Xiaomi.js is working but when i look into it i see productnames.
Like:
0x01aa: "LYWSDCGQ",
0x03dd: "MUE4094RT",
0x07f6: "MJYD02YLA",
0x0387: "MHOC401",
????????: "XMSH15HM"
In the last line you see the productname of the MI smartband 6 but I don't know what hex numer to put in front of it.
Not sure my product name must be in there, but it sounds logic to me.

@G1K
Copy link
Contributor

G1K commented Sep 14, 2021

The name and model is not used to decrypt messages. In most cases, the decryption goes on the service ID from the data that announces devices. Did you go in the MI FIT application and turned on the detection of the device and the transfer of the pulse?

@kmg454
Copy link
Author

kmg454 commented Sep 14, 2021

The name and model is not used to decrypt messages. In most cases, the decryption goes on the service ID from the data that announces devices. Did you go in the MI FIT application and turned on the detection of the device and the transfer of the pulse?
I was not using the MI fit app but Xiaomi wear. Now installed the Mi fit app but where can i find to set the transfer of the pulse?

@G1K
Copy link
Contributor

G1K commented Sep 14, 2021

I was not using the MI fit app but Xiaomi wear. Now installed the Mi fit app but where can i find to set the transfer of the pulse?

Search in your app or in mi fit. the setting should be somewhere in the device settings. There are not so many buttons to get confused. I don't have such a bracelet, nor an android. You can search in Google "how to enable mi band ble detection " , example https://community.home-assistant.io/t/esphome-ble-tracking-mi-band-4-working/129732/21 .

For underage accounts, this setting may not be visible.

@kmg454
Copy link
Author

kmg454 commented Sep 14, 2021

I was not using the MI fit app but Xiaomi wear. Now installed the Mi fit app but where can i find to set the transfer of the pulse?

Search in your app or in mi fit. the setting should be somewhere in the device settings. There are not so many buttons to get confused. I don't have such a bracelet, nor an android. You can search in Google "how to enable mi band ble detection " , example https://community.home-assistant.io/t/esphome-ble-tracking-mi-band-4-working/129732/21 .

For underage accounts, this setting may not be visible.

Found the setting and now the band is advertising the steps :-)
Now find how to advertise the heartrate (the most important in my case)

@G1K
Copy link
Contributor

G1K commented Sep 14, 2021

And now reread what I wrote above. The key should be the second switch and you need to turn on the training mode to constantly monitor your heart rate.

@kmg454
Copy link
Author

kmg454 commented Sep 15, 2021

And now reread what I wrote above. The key should be the second switch and you need to turn on the training mode to constantly monitor your heart rate.

I tried to start a training and turn on heartrate advertising to other party. When i start a BLE heartrate app on my mobile it connects and show the heartrate, but the EspruinoHub does show nothing except steps.

@kmg454
Copy link
Author

kmg454 commented Sep 15, 2021

The band is advertising but not to Espruinohub see picture
BLE

@G1K
Copy link
Contributor

G1K commented Sep 18, 2021

These are two different things. I was talking about switches. in Zepp app referred to as 1) Detection 2) General heart rate information. in Mi fit is similar. If both of them are turned on, then in the training mode that can be turned on from a watch or bracelet, information about the heart rate is transmitted in clear form in advertising messages. And it can be caught by anyone and is implemented in espruino in the xiaomi.js parser.

What you showed in the screenshot is a different mode, you can run it through espruino. You need to connect to the bracelet, and subscribe to notifications of a specific characteristic. then they will be sent directly and not broadcast to everyone, but there is one drawback. only one device can be connected to the bracelet at once and therefore most likely you will have to turn off the bluetooth on the phone.

@kmg454
Copy link
Author

kmg454 commented Oct 3, 2022

I turned on both switches and start training or workout on the MI6 band, but the EspruinoHub does not show the heart rate. Think there must be some editing in the attributes.js
I found this which show the steps but it say also something about heart rate: "fee0": function (d) {

let r = {steps: (0xff & d[0] | (0xff & d[1]) << 8)};
if (d.length === 5)
  r.heartRate = d[4];
return r;

I think this need some editing.

@gfwilliams
Copy link
Member

You've been posting in the forum recently as well? https://forum.espruino.com/conversations/379871/#comment167048

Maybe just continue the discussion there rather than posting here

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

3 participants