Closed HerveB closed 1 year ago
Thanks for the report @HerveB.
Can you please turn on debug logging for the component (since HA 2023.4 you should be able to do this from the integration UI) and share the last few log lines before the error. Should look something like this:
2023-04-23 14:42:17.424 DEBUG (MainThread) [custom_components.ttlock.api] Sending request to https://euapi.ttlock.com/v3/lock/detail with args={'lockId': 7252408}
2023-04-23 14:42:17.730 DEBUG (MainThread) [custom_components.ttlock.api] Received response: {'date': 1669690212000, 'lockAlias': 'Front Door', 'lockSound': 2, 'modelNum': 'SN9206_PV53', 'lockMac': '16:72:4C:CC:01:C4', 'privacyLock': 2, 'deletePwd': '', 'featureValue': 'F44354CD5F3', 'adminPwd': '<REMOVED>', 'soundVolume': 5, 'hasGateway': 1, 'autoLockTime': 60, 'wirelessKeypadFeatureValue': '0', 'lockKey': '<REMOVED>', 'isFrozen': 2, 'lockName': 'S31_c401cc', 'resetButton': 1, 'firmwareRevision': '6.0.6.210622', 'tamperAlert': 1, 'specialValue': 894227955, 'displayPasscode': 0, 'noKeyPwd': '<REMOVED>', 'passageMode': 1, 'passageModeAutoUnlock': 2, 'timezoneRawOffset': 46800000, 'lockId': 7252408, 'electricQuantity': 90, 'lockFlagPos': 0, 'lockUpdateDate': 1682201024000, 'keyboardPwdVersion': 4, 'aesKeyStr': '<REMOVED>', 'hardwareRevision': '1.6', 'openDirection': 0, 'lockVersion': {'groupId': 10, 'protocolVersion': 3, 'protocolType': 5, 'orgId': 34, 'scene': 2}, 'sensitivity': -1}
2023-04-23 14:42:17.731 DEBUG (MainThread) [custom_components.ttlock.api] Sending request to https://euapi.ttlock.com/v3/lock/queryOpenState with args={'lockId': 7252408}
2023-04-23 14:42:19.547 DEBUG (MainThread) [custom_components.ttlock.api] Received response: {'state': 1}
2023-04-23 14:42:19.547 DEBUG (MainThread) [custom_components.ttlock.api] Sending request to https://euapi.ttlock.com/v3/lock/getPassageModeConfig with args={'lockId': 7252408}
2023-04-23 14:42:19.860 DEBUG (MainThread) [custom_components.ttlock.api] Received response: {'autoUnlock': 2, 'isAllDay': 2, 'endDate': 1200, 'weekDays': [1, 2, 3, 4, 5, 6, 7], 'passageMode': 1, 'startDate': 420}
I'd suggest removing adminPwd, lockKey, noKeyPwd and aesKeyStr as I have above since those are potentially sensitive bits of data.
From the system logs:Logger: homeassistant.config_entriesSource: config_entries.py:1282 First occurred: 11:08:15 PM (2 occurrences) Last logged: 11:13:46 PMConfig entry 'TTLock' for ttlock integration not ready yet: 1 validation error for LockState state field required (type=value_error.missing); Retrying in background
@HerveB you'll need to put the extension into debug mode and probably reload it.
The docs on how to do this are here: https://www.home-assistant.io/docs/configuration/troubleshooting/#enabling-debug-logging
I tried to clean up the debug log and keep only TTLock items. 
On Apr 22, 2023, at 11:19 PM, Jonas Bergler @.***> wrote:
@HerveB https://github.com/HerveB you'll need to put the extension into debug mode and probably reload it.
The docs on how to do this are here: https://www.home-assistant.io/docs/configuration/troubleshooting/#enabling-debug-logging
— Reply to this email directly, view it on GitHub https://github.com/jbergler/hass-ttlock/issues/34#issuecomment-1518930704, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEERIRSTHP2QBXSVB5HGTODXCSNSLANCNFSM6AAAAAAXIHKCCI. You are receiving this because you were mentioned.
Thanks, although I think replying via email may have dropped the data you attached, I only see 
I uploaded the log file
On Apr 22, 2023, at 11:50 PM, Jonas Bergler @.***> wrote:
Thanks, although I think replying via email may have dropped the data you attached, I only see 
— Reply to this email directly, view it on GitHub https://github.com/jbergler/hass-ttlock/issues/34#issuecomment-1518935311, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEERIRQB24CFLP57FDY75YTXCSRJPANCNFSM6AAAAAAXIHKCCI. You are receiving this because you were mentioned.
Looks like the extension might be overwhelming the gateway, are all these locks attached to the same gateway?
I'll definitely add some error handling and I'll see if I can do something about fetching the lockedState less aggressively
I have 3 gateways.
Note that the last version 0.3.x worked fine. I was able to downgrade to fix the issue earlier.
On Apr 22, 2023, at 11:59 PM, Jonas Bergler @.***> wrote:
Looks like the extension might be overwhelming the gateway, are all these locks attached to the same gateway?
I'll definitely add some error handling and I'll see if I can do something about fetching the lockedState less aggressively
— Reply to this email directly, view it on GitHub https://github.com/jbergler/hass-ttlock/issues/34#issuecomment-1518936494, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEERIRUNJU5PZBKDLYR2GBDXCSSILANCNFSM6AAAAAAXIHKCCI. You are receiving this because you were mentioned.
@HerveB thanks for the logs, I've added some rate-limiting to the gateway access as well as improving the error handling. Please try v0.4.6, and let me know if the problem is fixed or not.
The integration still fails to initialize. The new error message: 2023-04-23 00:42:49.554 DEBUG (MainThread) [custom_components.ttlock.api] [919a] Received response: status=200: body={'errcode': 1, 'errmsg': 'failed or means no', 'description': '表示失败或否'} 2023-04-23 00:42:49.554 DEBUG (MainThread) [custom_components.ttlock.api] [919a] API returned: {'errcode': 1, 'errmsg': 'failed or means no', 'description': '表示失败或否'} 2023-04-23 00:42:49.554 DEBUG (MainThread) [custom_components.ttlock.coordinator] Finished fetching ttlock data in 58.760 seconds (success: False)
On Apr 23, 2023, at 12:31 AM, Jonas Bergler @.***> wrote:
@HerveB https://github.com/HerveB thanks for the logs, I've added some rate-limiting to the gateway access as well as improving the error handling. Please try v0.4.6, and let me know if the problem is fixed or not.
— Reply to this email directly, view it on GitHub https://github.com/jbergler/hass-ttlock/issues/34#issuecomment-1518940499, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEERIRWWHLVB34CFA5LDR2DXCSWAVANCNFSM6AAAAAAXIHKCCI. You are receiving this because you were mentioned.
Hmm, that's a fairly cryptic error from the TTLock API.
Could you send me the full logs again please? I added extra info to the logs to help me understand how the parallel requests are executing. It might be that its just hitting the API too fast now that it's setting up multiple locks in parallel.
I’ll send you the new logs tomorrow however I am wondering what has changed between 0.3.x (works fine) and 0.4.x.
Thanks.
"what has changed" -> almost everything, I rewrote most of the internals of the extension to support exposing multiple entities.
If you could, would you also send me the logs from 0.3.x for me to compare.
In 0.4.3 I get "LockState state field required", there are no error logs Originally posted by @stevearmitage in https://github.com/jbergler/hass-ttlock/issues/1#issuecomment-1518964997
@stevenarmitage I suspect you're running into the same issue as was reported by @HerveB. Can you please upgrade to 0.4.6, turn debug logging on per these instructions and then attach the logs here
This time there is very little in the logs:
2023-04-23 03:36:43.493 DEBUG (MainThread) [custom_components.ttlock.api] [b06f] Received response: status=200: body={'errcode': 1, 'errmsg': 'failed or means no', 'description': '表示失败或否'} 2023-04-23 03:36:43.494 DEBUG (MainThread) [custom_components.ttlock.api] [b06f] API returned: {'errcode': 1, 'errmsg': 'failed or means no', 'description': '表示失败或否’}
The integration doesn’t seem to be initializing properly. The option to enable debug logging appears only after several minutes and attempts to initialize,
On Apr 23, 2023, at 12:52 AM, Jonas Bergler @.***> wrote:
Hmm, that's a fairly cryptic error from the TTLock API.
Could you send me the full logs again please? I added extra info to the logs to help me understand how the parallel requests are executing. It might be that its just hitting the API too fast now that it's setting up multiple locks in parallel.
— Reply to this email directly, view it on GitHub https://github.com/jbergler/hass-ttlock/issues/34#issuecomment-1518942878, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEERIRXPAT25SU6KUFOHCHLXCSYSDANCNFSM6AAAAAAXIHKCCI. You are receiving this because you were mentioned.
You can enable the debugging via your configuration.yaml
file to log in debug mode before the integration is initialized.
logger:
logs:
custom_components.ttlock: debug
I no longer have the ability to redownload version 0.3.x in HACS
No worries, that log is actually pretty helpful.
I think I have a quick fix for now to keep going when we hit these errors from the API and I'll spend some time later in the week to solve the problem properly.
Great. I appreciate the work you have done on this integration! Thanks!
Hopefully v0.4.7 gets you past this problem for now. You'll probably see some of your locks not report a locked/unlocked status for the first 15 minutes after restarting home assistant.
0.4.7 seems to be working
0.4.7 loaded ok and also found my second lock. I'll post details in the other thread. I'll test more on Tuesday
I tried this integration with 0.4.8 and get an error after setting it up: Setup erneut versuchen: 1 validation error for Lock autoLockTime field required (type=value_error.missing)
I use a gateway G2 with 2 locks. In the log i didn't found a callback url. i think it's because the validation of the locks failed. The model number of both locks is C001C with NFC and Bluetooth.
I tried this integration with 0.4.8 and get an error after setting it up: Setup erneut versuchen: 1 validation error for Lock autoLockTime field required (type=value_error.missing)
I use a gateway G2 with 2 locks. In the log i didn't found a callback url. i think it's because the validation of the locks failed. The model number of both locks is C001C with NFC and Bluetooth.
@ortwin20000 I'll need the debug logging to help with this. Could you please turn debug logging on for the integration and then open a new issue?
I get the following error message: Retrying setup: 1 validation error for LockState state field required (type=value_error.missing)
0.3.x was working fine. I deleted the entities when I upgraded to 0.4.3 and go the error above. Same error persisted with 0.4.4 and 0.4.5