DEV Community

Cover image for Reading Xiaomi Mi Scale data with Web Bluetooth Scanning API

Reading Xiaomi Mi Scale data with Web Bluetooth Scanning API

Henry Lim on May 10, 2020

The Web Bluetooth API provides the ability to connect and interact with Bluetooth Low Energy (BLE) peripherals. It was introduced in Chrome 56 on m...
Collapse
 
upieez profile image
Samuel Huang

That's so cool I never knew we could intercept the data like that. How did you manage to figure that out?

Collapse
 
henrylim96 profile image
Henry Lim

All thanks to this amazing documentation actually. Without that documentation/reverse engineering information, I would never figure out how to properly decode the BLE advertising packets.

I just decided to build it using Web Bluetooth API, since I realized no one did it before. (Same idea but built using other language: Android, Node.js, Python)

Collapse
 
upieez profile image
Samuel Huang

Awesome thanks for the insights!

Collapse
 
zawszy profile image
Zawszy

Hi, does it matter what xiaomi scale is used? Will this work: kogan.com/au/buy/xiaomi-mi-smart-s...

Collapse
 
anshulganar profile image
anshul-g-AnAr

It was great reference for me and really helped to understand how this works but I'm having different scale is there any way to to get the payload from it. , if I'm not able to find it from manufacturer.

Collapse
 
tomeuw34 profile image
Tomeu Barcelo

Hi, I downloaded your code from github. I have it in a local project, I have installed node correctly. But I don't get the message to access the Bluetooth device. I get a console.log with the following message: "Web Bluetooth Scanning is experimental on this platform. See github.com/WebBluetoothCG/web-blue..."

I use Chrome 79+ with the chrome://flags/#enable-experimental-web-platform-features flag enabled to use the API.

I don't know what's going on.

Thank you. Regards

Collapse
 
spyrou42 profile image
Konrad

Hi, very cool ! It's amazing that we can connect to the scale from the Web.
I saw on a teardown on some Xiaomi scales that they are 4 load cells. Is there any way to access data for each sensor ?