ble_monitor
ble_monitor copied to clipboard
[New Sensor]: Xiaomi Mi Band 6
Sensor Description
Xiaomi Mi Band 6
Additional information
Well known hand band, it would be nice to use it as human tracker in HA/ And thanks for all your efforts.
BLE advertisements
2022-05-28 11:29:41 INFO (MainThread) [custom_components.ble_monitor] Attention! Option report_unknown is enabled for sensor with id(s): ['C5093F890B4B']
2022-05-28 11:29:42 INFO (Thread-10) (custom_components.ble_monitor.ble_parser] BLE advertisement received from MAC/UUID c5093f890b4b: 043e390d011200004b0b893f09c50100ff7fb20000000000000000001f0201041bff570102ffffffffffffffffffffffffffffffff03c5093f890b4b
2022-05-28 11:29:57 INFO (Thread-10) [custom_components.ble_monitor.ble_parser] BLE advertisement received from MAC/UUID c5093f890b4b: 043e390d011200004b0b893f09c50100ff7fb20000000000000000001f0201041bff570102ffffffffffffffffffffffffffffffff03c5093f890b4b
2022-05-28 11:29:58 INFO (Thread-10) [custom_components.ble_monitor.ble_parser] BLE advertisement received from MAC/UUID c5093f890b4b: 043e390d011200004b0b893f09c50100ff7fb20000000000000000001f0201041bff570102ffffffffffffffffffffffffffffffff03c5093f890b4b
2022-05-28 11:29:59 INFO (Thread-10) [custom_components.ble_monitor.ble_parser] BLE advertisement received from MAC/UUID c5093f890b4b: 043e390d011200004b0b893f09c50100ff7fb20000000000000000001f0201041bff570102ffffffffffffffffffffffffffffffff03c5093f890b4b
2022-05-28 11:30:01 INFO (Thread-10) [custom_components.ble_monitor.ble_parser] BLE advertisement received from MAC/UUID c5093f890b4b: 043e390d011200004b0b893f09c50100ff7fb20000000000000000001f0201041bff570102ffffffffffffffffffffffffffffffff03c5093f890b4b
2022-05-28 11:30:16 INFO (Thread-10) [custom_components.ble_monitor.ble_parser] BLE advertisement received from MAC/UUID c5093f890b4b: 043e390d011200004b0b893f09c50100ff7fb20000000000000000001f0201041bff570102ffffffffffffffffffffffffffffffff03c5093f890b4b
2022-05-28 11:30:31 INFO (Thread-10) [custom_components.ble_monitor.ble_parser] BLE advertisement received from MAC/UUID c5093f890b4b: 043e390d011200004b0b893f09c50100ff7fb20000000000000000001f0201041bff570102ffffffffffffffffffffffffffffffff03c5093f890b4b
2022-05-28 11:30:34 INFO (Thread-10) [custom_components.ble_monitor.ble_parser] BLE advertisement received from MAC/UUID c5093f890b4b: 043e390d011200004b0b893f09c50100ff7fb20000000000000000001f0201041bff570102ffffffffffffffffffffffffffffffff03c5093f890b4b
2022-05-28 11:30:36 INFO (Thread-10) [custom_components.ble_monitor.ble_parser] BLE advertisement received from MAC/UUID c5093f890b4b: 043e390d011200004b0b893f09c50100ff7fb20000000000000000001f0201041bff570102ffffffffffffffffffffffffffffffff03c5093f890b4b
+1 and battery like in mi flora :)
+1 add miband 5 too, plz
https://github.com/myhomeiot/esphome-components/blob/main/examples/myhomeiot_ble_client/mi_band.yaml
esphome.... its not for me
esphome.... its not for me
Link for @Ernst79
Note for myself:
1bff570102ffffffffffffffffffffffffffffffff03c5093f890b4b
Can be split up in
1b = length
ff = manufacturer specific data
5701
= manufacturer ID
02ffffffffffffffffffffffffffffffff03
= the data
c5093f890b4b
= MAC
Following the link from @adrewjswan I think it requires a connection to communicate, which is not supported by BLE monitor. But we can give it another try, by making a longer log, and trying to vary the mearements, to see what changes in the BLE advertisements. They now are all the same messages.
Steps not require connect, only battery and battery states need connect, like MiFlora...
I'll dump new data, my original dump was made while band was charging off the hand on the desk
I've made another dump of data from Xiaomi Miband 6 this time I've moved around (so RSSI should be different) and number of steps indicated grows from 30+ to 49 (yes it was just after midnight localtime) File with data attached. xiaomi.log
I've checked your log, I see only two different data packets.
02ffffffffffffffffffffffffffffffff02
02ffffffffffffffffffffffffffffffff03
This doesn't look like the number of steps.
I also checked the link by @andrewjswan and I see that they use service_uuid: 'FEE0'
This is not what in your messages, which have a manufacturer ID (5701
).
I've checked your log, I see only two different data packets.
02ffffffffffffffffffffffffffffffff02
02ffffffffffffffffffffffffffffffff03
This doesn't look like the number of steps. I also checked the link by @andrewjswan and I see that they use
service_uuid: 'FEE0'
This is not what in your messages, which have a manufacturer ID (5701
).
After some googling it looks like that Miband 6 does not show any data before pairing if it is already paired with the app (which is my case, of course). But I've digged out older miband 5 which is said to broadcast some useful info. I am charging it now and hope to dump some packets during weekend. Also the question - is it possible to use unknown device (miband 6 in my case) as tracker. I added its MAC manually and tick "tracker" checkbox on device page but nothing happened. Regards
Also the question - is it possible to use unknown device (miband 6 in my case) as tracker. I added its MAC manually and tick "tracker" checkbox on device page but nothing happened.
It should work like that. No idea why it isn't working in your case. Is should show "home" when it receives a BLE advertisement and move back to "away" after the set time.
It should work like that.
Mea culpa, in fact it is working, I've been probably in a hurry in the morning. Thanks
Hi guys, just stumbled accross your thread here, and since I've been doing work on the Mi Band Decoder for OpenMQTTGateway/Theengs Gateway the above manufacturerdata looks familiar to me ;)
1bff570102**ff**ffffffffffffffffffffffffffffff03c5093f890b4b
This hex byte lets you monitor the activity heart when doing workouts with the Mi Band if this option is allowed in the Mi Band Zepp Life preferences - the current ff
showing no workout is currently ongoing . Similarly the steps count is shown in the broadcast servicedata, which I don't see in your conversation here, or could it be the 01120000
part above? Which would be 4609 steps?!?
Tested with Mi Band 4/5, but from the data above it looks as if this could still be valid for Mi Band 6.
Hope this helps.
Hello< I've managed to dump all night long of packets from Miband 4, and, unfortunately, most of them looks pretty the same. Follows stats of this night log (first number is numиer of such packets received, then space then packet content). Strange, but looks like indeed passively we cannot get number of steps or anything, and only using the service mentioned bove allows to get the info :( Anyway here goes the processed stats of log
23423 043e390d01130000595b93827ec90100ff7fea0000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff03c97e82935b59
4161 043e390d01130000595b93827ec90100ff7fce0000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff03c97e82935b59
1567 043e390d01130000595b93827ec90100ff7fcc0000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff03c97e82935b59
580 043e390d01130000595b93827ec90100ff7fe60000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff03c97e82935b59
273 043e390d01130000595b93827ec90100ff7fe40000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff03c97e82935b59
42 043e390d01130000595b93827ec90100ff7fec0000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff03c97e82935b59
24 043e390d01130000595b93827ec90100ff7fce0000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff02c97e82935b59
12 043e390d01130000595b93827ec90100ff7fea0000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff02c97e82935b59
12 043e390d01130000595b93827ec90100ff7fe80000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff03c97e82935b59
9 043e390d01130000595b93827ec90100ff7fcc0000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff02c97e82935b59
5 043e390d01130000595b93827ec90100ff7fd00000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff03c97e82935b59
5 043e2b0d01130000595b93827ec90100ff7fea000000000000000000110201060dff5701010203ffc97e82935b59
4 043e390d01130000595b93827ec90100ff7fe80000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff02c97e82935b59
3 043e2b0d01130000595b93827ec90100ff7fea000000000000000000110201060dff5701010102ffc97e82935b59
2 043e390d01130000595b93827ec90100ff7fc20000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff03c97e82935b59
2 043e390d01130000595b93827ec90100ff7fc00000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff03c97e82935b59
2 043e2b0d01130000595b93827ec90100ff7fce000000000000000000110201060dff5701010003ffc97e82935b59
1 043e390d01130000595b93827ec90100ff7fd60000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff03c97e82935b59
1 043e390d01130000595b93827ec90100ff7fca0000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff03c97e82935b59
1 043e390d01130000595b93827ec90100ff7fc80000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff03c97e82935b59
1 043e390d01130000595b93827ec90100ff7fbe0000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff03c97e82935b59
1 043e390d01130000595b93827ec90100ff7fbc0000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff03c97e82935b59
1 043e2b0d01130000595b93827ec90100ff7fcc000000000000000000110201060dff5701010003ffc97e82935b59
but looks like indeed passively we cannot get number of steps or anything
Mi Band 4 and 5 do passively broadcast the steps and activity heart rate ONLY IF the relevant preferences have been activated for the particular Mi Band in the Zepp Life app
Are these activated for your Mi Bands?
Might help for testing/validating with HA
https://github.com/mihsu81/addon-theengsgw
@Roofcatbusy can you make a new log with these two settings turned on, like described in the post of @DigiH ?
FYI
https://github.com/theengs/decoder/pull/161
Mi band 5
2022-10-03 15:07:26.822 INFO (Thread-2) [custom_components.ble_monitor.ble_parser] BLE advertisement received from MAC/UUID e2f1d00xxxx service data: []manufacturer specific data: [b'\x1b\xffW\x01\x02\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x02\xe2\xf1\xd0\x07JS']local name: UUID16: None,UUID128: None
I had a second look at theengs decoder implementation of @DigiH for the MiBand,
"condition":["manufacturerdata", "=", 52, "index", 0, "5701", "&", "manufacturerdata", "mac@index", 40],
"properties":{
"steps":{
"condition":["servicedata", "=", 8],
"decoder":["value_from_hex_data", "servicedata", 0, 4, true, false]
},
"act_bpm":{
"condition":["manufacturerdata", 10, "!", "f"],
"decoder":["value_from_hex_data", "manufacturerdata", 10, 2, false, false]
}
What is can see is that he gets the heart rate from the manufacturer specific data, but he gets the number of steps from the service data. Strangely I don't see any service data in your messages. Service data starts with 0x16.
~~@DigiH Can you explain which byte or bytes contains the heart rate in the following message?~~
Nevermind, you already showed it in an earlier post. its at hr
043e390d01130000595b93827ec90100ff7fd00000000000000000001f0201061bff570102ffffffffffffffffffffffffffffffff03c97e82935b59
Manufacturer specific data
len uuid hr -----mac----
1b ff 5701 02 ff ffffffffffffffffffffffffffffff03 c97e82935b59
Hi @Ernst79 @Wolvverine
the thing to note is that only the steps from the servicedata requires active scanning while the activity heart rate from the manufacturerdata is also available with passive scanning only - so that might be the reason for the missing servicedata.
Ah, that might explain it. Can someone try to get some logs with active scan turned on?
PR https://github.com/custom-components/ble_monitor/pull/1117 for the heart rate sensors is ready, sorry it took so long, totally forgot about this issue.
@Ernst79 Hello, here the BLE advertisement packets (from ESPHome) with heart rate and steps data (I mark data with ***), steps use 4 bytes, here how I calculate it.
I think PR #1117 has mistake, you should use 4th byte of 0x5701 as heart rate 5701020201***54***
, I test it with Mi Band 4 and other peoples report that it's working for few different models.
Thanks in advance.
043E480201000045613BFFFDFF3C0201061BFF5701020201***54***FFFFFFFFFFFFFFFFFFFFFFFFFF03FFFDFF3B614510094D6920536D6172742042616E6420340302E0FE0716E0FE***0B000000***A5
043E480201000045613BFFFDFF3C0201061BFF5701020201***66***FFFFFFFFFFFFFFFFFFFFFFFFFF03FFFDFF3B614510094D6920536D6172742042616E6420340302E0FE0716E0FE***1B000000***A5
Update: Here the packet without heart rate:
043E480201000045613BFFFDFF3C0201061BFF570102FFFF***FF***FFFFFFFFFFFFFFFFFFFFFFFFFF03FFFDFF3B614510094D6920536D6172742042616E6420340302E0FE0716E0FE1B000000B1
len uuid hr -----mac---- --------name--------------------------- -steps--
1b ff 5701 02 ff ff ff ffffffffffffffffffffffffff03 c97e82935b59
1B FF 5701 02 02 01 54 FFFFFFFFFFFFFFFFFFFFFFFFFF03 FFFDFF3B6145 10094D6920536D6172742042616E642034 0302E0FE 0716E0FE 0B000000 A5
@myhomeiot Thanks for this info.
I've updated the code, 11.7.0 should have heart rate and steps now.
@Ernst79 Should we add steps
here?
You are right. Fixed in 11.7.1
Hello, will this all work with Mi Band 7? And it seems to me that the presence sensor is still not a diagnostic, but one of the main sensors..
Are there any differences for CN/Global/regional versions of MiBand 6? I've put active scan on, both publishing options in Zepp Life app, but still having Unknown value for steps and heart rate. Any other important settings?
For presence, you can enable track device in the setting. I dont know if MiBand 7 is working, most likely not.
@p1ne try to enable debug logging for the mac address of your MiBand, such that we can check what is wrong.