Add support for Xiaomi Body Composition Scale S400#1297
Add support for Xiaomi Body Composition Scale S400#1297JPFrancoia wants to merge 6 commits intooliexdev:masterfrom
Conversation
|
Currently I am on holiday but a quick feedback. |
|
Thanks so much for the feedback! I'll get right on that. Enjoy your holidays! |
|
👋 Ok I made an attempt at shoving scale-specific UI settings in their respective handler. The trick is declaring a |
Hi,
Thank you for maintaining openScale. I just bought the Xiaomi Body Composition Scale S400 and I noticed openScale didn't support it, so here we are.
I didn't reverse the bluetooth protocol myself, I leveraged the work done in this repo, so that sped things up.
This scale uses encryption in its bluetooth protocol, so the BLE key must be extracted. Here is how:
1. Initial Scale Setup (if not done)
2. Extract Tokens Using Xiaomi Cloud Tokens Extractor
When prompted:
defor Germany,usfor USA,cnfor China)3. Find Your Scale's Information
The extractor will output a list of all your Xiaomi devices. Look for your scale:
Save these two values:
XX:XX:XX:XX:XX:XX)4. Kill the Xiaomi Home App
Kill the app or uninstall it.
Once you have the key, this is pretty straightforward.
This is a measurement done with the Xiaomi Home App:
This is a measurement done with openScale (there is a difference because I did the measurement in the Xiaomi Home app the day after, while making this PR, to prove that it works):

Here are a few other screenshots:
To be clear: I built the app locally in debug mode, sideloaded it onto my phone and performed a real measurement.
I had to add a little bit of UI to add the BLE bind key in the setting. I couldn't find an existing example in openScale where this was done already, please let me know if I missed it.
Disclaimer: I did use AI to write most of the code. However I reviewed the code to the best of my abilities and I carefully tested the app. I compared all the metrics one by one with the official app to make sure that the values make sense in openScale.