React Native Mi Scale Weight Data

869 Views Asked by At

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

There are 2 best solutions below

0
Michael Kotzjan On

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.

6
ukBaz On

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.