Github Devices Community Docs Blog

ESP32 BLE Scale support XIAOMI / YUNMAI

Is the Xiaomi Scale required any authorization like PIN code with the Android or Apple application?

Here is some information that should help me supporting the Yunmai if equal to Mi Scale V2:

Thank you I will take a look

With the information provided in this link I should be able to integrate both versions of mi scale, once done if you could test it, you will enable to validate the code.

Yes I’m willing to help with testing.

I have updated the code with Xiaomi Scale V2 implementation:

If you can test it and post your serial monitor/MQTT output it would be nice.

Here is the serial monitor/MQTT output :

— Miniterm on COM5 115200,8,N,1 —
— Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H —
mounting FS…
mounted file system
reading config file
opened config file
{“mqtt_server”:“10.0.0.xxx”,“mqtt_port”:“xxxx”,“mqtt_user”:“xxxxx”,“mqtt_pass”:“xxxxxx”}
parsed json
*WM: [3] allocating params bytes: 20
*WM: [2] Added Parameter: server
*WM: [2] Added Parameter: port
*WM: [2] Added Parameter: user
*WM: [2] Added Parameter: pass
*WM: [1] AutoConnect
*WM: [2] ESP32 event handler enabled
*WM: [2] Connecting as wifi client…
*WM: [1] STA static IP:
*WM: [2] setSTAConfig static ip not set
*WM: [3] WIFI station disconnect
*WM: [1] Connecting to saved AP: xxxxxxx
*WM: [3] Using Password: xxxxxx
*WM: [3] WiFi station enable
*WM: [2] 5000 ms connectTimeout set
*WM: [2] 5000 ms timeout, waiting for connect…
*WM: [2] .
*WM: [2] .
*WM: [2] .
*WM: [2] .
*WM: [2] .
*WM: [2] .
*WM: [2] .
*WM: [2] .
*WM: [2] .
*WM: [2] .
*WM: [2] Connection result: WL_CONNECTED
*WM: [3] lastconxresult: WL_CONNECTED
*WM: [1] AutoConnect: SUCCESS
*WM: [1] STA IP Address: 10.0.0.xxx
connected…yeey :slight_smile:
saving config
{“mqtt_server”:“10.0.0.xxx”,“mqtt_port”:“xxxx”,“mqtt_user”:“xxxx”,“mqtt_pass”:“xxxxxx”}*WM: [3] freeing allocated params!
*WM: [3] unloading
OpenMQTTGateway mac:
30:AE:A4:7D:1C:xx
OpenMQTTGateway ip:
10.0.0.xxx
xxxx
Connecting to MQTT by IP adress
10.0.0.xxx
BLEinterval btw scans
55555
ZgatewayBT multicore ESP32 setup done
MQTT_MAX_PACKET_SIZE
1024
Setup OpenMQTTGateway end
BT Task running on core 0
client disconnected
MQTT connection…
Connected to broker
Subscription OK to the subjects
Creating BLE buffer
device detected
0C1C57A4BAxx
BLErssi
-66
txPower
-59
BLE DISTANCE :
2.25
Pub json into:
home/home_presence/OpenMQTTGateway_ESP32_BLE
{“id”:“0c:1c:57:a4:ba:xx”,“name”:“YUNMAI-SIGNAL-H1WS”,“manufacturerdata”:“d��W␜\f”,“rssi”:-66,“txpower”:0,“distance”:2.246586}
Pub json into:
home/OpenMQTTGateway_ESP32_BLE/BTtoMQTT/0C1C57A4BAxx
{“id”:“0c:1c:57:a4:ba:xx”,“name”:“YUNMAI-SIGNAL-H1WS”,“manufacturerdata”:“d��W␜\f”,“rssi”:-66,“txpower”:0,“distance”:2.246586}

It seems that yunmai scale are not advertising the weight per service data (contrary to the xiaomi ones) meaning that it will not be easy to add them.

Does someone could tests the xiaomi scale v2 implementation ?

How about xiaomi scale v1. I have already tested it. it did a good job with weight less than 10kg.
More than that it is wrong or do I miss something.
Like this.
Untitled
And the result: {"weight:17.34}

Hello,

Could you post the service data published to the broker corresponding to this false weight ?

1 Like

@pavon87 does your xiaomi scale looks the same as this one ?

I will do when I am home. Thanks for your quick response.

I don’t know how to get service data in my broker. So post them all in the top. I used MQTT explorer.
My broker is an addon in Home Assistant.
The bottom picture is from nrf connect.
So let’s see what is wrong. I took these two pictures at the same time when I was on my scale.

Thanks.

This issue has been corrected by @kanttti and is no longer present in the development branch

It works like a charm. Thank you very much.

Untitled

1 Like