TTLOCK Integration with HA

The log looks like this after every try

Peripheral connect start
Monitor started
Peripheral connect triggered
Peripheral connect error: Error: connection canceled!
    at Peripheral.cancelConnect (/app/node_modules/@abandonware/noble/lib/peripheral.js:61:26)
    at NobleDevice.connect (/app/node_modules/ttlock-sdk-js/dist/scanner/noble/NobleDevice.js:91:37)
    at async TTBluetoothDevice.connect (/app/node_modules/ttlock-sdk-js/dist/device/TTBluetoothDevice.js:47:17)
    at async TTLock.connect (/app/node_modules/ttlock-sdk-js/dist/device/TTLock.js:53:27)
    at async Manager._connectLock (/app/src/manager.js:583:21)
    at async Manager.initLock (/app/src/manager.js:163:13)
    at async WebSocket.<anonymous> (/app/api/index.js:52:30)
Connect failed
Lock connect failed
Connect to lock failed 79:7F:C3:EB:7F:38

Everything is clear now, I received the gate and lock, just enter ttlockclientid as in the documentation: ttlockclientid and
ttlocktoken and everything works for me.

I went through setup from ttlock in hacs - and when i try to unlock the lock it says ā€œFailed to call service lock/unlock. API returned: {ā€˜errcodeā€™: -4043, ā€˜errmsgā€™: ā€˜The function is not supported for this lock.ā€™, ā€˜descriptionā€™: ā€˜ę­¤é”äøę”ÆꌁčÆ„ę“ä½œć€‚ā€™}ā€

it talks about the callback url but i did not see any notification at all or know where to get it from. i see where to enter it in the tt lock web app.

EDIT : i had to go to ttlock app on my phone and enable remote unlock and it works now! :slight_smile:

2 Likes

Hi

Iā€™ve succesfully integrated a Simpled Lock with TTLock in HA, and can Lock/Unlock and see the battery state. Unfortunately, I canā€™t see how to change or add pass codes. Appologies if the solution is in the depths of this thread.

Thanks

EDIT: Silly me, I found the services:

TTLock: Create a new pass code
TTLock: Remove expired passcodes
TTLock: Configure passage mode

Brilliant!

Followed the first three steps
At step 2. Hit Managament top right of Open Platform to get client_id and Client secret

Where do you register the user??

And what is this
curl -i -X POST -d ā€œclientId=XXXXXXX&clientSecret=YYYYYYYYY&username=IOS_USERNAME&password=PASS_IN_MD5_FORMAT&date=date +%s ā€ https://api.ttlock.com/v3/user/register

I am not a HA developer so I need simpler instructions to follow.

Amy clarification would be appreciated.
Ash

For clarification
a) What MD5 encrypted password? Where did this come from?
b) What is the username as I have not seen a user name? I have seen and account a name, an nickname, an email, afew others but no username. Is this in the TTlock web site of the TTlock iphone app?
c) None of the cut/paste into Terminal went sucessfully but lest solve a& b first.

Could you clarify where the encrypted passwrod is and what is the username?
Much appreciated
Ash

Hi Ash,

What exactly have you done so far?

This works great!
Iā€™m trying to get an automation
Depending on the sensor
Sensor.door_last_operator
So it only triggers if the finger ā€œRight thumbā€ is used but canā€™t get it to work.
Any ideas?

Does anyone know of a way to message my phone the name of the last user to unlock the door? I can create a trigger easily to respond to the door being unlocked, but itā€™s the content of the message that I canā€™t fathom out.

Hi, are there any ways to do this ? ones that doesnt depend on their cloud ? worried they might disappear one day and render the lock useless

Hi @MadMirza, I am having the same issues you mentioned and have reread the post by @seba.olah several times but still unable to make sense of things.

I did successfully transfer my lock to the created user with the same password as developer account. I can now access that lock through the HA CLI / CURL.

but I cannot log into that account on any platform (web/ios/TTLockHACS integration/etc)

How did you get past this issue?
Thanks!

EDIT:
Finally finally solved it. Even though I was absolutely using the right password, I just reset the password through the CLI/Postman and then was immediately able to log in everywhere with the new password and created username.

Documentation on how to reset password

Hi,
Did you solve this problem? I have the same issue.
Thanks

Q about setting up the call serviceā€¦Ok editā€¦ SORTED! If anybody could help with the followingā€¦ thanks!

Second question

Getting the TUYA BLE version of the ā€œSmart Key Boxā€ recognized in the ttLock app

I have a smart lock G2 gateway online
I can see the G2 in the ttlock app butā€¦

I canā€™t get the padlock lock to be recognised by the ttlock app ā€¦no matter what I doā€¦
I can get it recognised in the Smart life app, no problem - just not the ttlock app
Why?!!!

What do I do?
What is the Bluetooth pairing process?
Any other tricks?

Alternatively Should I just abandon the ttlock dream and simple register it in TUYA then run Tuya local in HA?

Thanks

Ok so I have another few questions about this call service/call url etc .

It clearly interacts with a HA instance via the cloud - web hooking in via a nabucasa account https://hooks.nabu.casa/xyz,,,hundred figure keyā€¦

So my questions are who exactly is this TTlock crowd?
Who are behind them?
What about data security here?
Does this webhook provide other means to hack into a HA server?

I donā€™t want to sound paranoidā€¦ but geezā€¦ I mean do we really want a Chinese company with a webhook into our home security, finger prints, and home assistant servers?

I am not to sure I am happy about thisā€¦

Is there any way to take this offline and local?
Even just using TUYA compatible locks and the local TUYA integration/hack seems better to me?..

Comments before I take this any further would be appreciated pleaseā€¦

Thanks

Just want to bump @jbergler 's custom integration which he highlighted in an earlier post: TTLOCK Integration with HA - #101 by jbergler

Not only is it easier to install and setup, his repo still seems to be active, compared to some of the other older repos mentioned in this thread. Also since it relies on webhooks rather than the mqtt messages, lock states are updated faster (at least with my locks).

So for those coming in now looking for a solution to integrate your ttlock-integrated smart locks, and were similarly confused by the long thread above, the following steps are what worked for me and I highly recommend using this integration once all of the other steps are followed:

  1. Open a ttlock developer account at https://euopen.ttlock.com/
  2. Create an app and get it reviewed on the platform
  3. Once your app is approved, open a terminal on your HA machine, and follow the steps in the older repoā€™s readme: ttlockio/README.md at master Ā· tonyldo/ttlockio Ā· GitHub
    FYI, there are multiple ways you can get an MD5 hash our your dev account password, but I used python interactively in HAā€™s terminal to do it:
    $ python
    >>>import hashlib
    >>>hashlib.md5("insert your password here".encode()).hexdigest()
  4. Once your app username, user token and refresh token have been generated, log in to your ttlock app on your phone, transfer locks and gateways to the new account and log into the new account (use this new generated username and the MD5-hashed password to login)
  5. Follow the rest of jberglerā€™s instructions and youā€™re off to the races.
2 Likes