HASS Addon TTLock offline integration

thank you @accelle. please let me know how it goes when you upload it to a wroom.

Thanks

I did build the GW using a ROVER and finally got it to work. Thanks again @netsplit64 for the details on what to change in the platformio.ini file!

I actually bought 2 different ESP32 ROVER boards and for some reason the first one I tried didn’t work for me (https://www.amazon.com/dp/B087TF2L27?psc=1&ref=ppx_yo2_dt_b_product_details). It occasionally managed to discover the lock but would not even succeed at pairing (no matter how close to the lock I put it).

The second one (https://www.amazon.com/dp/B09BC5CNHM psc=1&ref=ppx_yo2_dt_b_product_details ) is the one that worked. I had to place it really close to the lock in order to pair successfully. Since then, I moved it a little bit away and it seems to be working fine.

Thanks again @kind3r for your work! I guess next step is to figure out a way to get multiple ESP32 GWs working with the addon to allow controlling the multiple ttlock devices in the house.

1 Like

Hi using the details from this post, Iam now up and running, if anyone is interested i used this board Freenove ESP32.

Sorry for the continued annoying post by myself, i had to pull the batteries today, to take the Multipoint lock to pieces, as it keeps catching, i note on repowering up i now have invalid date anyone know how to fix this?

Hi, I would like to understand what ready-made usb adapter I could take for RPI4. In a usb I have the conbee 2, I still have a free one I would like to understand what I can use? something simple to use with hassio.
The Rpi4 does not have bluetooth already integrated that I can use? Thank you.

Hi, can’t pair my door lock but the log discovered one lock. Can anyone help?

‘’’

[email protected] start
node ./index.js
[Error: ENOENT: no such file or directory, access ‘/data/lockData.json’] {
errno: -2,
code: ‘ENOENT’,
syscall: ‘access’,
path: ‘/data/lockData.json’
}
[Error: ENOENT: no such file or directory, access ‘/data/aliasData.json’] {
errno: -2,
code: ‘ENOENT’,
syscall: ‘access’,
path: ‘/data/aliasData.json’
}
MQTT connected
Monitor started
Server started
Discovered unknown lock: {“id”:“2572f0f9aeac”,“manufacturer”:“unknown”,“model”:“unknown”,“hardware”:“unknown”,“firmware”:“unknown”,“address”:“25:72:F0:F9:AE:AC”,“rssi”:-51,“protocolType”:5,“protocolVersion”:3,“scene”:2,“groupId”:0,“orgId”:0,“lockType”:5,“isTouch”:true,“isUnlock”:false,“hasEvents”:false,“isSettingMode”:false,“txPowerLevel”:0,“batteryCapacity”:60,“date”:0,“isWristband”:false,“isRoomLock”:true,“isSafeLock”:false,“isBicycleLock”:false,“isLockcar”:false,“isGlassLock”:false,“isPadLock”:false,“isCyLinder”:false,“isRemoteControlDevice”:false,“isDfuMode”:false,“isNoLockService”:false,“remoteUnlockSwitch”:0,“disconnectStatus”:0,“parkStatus”:0,“lockSound”:-1,“autoLockTime”:-1,“privateData”:{},“operationLog”:} ‘’’

Hi, can you please tell me how did you manage to get notification, add the Ttlock supported lock to HomeKit?
I’m using a smart door lock from Aliexpress (see picture), I only have one old MacBook Pro 2010 running High Sierra,


I don’t have Windows computer or Raspberry PI. It is possible to add my smart door lock to Apple HomeKit (for automation, receive notifications, see status update)? Please let me know. Maybe @kind3r will guide me with step by step what to do from the beginning.

Have a great day!

Hi ya,

Thank you so much for the development and great effort!
After i read the this post, i was really excited and placed an order for TTLOCK door handle lock with finger print and passwords. I have tried on my raspi4 using this integration but i was struggling to get it connected. I managed to find the lock during the scanning and managed to pair it. However, without a sec delay, the lock is disconnected. I have attached the logs as per below:

‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’

IGNORE CRC TRUE
Debug communication ON
Debug MQTT
Debug gateway

[email protected] start
node ./index.js
MQTT connected
Monitor started
Discovered paired lock: CE:97:A8:92:87:A2
Monitor stopped
Peripheral connect start
Server started
Peripheral connect triggered
Peripheral state: connected
Device emiting connected
BLE Device reading basic info
BLE Device discover services start
BLE Device discover services end
BLE Device read characteristics start
BLE Device read characteristics end
BLE Device read characteristics start
BLE Device read characteristics end
BLE Device read basic info
BLE Device subscribed
Connected to known lock, reading general data
========= feature list
Sending command: 7f5a0503010001000101aa001c0d0a
Lock waiting for connection to be completed
Received response: 7f5a050302000a005454aa20709580730566cc7b9a08ef87eb00d6d87446e16a06bda8970de258c9dae055d3410d0a
Bad CRC should be 19 and we got 65
Command: 3821c4f1f5000c27440000000000000000
<Buffer 38 21 c4 f1 f5 00 0c 27 44 00 00 00 00 00 00 00 00>
========= feature list Set(16) { 0, 2, 4, 5, 6, 7, 8, 12, 13, 14, 15, 18, 22, 23, 24, 29 }
========= check admin
Sending command: 7f5a0503010001000141aa103cb4a149eb4b69b92629970b37e9276ab40d0a
Received response: 7f5a050302000a005454aa102702e1fc7009d2fe745e64b553b769dd660d0a
Bad CRC should be 194 and we got 102
Command: 0000cdf8
========= check admin: 52728
========= check random
Sending command: 7f5a0503010001000130aa104ee9bb50b396077513d695cbbb48b541080d0a
Received response: 7f5a050302000a005454aa1005ab116e11ac2eb5da08ada4e4646a216f0d0a
Bad CRC should be 203 and we got 111
Command: 38
========= check random
========= autoLockTime
Sending command: 7f5a0503010001000136aa10fd2dbcfaf511511e8e91b896de81683d7c0d0a
Received response: 7f5a050302000a005454aa101d0ee2cce79ae75a911e125465e9ec9a640d0a
Bad CRC should be 192 and we got 100
Command: 380100050001038401
========= autoLockTime: 5
========= lockSound
Sending command: 7f5a0503010001000162aa10fd2dbcfaf511511e8e91b896de81683d820d0a
Received response: 7f5a050302000a005454aa10311f58524f9e5e0c53cc05dc6588f78ee90d0a
Bad CRC should be 77 and we got 233
Command: 380101
========= lockSound: 1
Connected to paired lock CE:97:A8:92:87:A2
MQTT Publish homeassistant/lock/ce97a89287a2/lock/config {“unique_id”:“ttlock_ce97a89287a2”,“name”:“PLDT190_a28792\u0000\u0000\u0000\u0000”,“device”:{“identifiers”:[“ttlock_ce97a89287a2”],“name”:“PLDT190_a28792\u0000\u0000\u0000\u0000”,“manufacturer”:“Sciener”,“model”:“SN373-R-150MS-T12”,“sw_version”:“6.4.11.220206”},“state_topic”:“ttlock/ce97a89287a2”,“command_topic”:“ttlock/ce97a89287a2/set”,“payload_lock”:“LOCK”,“payload_unlock”:“UNLOCK”,“state_locked”:“LOCK”,“state_unlocked”:“UNLOCK”,“value_template”:“{{ value_json.state }}”,“optimistic”:false,“retain”:false}
MQTT Publish homeassistant/sensor/ce97a89287a2/battery/config {“unique_id”:“ttlock_ce97a89287a2_battery”,“name”:“PLDT190_a28792\u0000\u0000\u0000\u0000 Battery”,“device”:{“identifiers”:[“ttlock_ce97a89287a2”],“name”:“PLDT190_a28792\u0000\u0000\u0000\u0000”,“manufacturer”:“Sciener”,“model”:“SN373-R-150MS-T12”,“sw_version”:“6.4.11.220206”},“device_class”:“battery”,“unit_of_measurement”:“%”,“state_topic”:“ttlock/ce97a89287a2”,“value_template”:“{{ value_json.battery }}”}
MQTT Publish homeassistant/sensor/ce97a89287a2/rssi/config {“unique_id”:“ttlock_ce97a89287a2_rssi”,“name”:“PLDT190_a28792\u0000\u0000\u0000\u0000 RSSI”,“device”:{“identifiers”:[“ttlock_ce97a89287a2”],“name”:“PLDT190_a28792\u0000\u0000\u0000\u0000”,“manufacturer”:“Sciener”,“model”:“SN373-R-150MS-T12”,“sw_version”:“6.4.11.220206”},“unit_of_measurement”:“dB”,“icon”:“mdi:signal”,“state_topic”:“ttlock/ce97a89287a2”,“value_template”:“{{ value_json.rssi }}”}
MQTT Publish ttlock/ce97a89287a2 {“battery”:56,“rssi”:-50,“state”:“LOCK”}
Successful connect attempt to paired lock CE:97:A8:92:87:A2
Disconnected from lock CE:97:A8:92:87:A2
“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”“”

I tried all the suggestions you have mentioned in the post, i.e. wait for restart, wait for 30sec, touch the lock and pairing them. But still no luck. Could you kindly point me to the right direction? really appreciate that.

Can anyone break down for me the hardware needed for this? I’d love to get one of these TTLock multipoints, but its a little unclear exactly how you get the BLE to work.

My Hass is a virtual server (VMWare) in another part of the house, so is there such a thing as a bluetooth to WIFI dongle, or bluetooth to ethernet hardware that I’d need to be able to do this?

Am I better off just getting the gateway that these come with to connect to my WIFI, can HASS and this integration use the gateway to control the locks instead of bluetooth?

I am not an expert but:
I think the gateway uses its own Bluetooth to connect with the locks. The locks don’t have any other connectivity, only Bluetooth - so either you connect with them by standing close by and using Bluetooth from a phone etc, or you connect with them using the gateway, which you can access through wifi and this integration.

My HA’s Bluetooth is not used for any of these connections; HA → gateway → locks.

Unsure how you could do this without the gateway, since the integration uses the manufacturer’s API to interact with the gateway connection to the locks.

Yeah thanks, that’s what I wanted to know. It seemed like we were talking about Bluetooth being the only connectivity. But the API is available through the gateway, so it can work offline ?

That’s pretty much all I wanted to know! Thanks

1 Like

The API calls back to TTLOCK’s servers, so no, it’s not able to work offline.

Ok, isn’t that what the whole thread is about? This hass add-on they lets you control it offline? :rofl:

You’re right - I’m very sorry; I’ve mixed up my threads, as I use a different TTLOCK integration that IS online. Apologies!!

Most of the above has confused me but my lock arrives tomorrow
What is a step by step updated simple way for me to pair the lock as I’ll be using my rpi4 running hassio and the built in Bluetooth of it any assistance would be greatly appreciated also how to connect to mqtt

if anyone has a better step by step on how to do the gateway, it would really help me out kinda lost on what iam reading !! thnaks jeff

1 Like

@kind3r
Are you still working on this
While scanning my lock can be found but won’t pair and sometimes it’s just not found at all has there been any updates with this

1 Like

I also need a more detailed guide, not familiar with the software at all and it’s really confusing trying to piece together from what’s in the thread.

1 Like

Hello everyone.
My lock is discovered, but it does not pair. I use raspberry pi 4 and docker installation (Container).
I thing I have installed something in the wrong way.
@kind3r Can you make a detailed instruction for noobs like me?
I even dont understand where I should put const noble = require('@abandonware/noble');?

Hi,
Can anyone help me understand the BLE gateway setup? I cant get it to build. Here is the terminal. Any help or direction would be appreciated.

Building in release mode
Compiling .pio\build\esp-wrover\src\gw_settings.cpp.o
Compiling .pio\build\esp-wrover\src\main.cpp.o
Compiling .pio\build\esp-wrover\src\noble_api.cpp.o
Compiling .pio\build\esp-wrover\src\security.cpp.o
Compiling .pio\build\esp-wrover\src\web.cpp.o
In file included from src/security.cpp:1:
src/security.h:4:10: fatal error: hwcrypto/aes.h: No such file or directory
 #include <hwcrypto/aes.h>
          ^~~~~~~~~~~~~~~~
compilation terminated.
In file included from src/gw_settings.h:5,
                 from src/gw_settings.cpp:1:
src/security.h:4:10: fatal error: hwcrypto/aes.h: No such file or directory
 #include <hwcrypto/aes.h>
          ^~~~~~~~~~~~~~~~
compilation terminated.
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\NimBLESecurity.cpp.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\NimBLEServer.cpp.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\NimBLEService.cpp.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\NimBLEUUID.cpp.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\NimBLEUtils.cpp.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\esp-hci\src\esp_nimble_hci.c.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\ext\tinycrypt\src\aes_decrypt.c.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\ext\tinycrypt\src\aes_encrypt.c.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\ext\tinycrypt\src\cbc_mode.c.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\ext\tinycrypt\src\ccm_mode.c.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\ext\tinycrypt\src\cmac_mode.c.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\ext\tinycrypt\src\ctr_mode.c.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\ext\tinycrypt\src\ctr_prng.c.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\ext\tinycrypt\src\ecc.c.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\ext\tinycrypt\src\ecc_dh.c.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\ext\tinycrypt\src\ecc_dsa.c.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\ext\tinycrypt\src\ecc_platform_specific.c.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\ext\tinycrypt\src\hmac.c.o
Compiling .pio\build\esp-wrover\lib60c\NimBLE-Arduino\ext\tinycrypt\src\hmac_prng.c.o
*** [.pio\build\esp-wrover\src\security.cpp.o] Error 1
*** [.pio\build\esp-wrover\src\gw_settings.cpp.o] Error 1
In file included from src/gw_settings.h:5,
                 from src/web.h:16,
                 from src/web.cpp:1:
src/security.h:4:10: fatal error: hwcrypto/aes.h: No such file or directory
 #include <hwcrypto/aes.h>
          ^~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\esp-wrover\src\web.cpp.o] Error 1
In file included from src/gw_settings.h:5,
                 from src/main.cpp:7:
src/security.h:4:10: fatal error: hwcrypto/aes.h: No such file or directory
 #include <hwcrypto/aes.h>
          ^~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\esp-wrover\src\main.cpp.o] Error 1
In file included from src/gw_settings.h:5,
                 from src/noble_api.h:12,
                 from src/noble_api.cpp:1:
src/security.h:4:10: fatal error: hwcrypto/aes.h: No such file or directory
 #include <hwcrypto/aes.h>
          ^~~~~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\esp-wrover\src\noble_api.cpp.o] Error 1
================================================================================================================================= [FAILED] Took 6.28 seconds =================================================================================================================================

Environment    Status    Duration
-------------  --------  ------------
esp-wrover     FAILED    00:00:06.282
============================================================================================================================ 1 failed, 0 succeeded in 00:00:06.282 ============================================================================================================================