Xiaomi Sherlock Smartlock

Hi,
I’ve just found that new Startblock by Xiaomi which was released a few months ago. It’s set up on top of your existing lock and communicates via bluetooth. Might there be a way to integrate this to home assistant? Seems pretty interesting for only about 70€/85$ :thinking:

https://www.aliexpress.com/item/In-Stock-Xiaomi-Sherlock-Smart-lock-M1-mijia-Smart-door-lock-Keyless-wireless-remote-control-work/32858734799.html

Maybe this would be helpful for a possible integration: https://github.com/aholstenson/miio

I think that this one is more promising.
Looks like a Zigbe version
https://www.aliexpress.com/item/Aqara-Original-Practical-Anti-theft-Security-Door-Lock-Core-with-Key/32851519784.html?

first that seemed to be an interesting one, but the lock isn’t motorized so you just can log opening and closing of your door, wouldn’t be that interesting for me because I’m using a aqara door sensor already and they are a lot cheaper :confused:

You are right. It is not motorised, but Sherlock is bluetooth only.

yes i know, but I’m also using Mi Flora for plantmonitoring via Bluetooth and they work well with my raspberry 3 and hass.io … so there musst be a possibility… I’ve also seen that you can use a raspberry mini for range extension of your bluetooth if the smart lock wouldn’t be in the ratio of the main home assistant instance

I might have found an interesting update. so Xiaomi startet to combine Bluetooth LE and wifi in their new yeelight lamps, so they can be used as a hub to connect xiaomi bluetooth devices to wifi. I’ve seen it for Mi Flora and also for the newer temperature sensors with display, so it might be that the lock could communicate with the lamp gateway
https://ibb.co/fuejZm


I own both a Sherlock m1 and a BLE gateway and I can see in the MI home app that the Sherlock is found and connected by BLE gateway, but i cant find a way to expose the lock states to the home assistant, any ideas would be great.!

1 Like

Hello there,
I also own the Sherlock M1 and a yeelight ceiling lamp with gateway compatibility.
I can’t seem to connect the Sherlock to the internet with it…
Can you lock/unlock it while away?
If you can, could you tell me if you performed a software update to it? Mine is updated and I contacted Xiaomi, and they told me this isn’t possible with the lock.

unfortunately, I cant, it shows connected as you see in the image I posted but I cannot control it while away. I am trying to accomplish the same.

Hey guys,
I managed to get it connected to hass :slight_smile:
I’m using an old android phone connected by usb to hass so I can send unlock/lock commands and also get the status.

- platform: command_line
  switches:
    door:
      friendly_name: Door Lock
      command_on: /bin/bash -c "adb shell input keyevent 26&&sleep 0.2&&adb shell input swipe 360 1000 150 1000;adb shell input keyevent 26"
      command_off: /bin/bash -c "adb shell input keyevent 26&&sleep 0.2&&adb shell input swipe 360 1000 580 1000;adb shell input keyevent 26"
      command_state: /bin/bash -c "adb shell cat /storage/sdcard0/Android/data/com.xiaomi.smarthome/files/SherlockLog/$(date +%Y%m%d.log)|grep mOperateCommandType|tail -1| grep -oP '(?<=mOperateCommandType:).*?(?=\r)'"
      value_template: '{{ value == "Lock" }}'
8 Likes

amazing achievment, do you understand inner working of the app ? is there some “magic” which could not be done through python or NodeRed ? I can see you are basically emulating touch in the app but it would be really nice if we could get and send data the BT way somehow.

I haven’t spent too much time on it, but I guess you can try to

  • decompile the apk and reverse engineer it
  • use a BT sniffer and check if it really encrypts the traffic as they advertise it
  • if you have the second version…it has a BLE remote and you can hook it up to gpio pins
  • I have opened it and it has a serial port inside so that’s an option too
    There are several solutions for that, but I choose the easy one :slight_smile:
    I took some pictures while I took it apart, if you guys are interested let me know
2 Likes

can send me dissasembly pictures and board pictures? thanks

Here you go, it is not that difficult to get it open

2 Likes

Hello,

Have you managed to control the smart lock somehow via the internet?

Hello,

Have you managed to achive any advancement with the gateway?

@zanerv is it possible to hock esp8266 to serial make it controll the module !?

It doesn’t have an option to be controlled over internet, but hass can control it (with the above command_line switch)and you can control hass over internet/vpn.
At the moment I have it setup to lock the door a few minutes after we leave and open automatically when we’re connected to the wifi

1 Like

It should be possible to do exactly that or replace the electronic part with an esp + a few addons and get almost the same functionality.
I didn’t go this road because of esp high power consumption

BT is very unstable with my old android phone, is there any other way to connect the lock with HA?