Closed vsok01 closed 1 year ago
Just one more detail: my lock has a built-in WiFi module, so it works without gateway.
Hey @vsok01 this is likely the result of me filtering out locks without gateways to address another bug - I can try and revisit that but I'll need more info, can you put the integration into debug mode, reload it and share the logs please?
Thank you for quick response. Here are the logs:
2023-07-03 14:36:29.113 DEBUG (MainThread) [custom_components.ttlock.api] [96e2] Sending request to https://euapi.ttlock.com/v3/lock/list with args={'pageNo': 1, 'pageSize': 1000} 2023-07-03 14:36:29.611 DEBUG (MainThread) [custom_components.ttlock.api] [96e2] Received response: status=200: body={'list': [{'date': 1688230672000, 'specialValue': 1967977975, 'lockAlias': 'Door', 'noKeyPwd': 'XXXXXXX', 'electricQuantityUpdateDate': 1688230672000, 'lockMac': 'A2:BB:DD:9B:60:93', 'passageMode': 1, 'timezoneRawOffset': 10800000, 'lockId': 8597203, 'featureValue': '10C2F44754CF5F7', 'electricQuantity': 100, 'bindDate': 1688230672000, 'lockData': 'vBB7v23vYEsSddLY9nwxfkUNjw8bELL9qArEiajJusg/h/v1xINSenOUmRK/SqSImlwERbFwdSfBn63At7tNF2UUeRtBrFnciyduH2EJy2i5j01E5xUV0GuPKxVUAceOoaiXhiXDrQsDj0yxWZ8uyOqnh+HqB4c2kGDaCjKIldTM+PEKCbs6FlFu3PbUkTLo6BFWwaC9ElVYQEFy+llodStgC2Wp/mthereqBcpcSfn/tZSXVwGXVTM3YemnbCWqklEiRG+Cl8v87DA1I3md1rEeE9OigFI6YfUppBedgGlkLjiIGmTgpXOW+C49jomzOBd1phtsR3UoxvpSNwobP+BWMtqZ7cofW1JfIFdierDXw+mRWxyN1+seJbDL5GTwDyxlNpCGJxfKi/BRlfGwRdjhtD7Z9EsOnp2t33ThtTHShG4E4kroIyQI5trxJE8fNTBeqyjrdfncgfQ7N5S9u6e/V6cY527QAHkXN+2NPDorXiWxnoioKusJ/R9yVUn6+A+1dlrgxvcaMYOAhYWOqkW9Bps9iWxFah2IyjjSjd1GUfP5ZeFFx1EXnUW7YODzDcxQwSIddx6MuLzE3sNsqo9VTIUShE+brI52/Akvw0ZIXHVzP7x42eJaqe1682kEbpGCZe5yVxKtH1dwsy7wvYUNQXZG0s3i+swrOAGZjPXIHTtPLgbkwjC0R1L+gErUBMhqQ43gvJiA1bXMPAELYELhtZHMUEvliGbhJzHUFT4fUKMVLvcmy8JKqaCzVxkUJ2uC/tMEA6Q9ihFYQrljgqK73Jpgkw==', 'hasGateway': 0, 'keyboardPwdVersion': 4, 'wirelessKeypadFeatureValue': '0', 'lockVersion': {'showAdminKbpwdFlag': True, 'groupId': 1, 'protocolVersion': 3, 'protocolType': 5, 'orgId': 1, 'logoUrl': '', 'scene': 2}, 'lockName': 'W301_93609a'}], 'pageNo': 1, 'pageSize': 1000, 'pages': 1, 'total': 1} 2023-07-03 14:36:29.613 INFO (MainThread) [custom_components.ttlock] Webhook registered at http://192.168.0.22:8123/api/webhook/6968d7e5bf793f81e4c4166d4313514442419f72e26289d0f460eeb4c696b886
You are right. I've removed your filter (if lock["hasGateway"] != 0) and now all works fine.
I don't have any of these locks to test, so I don't know if the web hooks have the same format, or what other differences need to be taken into account. The API as a whole is very inconsistent even across similar locks the message schemas seem to have random differences.
I added the hasGateway
check to work around issues where locks that need a gateway, but weren't connected to one were causing random failures downstream, so I'd want to try and figure out how to tell wifi locks apart from ble ones.
That probably requires parsing the featureValue': '10C2F44754CF5F7'
field, but I don't have the time at the moment to implement and test that. If you wanted to take a crack at it, I'd be happy to look at it, otherwise I'll leave this sitting here until I have some time.
Are you providing support for Homekit via home assistant? My locks are working perfectly on home assistant but they are appearing on the homekit (via. HA).
From Home Assistants perspective they're just like any other lock so they'll be shared with HomeKit based on your config
Precisely right but that’s not happening.
jbergler Webhook works fine for my lock. Could you post here an example (response) for ble lock without gateway? May be I could help you to set up a new filter...
It’s working. The issue is, if I add it as a device using bridge as hub on HA, it doesn’t show up. If I add a bridge as an accessory, it works.
@adarshk23 Isn't that expected? https://www.home-assistant.io/integrations/homekit/#accessory-mode
@vsok01 I don't have examples handy, but there are docs for the featureValue
field which I think might be the key to this.
My bad. I wasn’t aware of it. Thanks mate for your help.
What about Mac address? Is this present for ble lock? (lockMac value)
@vsok01 I'm not at home at the moment, so I can't easily test the PR I put together, would you be able to install it and see if it works as expected?
I do apologize for a stupid question, but how to install it? Should I reinstall your ttlock integration, or I need to download and replace 5 changed files? I'm not familiar with github enough.
It's not a stupid question, hacs doesn't make this easy. The best way I know of is just to manually put the ttlock directory in place (or just the 3 files in question, you can ignore the tests)
Thank you for the explanations. I've tested it. All works correctly.
Wonderful, thanks for your help. I'm going to leave this unreleased for a little bit so I have a chance to do a bit of testing when I get home at the end of the week but it will be in the next release.
Thank you very much.
My lock is not detected by your integration. May be something wrong with integration settings on my side. Could you help, please? Here are my steps:
Created an account https://open.ttlock.com/manager
Registered an application (it was approved)
Installed the extension and restarted Home Assistant Setup the integration:
entered Client ID, Client Secret etc.
entered email and password for TTLock account for my phone (where this lock was added). This account is different from the created on open.ttlock.com
received webhook url in notifications
entered this url to 'Callback URL' for my application on open.ttlock.com
restarted HA
The lock is absent in integration... Here is a log: