Xiaomi Sherlock Smartlock

Ok, so that’s not for the latch but for the lock, correct? (I have 2 the upper latch and the bottom lock). Could you please share a link of the switch

Hello,
I am trying to create a Raspberry´s Android installation, than I will try to connect to Sherlock with buint-in bluetooth.
If not needed, I will not installl Xiaomi apk, and will be possible to develop various plugins to remotely connect to Sherlock.
However, it is necessary to install Sherlock software, correct? And open it before the commands?

- 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" }}'

I understood that keyevent 26 turn on/off the screen of your Android device, and swipe is a simulation of touch the screen in X,Y position (like swiping the secree). Is this correct?

One last thing… the value that you got from SherlockLog is the last command give to the apk, correct? Not exactly the key position, if we could lock/unlock manually with a key?

Regards.

I just got my money back but don’t have to return the device. So, does someone want a silver right side open Sherlock S2 for free? You’ll have to pay for shipping from The Netherlands. 2 keys are included, one of which has been opened up, because of the keyfob mod.

-Mathis

3 Likes

Interested!

Sent a PM.

Hello all,
I recently bought Sherlock M1 and… It’s little frustration.
Key sharing thru family do NOT work well due shame of Xiaomi.
M1 doesn’t work via “BT only” as like S2 version. M1 also needs internet connection at client side (at the phone), probably to get permission from Xiaomi servers or worse, due for private keys are saved at China servers, not stored locally, at the phone!

If xiaomi server is down, slow or has an unreliable connection to China servers somehow ( due firewalls, etc…) your lock simply doesn’t work at all. This totally kills the reliability of the M1 device. So do NOT buy M1 devices.

S2 versions at the other hand probably works only BT commands. So I don’t think if there are any reliability issues at all. And this why M1 doesn’t work with keyfobs but S2.

I don’t know if same chip used at M1…But I think only meaningful way to use this device is … make a custom firmware to nRF52 chip. There are arduino compatible dev kits available for nRF52.
I made some programs with nRF51’s before but don’t programed on nRF52. Also don’t know if current program loaded at chip if let us allow to reprogram our custom FW. But If it possible, than we could make anything that we want with this HW.

Guys I “cracked” the smart lock and you can open/close the requirements it’s that you need to have the app installed in an android device and use ADB (you can use wireless adb too) I decompile the app and you can force the “widget” service to work, seems with this “widget method” i can even know if the lock it’s open or closed (but i will have to write an android app to know the current status) I might work this later, and i hope “sherLock” does not “fix”, if i make the app I can connect with tasker or use another mqtt plugin to send the status of the lock!!!

android api 26+:
adb shell am start-foreground-service -n com.aerolite.smartlock/com.aerolite.sherlock.pro.device.widget.DeviceWidgetService --ei "REQUEST_PARAMS" 10
android <26:
adb shell am startservice -n com.aerolite.smartlock/com.aerolite.sherlock.pro.device.widget.DeviceWidgetService --ei "REQUEST_PARAMS" 10
"REQUEST_PARAMS" 10 //it's to unlock
"REQUEST_PARAMS" 11 //it's to lock

Update: Sadly seems the app does not work on my tablet (I’m using as dashboard so I could use it to open de door as well) so I guess i will have to connect a phone to the PI

3 Likes

is there a way to make it with ESPhome? Can you please share your code if you did it

Hello, can you explain how you do this, how to connect sonoff and button, thanks

Hi Russ,

I removed the circuit board from the original keyfob and connect it to a sonoff wireless switch. Also used a stepdown module to power the board of the key which works with 3v and the sonoff which uses 5v.
On the picture you can see the parts I used.
I wanted to share all the pics I made, but it allows me to upload only one and reply 3 times since I’m new.
I can send it all in a private msg If you want.
Hth,
Tamas

3 Likes

2 Likes

1 Like

This is great but I am not profesional in electronic, should be nice if you could send some information about connection between those electronic parts. I have sonoff switch 5V and I ordered keyfob, so I need stepdown modul and sheme how to connect that all. Thank you

Hi Tamas,

I found SONOFF RE5V1C Relay Module but can you tell me please how to find another 2 modules in aliexpress, DSN mini 360 and DS6021? Also, can you send me please detail schematic how to connect all modules. I see also one resistor connected between sonoff and keyfob, can you write the resistor?

Thanks, Dime

Hi Dimitar,
The black round one is from the original key.


The DS6021 is only a micro USB connector on a board - so this project can be powered with an old phone charger. The other board(DSN mini360) is the step down modul which can make 3v from 5v. You can find it if you just type “step down module”, but here is an example:

#Aliexpress € 0,65 | MP1584EN DC-DC step-down power supply module 3A adjustable step-down module super LM2596 ultra-small size size DCDC

Cannot draw you schematic, I only have my phone with me, but it is quite straightforward.
You just need to:
Give 5v input to the sonoff - marked on the board “in”
Give 5v input to the stepdown module - also marked
Set output to 3v with the potencio meter on the stepdown module.(or you can buy one which is fixed to 3.3v)
Connect the output from the stepdown to the board of the key where the battery used to be.
And finaly connect the sonoff “L” and “out” pins to the two side of the fiscal button on the key (as on the of the picture I sent with all the modules.)

That is it.
After you just download the app for sonoff, set the switch to inching mode, the intervall to 500ms and it is all set.
Hth
Tamas

3 Likes

Hi Russ,
Please see how to connect everything in my reply to Dimitar.
After this setup it should be fairly easy to hook it up with your home assistant, I also used a routine to have a custom command like “open the door” instead of “turn on this and that” switch.

And this is the final setup:

Regards,
Tamas

Ok, thank you, I ordered power supply module ac dc 3.3V (for “battery”) hope it would be ok. Also, have you using it for lock and unlock the door?

Hi Tamas,

thank you very much for the detailed information followed by the pictures. I can’t see just where exactly the two wires on the key switch are connected but it will surely become clear to me when I have the key in my hand :slight_smile: . In any case, your solution is much simpler and smaller than any other.

Greeting, Dime

Tamas what do you think, what is better security solution, sonoff wi-fi or sonoff rf 433Mhz?

Hi Russ,
I am using it to open the door, since I have no handle on the outside of my door, just a knob. So the main purpose was to be able to open it from anywhere by phone if me or my family locks out themselves.

However you can also double tap the button in the app to send the command twice. In this way you can use the lock and unlock functionality.

Unfortunately if you would like to use both function with voice control and not only open the door, It can be also done with some extra steps.

An extra sonoff and arduino mini/nano or any other Arduino board to repeat the signal could do the trick.

Regards,
Tamas