jbergler / hass-ttlock

Home Assistant integration for TTLock locks
54 stars 12 forks source link

3 validation errors for PassageModeConfig #29

Closed Jaap-i-o closed 1 year ago

Jaap-i-o commented 1 year ago

Describe the bug

Have added my lock, got the message that it was succesfull but see this error in my integration:

3 validation errors for PassageModeConfig startDate field required (type=value_error.missing) endDate field required (type=value_error.missing)

jbergler commented 1 year ago

Could you please enable debug logging for the integration and share the last response in the logs before this error?

jbergler commented 1 year ago

@Jaap-i-o I'll release the changes in #31 to hopefully work around your issue but if you could share the debug logs for the /lock/getPassageModeConfig requst I will implement more robust handling of the locks configuration.

SuperStark commented 1 year ago

Same error for me:

Retrying setup: 2 validation errors for PassageModeConfig startDate none is not an allowed value (type=type_error.none.not_allowed) endDate none is not an allowed value (type=type_error.none.not_allowed

montekristas commented 1 year ago

Same error:

2 validation errors for PassageModeConfig startDate none is not an allowed value (type=type_error.none.not_allowed) endDate none is not an allowed value

SuperStark commented 1 year ago

@jbergler Have you managed to create a workaround for this? - I can provide logs if you need :)

jbergler commented 1 year ago

Sorry for the late response everyone, I'm still hoping someone can provide some logs so I can understand what undocumented behavior TTLock's api is exhibiting.

SuperStark commented 1 year ago

@jbergler The basic HA logs?

Logger: homeassistant.config_entries Source: config_entries.py:1247 First occurred: 17 May 2023 at 21:38:03 (2 occurrences) Last logged: 09:56:48

Config entry 'Home-Assistant' for ttlock integration not ready yet: 2 validation errors for PassageModeConfig startDate none is not an allowed value (type=type_error.none.not_allowed) endDate none is not an allowed value (type=type_error.none.not_allowed); Retrying in background

jbergler commented 1 year ago

@SuperStark you'll need to turn on debug logging, which you have to do via configuration.yaml with something like the following.

logger:
  logs:
    custom_components.ttlock: debug

From there I'm specifically looking for the two lines that look like this

2023-05-22 16:58:18.669 DEBUG (MainThread) [custom_components.ttlock.api] [2407] Sending request to https://euapi.ttlock.com/v3/lock/getPassageModeConfig with args={'lockId': 7252408}
2023-05-22 16:58:18.981 DEBUG (MainThread) [custom_components.ttlock.api] [2407] Received response: status=200: body={'autoUnlock': 2, 'isAllDay': 2, 'endDate': 1200, 'weekDays': [1, 2, 3, 4, 5, 6, 7], 'passageMode': 1, 'startDate': 420}
SuperStark commented 1 year ago

@jbergler Gotcha, hopefully the below helps :)

2023-05-22 10:21:40.652 DEBUG (MainThread) [custom_components.ttlock.api] [8b4c] Sending request to https://euapi.ttlock.com/v3/lock/list with args={'pageNo': 1, 'pageSize': 1000}

2023-05-22 10:21:43.584 DEBUG (MainThread) [custom_components.ttlock.api] [8b4c] Received response: status=200: body={'list': [{'date': 1668546861000, 'specialValue': 894236151, 'lockAlias': 'Front Door Lock', 'noKeyPwd': '1870020', 'electricQuantityUpdateDate': 1684515857000, 'lockMac': 'EA:E8:95:C3:8D:AC', 'passageMode': 2, 'timezoneRawOffset': 0, 'lockId': 6560966, 'featureValue': 'C2F44354CF5F7', 'electricQuantity': 45, 'bindDate': 1668546861000, 'lockData': '36z5mYL1+lckLzQ+qDxfBoGAiZkhUpmigdnjAKP4GlmQf83WUXQystX5dxaril+PFFY7EaxFI2lC9BGObTuwqe7t6dnY90YwmJwrnEdZvtL2/JeI77OnIxE1gSJTqXz/NTCP7LUrPFF3c3J76GY3KnqxamUNaTwjQqIlY54BZdccUnH/VnuaKDh4B/7x3FRYsyuAF5KgjYozALqH/VqePdYtQss1KQtIMbCfALnjAEAB7S77ptIEdKVEHO7E02kLujbD+3zPHmgaiJadftzJ/ryuFEhnQOJBHxePuEvKNndRwwUQDiEw7zCGFPS90mHLoppLq53ueYm7yMwooRL3zIm/RtxjnJyA9ZxxONjQvRvK1C2oHTiyVws8T2uuD0Gs5xBVgeqANSiUdCK8E2X79DWH//ksclm8X1n7yEEOQBPFWo2stZPaUw2ip8mvcJ4OImxX1AMfvRsiOYSGxcxkrjDRwolCwlAktRmUi2y40r7UOJRvRbNViN8pJd4fsJtUxsX6cagWIFL91Bt2UBPdtec4RH+T7zdQYNcJVR2MZVnmqWaOd6+WI20Nd+fO2YRJBKnxkpOVbAnk0jAMqb4r0lfcgOqzk2Fo+UwBgFvsPomI0yv9phEOEC/YxDdCxNTjOiXIYbZf+j+Ift3vVDeG8VcFa7Sh44eHL9Ln+XQ9s/EhNht/1Rdq7kHQ+hUvR8LhXabyw/nwiT5VHO7YxQx2TMH0Dwh4cXWXLmTn+0SRCW3Um2EPXEZtNVAPqGsVy2Iv6uiVw42s', 'hasGateway': 1, 'keyboardPwdVersion': 4, 'wirelessKeypadFeatureValue': '0', 'lockVersion': {'showAdminKbpwdFlag': True, 'groupId': 10, 'protocolVersion': 3, 'protocolType': 5, 'orgId': 34, 'logoUrl': '', 'scene': 2}, 'lockName': 'S31_ac8dc3'}], 'pageNo': 1, 'pageSize': 1000, 'pages': 1, 'total': 1}

2023-05-22 10:21:43.585 DEBUG (MainThread) [custom_components.ttlock.api] [3762] Sending request to https://euapi.ttlock.com/v3/lock/detail with args={'lockId': 6560966}

2023-05-22 10:21:43.709 DEBUG (MainThread) [custom_components.ttlock.api] [3762] Received response: status=200: body={'date': 1668546861000, 'lockAlias': 'Front Door Lock', 'lockSound': 1, 'modelNum': 'SN9206-01_PV53', 'lockMac': 'EA:E8:95:C3:8D:AC', 'privacyLock': 2, 'deletePwd': '', 'featureValue': 'C2F44354CF5F7', 'adminPwd': 'NjgsNjUsNzcsNzYsNzEsNjgsNzYsNzcsNjUsNjksMTA=', 'soundVolume': 5, 'hasGateway': 1, 'autoLockTime': 15, 'wirelessKeypadFeatureValue': '0', 'lockKey': 'NjgsNzYsNjksNzAsNjQsNjcsNzYsNjYsNjcsNjQsMTA=', 'isFrozen': 2, 'lockName': 'S31_ac8dc3', 'resetButton': 1, 'firmwareRevision': '6.4.11.220520', 'tamperAlert': 2, 'specialValue': 894236151, 'displayPasscode': 0, 'noKeyPwd': '1870020', 'passageMode': 2, 'passageModeAutoUnlock': 2, 'timezoneRawOffset': 0, 'lockId': 6560966, 'electricQuantity': 45, 'lockFlagPos': 0, 'lockUpdateDate': 1684515857000, 'keyboardPwdVersion': 4, 'aesKeyStr': 'f5,6c,b6,37,ce,59,7b,b1,70,15,3f,c1,c8,ab,67,ff', 'hardwareRevision': '1.6.1', 'openDirection': 2, 'lockVersion': {'groupId': 10, 'protocolVersion': 3, 'protocolType': 5, 'orgId': 34, 'scene': 2}, 'sensitivity': 0}

2023-05-22 10:21:43.709 DEBUG (MainThread) [custom_components.ttlock.api] [314c] Sending request to https://euapi.ttlock.com/v3/lock/queryOpenState with args={'lockId': 6560966}

2023-05-22 10:21:46.074 DEBUG (MainThread) [custom_components.ttlock.api] [314c] Received response: status=200: body={'state': 0}

2023-05-22 10:21:46.074 DEBUG (MainThread) [custom_components.ttlock.api] [9eaa] Sending request to https://euapi.ttlock.com/v3/lock/getPassageModeConfig with args={'lockId': 6560966}

10:21:46.074 DEBUG (MainThread) [custom_components.ttlock.api] [314c] Received response: status=200: body={'state': 0}
2023-05-22 10:21:46.074 DEBUG (MainThread) [custom_components.ttlock.api] [9eaa] Sending request to https://euapi.ttlock.com/v3/lock/getPassageModeConfig with args={'lockId': 6560966}

10:21:46.133 DEBUG (MainThread) [custom_components.ttlock.api] [9eaa] Received response: status=200: body={'autoUnlock': 2, 'isAllDay': 1, 'endDate': None, 'weekDays': [1, 2, 3, 4, 5, 6, 7], 'passageMode': 2, 'startDate': None}

jbergler commented 1 year ago

Thanks, this is super helpful - fix will be out shortly in v0.5.1