Xiaomi MIjia YEELOCK integration

Hi,
I’m now able to make it work using an ESP32, thank to this thread, some sample frames to lock/unlock : https://github.com/cnrd/yeelock and also the SDK.
I hope it will be clear enough :

here is a sample frame to send : 01505c84ff2f0099cf13d74d5b246c38eb6cf702
01 : unlock command
50 : admin identification mode (? maybe it meens i’m not using a shared key …)
5c84ff2f = 1552219951 = Sunday, March 10, 2019 12:12:31 PM (epoch time)
00 : unlock mode (unlock/wait/lock again) (01=unlock only) (02=lock only)
99cf13d74d5b246c38eb6cf702 : 14 first bytes of HMAC, using “ble_sign_key” as key and SHA-1 as variant (see https://www.liavaag.org/English/SHA-Generator/HMAC/)

ble_sign_key can be found with fiddler or mitmproxy with android device and maybe a not so recent app version.

On notification chanel you will probably receive an “APP_TX_SET_SYS_TIME_REQ” message, clock has to be set, in order to synchronise it (first byte of notification message=0x09)

In this case you have to send this kind of message before trying again :
08 : set time
40 : admin identification mode (?)
4 next bytes : epoch time in hexa

using my esp32, it works fine !!!
BLE uuid to send commands : 58AF3DCA-6FC0-4FA3-9464-74662F043A3B
BLE uuid to receive notifications : 58AF3DCA-6FC0-4FA3-9464-74662F043A3A

I hope it can help.

4 Likes