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

Hey @jdobosz,

thanks for this! I have to admit, I have zero experience in Bluetooth development and knowledge in the protocol used (RFCOMM).
It seems you got it working, so you have a piece of code that can unlock / lock your Yeelock? Could you maybe share it, so I may test myself, plus maybe try to make an integration out of it for HA?

Thanks and greetings,

Andy!

1 Like

Asking again: You maybe have an example ESP sketch that you can share? it sounds like you managed to lock and unlock using an ESP32?

Really appreciated, thx!

1 Like

fwiw: I also asked on GitHub an he replied he had no ssuccess:

Any updates?

Nothing concrete, yet. But I got some hints from somebody how to maybe tackle it. But it will take me 1-2 months still, as I don’t have an ESP32 board yet to try it out. If I can get it working with an ESP32 board (and actually understand what’s going on), I start looking into it how to do it as a native HA plugin without an ESP board (obviously, only if the hardware that runs you HA has Bluetooth :wink:

I will post here as soon as I know something, but again: It may take 1-2-3 months :slight_smile:

4 Likes

thank you for the answer, good luck

Just for the info. New E series Yeelock is out.

It’s cheaper on Ali.

I did not bought it just yet.

OK, but sadly same thing, different design in the end: Still only Bluetooth.
Will test it in the next 1-2 weeks to get it running with an ESP and then maybe just with an RPi… But chances are low that it will be easy…

Any updates?

Hello. Has anyone gotten any closer to get those to work with Home Assistant?
I own many of them and would love to be able to lock/unlock them in other ways apart from their app.
Thank you

Hi there,
Fortunately we are able to create our own android app to control Yeeloc Bluetooth locks.

Please get back to me by email if needed our services.

Any news integrating in home assistant. Maybe with an esp8266 or esp32.

We have successfully developed our own app to control YeeLock

Get in touch if you need to jawadaq82 at gmail dot com

1 Like

Any updates?

I too would be appreciative of any updates. I have two of these ready to go into a liquor cabinet, and a teenage son who will be soon interested in it’s contents lol. Already have a bunch of ESP32s around the house managing my plants :slight_smile:

To make an automation we will need a second device
Esp or android with tasker.
I guess no other options, HA does support any BLE hubs to control for now

Does your app give access to control Yeelock device by Home Assistant?
Or is it just a clone of the original app?

Thanks to @jdobosz and all other contributors, I was able to write a program for it! :champagne:

Please give some :star: on GitHub :grinning:
All details and instruction in the README here: GitHub - aso824/yeehack: Alternative way to control bluetooth Yeelock devices

I successfully ran my tool on RPi and connected with HA using NodeRED.
Now, I’ll try to write native HA integration, which will take a little time, because I want to use ESPHome device as remote BT adapter, and this will be my first HA integration :wink:

Feel free to open an issue in the repo if you’ll find any problems.

4 Likes

yes please. Has been looking out for HA integration. Thanks