0

I am trying to getting data from mi scale V2. I am getting service data like this: “serviceData”: {“0000181b-0000-1000-8000-00805f9b34fb”: “BiTlBwcZFgsYAAAmAg==”}(5.15kg) and I decode the base64 string to array like this [66, 105, 84, 108, 66, 119, 99, 90, 70, 103, 115, 89, 65, 65, 65, 109, 65, 103, 61, 61] But I can not retrieve the correct result. How can I get the weight data?

2 Answers2

0

The UUID 0000181b-0000-1000-8000-00805f9b34fb belongs to the pre-defined Body Composition Service (BCS). You can download the specification from here.

It should have the two characteristics Body Composition Feature and Body Composition Measurement.

The Features characteristic shows you the features supported by your scale, the measurement characteristic returns the actual measurement.

Take a look at this answer where I explain the process of decoding a sample weight measurement.

Michael Kotzjan
  • 2,093
  • 2
  • 14
  • 23
0

UUIDs with the format of 0000xxxx-0000-1000-8000-00805f9b34fb are an officially adopted Bluetooth SIG UUID and can be looked up online.

If you look at the following URL: https://www.bluetooth.com/specifications/assigned-numbers/ there is a document with the title "16-bit UUIDs". I can see from that document that 0x181b is Body Composition GATT Service.

According to the "Body Composition Service 1.0" document at: https://www.bluetooth.com/specifications/specs/ there should be a Body Composition Feature (0x2A9B) and a Body Composition Measurement (0x2A9C) characteristic available for that service.

It will be the Body Composition Measurement characteristic that will contain the weight value.

A generic Bluetooth Low Energy scanning and exploration tool like nRF Connect can be useful when exploring and understanding the data on a device.

ukBaz
  • 6,985
  • 2
  • 8
  • 31
  • Thanks you for responding and taking time. I Have downloaded the nRF Connect mobile and I looked the data from the scale. nRF I found the uuid:0x2A9C body composition measurement but when I logged the terminal data getting from my app. I can not see any hexadecimal number. –  Jul 26 '21 at 10:26
  • What do you see when reading the characteristic using nRF Connect? – Michael Kotzjan Jul 26 '21 at 10:32
  • The Body Composition Measurement characteristic has a flag of `Indicate` so you are probably not be able to "read" the value. You will need to enable `notifications` (which is done by clicking on the multiple-down-arrows icon against the characteristic in nRF Connect) – ukBaz Jul 26 '21 at 10:35
  • When the icons on the right are missing, it normally means the device is disconnected. – ukBaz Jul 26 '21 at 10:48
  • Yeah, you are right, sorry for this. I uploaded the new one here: https://imgur.com/2shVS3F –  Jul 26 '21 at 10:56
  • What happens if you click on the up-down-arrows next to `0x2A9C`? Do you get some data sent? – ukBaz Jul 26 '21 at 11:07