Hi guys, I’ll explain you how I got to control the lock with an esp8266.
-
I disassembled the lock trying to find some wires or some possibility to control the motor with MQTT protocol.
-
I found four wires going from the main board to the touch switch. (You can see them in the photo from zanerv)
-
I checked the wires and I realized about the code color: red -> positive, ground -> negative, withe -> data and yellow -> data. After this I tried to decode the protocol connecting the data wires from the touch switch to a ftdi usb adapter. I realized that when I pushed the switch to open it sent an 0 and when I pushed it to 1 it sent an 0 too, so I was confused.
-
After I have tried with serie protocol, I used a logic analyzer, and I realized that when I pushed to open, the switch down pulse from the yellow wire during 19 ms and when I pushed to close the pulse was down during 43 ms. So I discovered how it worked.
-
Knowing how it worked, I got a ESP8266 and I developed a program with arduino IDE to send both pulses to one pin depending of an mqtt message. This is the code: Xiaomi Sherlock MQTT code
-
I added also to the code the possibility to continue detecting the touch switch. So the pinout of the esp8266 will be the next:
-
I put the esp8266 out from the lock and the wires over the plastic case:
-
Take attention that it’s necessary to connect the positive and negative directly to the lock battery.
-
I attach also two photos with circuit finished and with the case closed:
-
And finally the project is finished, I tried to be as much specific as I can, if you need some more details just tell me and I’ll explain you! I don’t know if this one is the best solution but I have done it some days ago and until now it’s working really good