Closed jbergler closed 1 year ago
@Jayva2002 could you turn on debug logging for the integration and share the json response that gets dumped. Curious to see some more context around this error.
This help? Also, I have an old lock on my account that cannot be removed - could it be that lock? Logger: homeassistant.components.lock Source: custom_components/ttlock/api.py:137 Integration: Lock (documentation, issues) First occurred: 8:38:15 PM (2 occurrences) Last logged: 8:38:15 PM
Error adding entities for domain lock with platform ttlock Error while setting up ttlock platform for lock Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 455, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 563, in _async_add_entity device_info = entity.device_info File "/config/custom_components/ttlock/entity.py", line 75, in device_info model=self.device.model, File "/config/custom_components/ttlock/api.py", line 137, in model return self._data["modelNum"] or self._data["lockName"] KeyError: 'modelNum'
That helps a little, I'm still curious about what you're actually getting back from the API though so I can make the code handle the error condition properly.
You should be able to turn on debug logging via the integrations page, theres an option in the dropdown for each integration. (Choose reload after enabling the logging)
I published a workaround in v0.3.1, but would still appreciate some extra info. If the fix lets the integration start up properly, you should be able to use the "Download Diagnostics" to get the data I need.
{
"home_assistant": {
"installation_type": "Home Assistant OS",
"version": "2023.4.2",
"dev": false,
"hassio": true,
"virtualenv": false,
"python_version": "3.10.10",
"docker": true,
"arch": "x86_64",
"timezone": "America/New_York",
"os_name": "Linux",
"os_version": "5.15.90",
"supervisor": "2023.04.0",
"host_os": "Home Assistant OS 9.5",
"docker_version": "20.10.22",
"chassis": "vm",
"run_as_root": true
},
"custom_components": {
"govee_lan": {
"version": "1.0.0",
"requirements": [
"govee-led-wez>=0.0.14"
]
},
"midea_ac": {
"version": "0.2.3",
"requirements": [
"msmart==0.2.3",
"pycryptodome",
"pycryptodomex",
"click"
]
},
"sonoff": {
"version": "3.5.1",
"requirements": [
"pycryptodome>=3.6.6"
]
},
"hacs": {
"version": "1.32.1",
"requirements": [
"aiogithubapi>=22.10.1"
]
},
"meross_lan": {
"version": "3.0.3",
"requirements": []
},
"roborock": {
"version": "0.1.2",
"requirements": [
"python-roborock==0.1.7"
]
},
"adaptive_lighting": {
"version": "1.11.0",
"requirements": [
"ulid-transform"
]
},
"illuminance": {
"version": "4.0.1",
"requirements": []
},
"ttlock": {
"version": "v0.3.0",
"requirements": []
},
"robovac": {
"version": "1",
"requirements": []
},
"vesync": {
"version": "0.2.5",
"requirements": [
"pyvesync==2.1.1"
]
},
"watchman": {
"version": "0.5.1",
"requirements": [
"prettytable==3.0.0"
]
},
"huesyncbox": {
"version": "1.23.0",
"requirements": [
"aiohuesyncbox==0.0.21"
]
},
"localtuya": {
"version": "5.0.0",
"requirements": []
},
"eufy_security": {
"version": "6.2.0",
"requirements": [
"websocket-client==1.1.0",
"aiortsp==1.3.6"
]
}
},
"integration_manifest": {
"domain": "ttlock",
"name": "TTLock",
"after_dependencies": [
"cloud"
],
"codeowners": [
"@jbergler"
],
"config_flow": true,
"dependencies": [
"application_credentials",
"webhook"
],
"documentation": "https://github.com/jbergler/hass-ttlock",
"homekit": {},
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/jbergler/hass-ttlock/issues",
"requirements": [],
"ssdp": [],
"version": "v0.3.0",
"zeroconf": [],
"is_built_in": false
},
"data": {
"config_entry": {
"entry_id": "8dd083745ad487cf781b4d582a9f5564",
"version": 1,
"domain": "ttlock",
"title": "Jaysttlock",
"data": {
"auth_implementation": "ttlock_c88f090b4c85425e98c297aa975f4568",
"token": "**REDACTED**",
"webhook_id": "bec7dc90beb61e14efe1d257737e7dfe7667e12d1a4ed869d8e6e116a3806e19",
"webhook_url": "..."
},
"options": {},
"pref_disable_new_entities": false,
"pref_disable_polling": false,
"source": "user",
"unique_id": null,
"disabled_by": null
},
"locks": [
{
"entity_id": "lock.new_front",
"device": {
"_api": {
"__type": "<class 'custom_components.ttlock.api.TTLockApi'>",
"repr": "<custom_components.ttlock.api.TTLockApi object at 0x7f6649944b80>"
},
"_data": {
"date": 1663707214000,
"lockAlias": "New Front",
"lockSound": 2,
"modelNum": "SN279_PV53",
"lockMac": "FE:3E:8D:EE:E8:FD",
"privacyLock": 2,
"deletePwd": "",
"featureValue": "7042DCCD5F7",
"adminPwd": "**REDACTED**",
"soundVolume": 5,
"hasGateway": 1,
"autoLockTime": 300,
"wirelessKeypadFeatureValue": "0",
"lockKey": "**REDACTED**",
"isFrozen": 2,
"lockName": "E030_fde8ee",
"resetButton": 1,
"firmwareRevision": "5.3.3.210601",
"tamperAlert": 2,
"specialValue": 768398839,
"displayPasscode": 0,
"noKeyPwd": "**REDACTED**",
"passageMode": 2,
"passageModeAutoUnlock": 2,
"timezoneRawOffset": -14400000,
"lockId": 6649332,
"electricQuantity": 100,
"lockFlagPos": 0,
"lockUpdateDate": 1680224367000,
"keyboardPwdVersion": 4,
"aesKeyStr": "**REDACTED**",
"hardwareRevision": "1.3",
"openDirection": 0,
"lockVersion": {
"groupId": 10,
"protocolVersion": 3,
"protocolType": 5,
"orgId": 60,
"scene": 2
},
"sensitivity": -1
},
"_state": 0
}
},
{
"entity_id": null,
"device": {
"_api": {
"__type": "<class 'custom_components.ttlock.api.TTLockApi'>",
"repr": "<custom_components.ttlock.api.TTLockApi object at 0x7f6649944b80>"
},
"_data": {
"date": 1648136124000,
"specialValue": 566285812,
"lockAlias": "Zzz front",
"noKeyPwd": "**REDACTED**",
"electricQuantityUpdateDate": 1648136124000,
"lockMac": "5E:E9:42:67:BC:95",
"passageMode": 2,
"timezoneRawOffset": -14400000,
"lockId": 5083782,
"featureValue": "74421C0D5F4",
"electricQuantity": 100,
"bindDate": 1648136124000,
"lockData": "...",
"hasGateway": 0,
"keyboardPwdVersion": 4,
"wirelessKeypadFeatureValue": "0",
"lockVersion": {
"showAdminKbpwdFlag": true,
"groupId": 10,
"protocolVersion": 3,
"protocolType": 5,
"orgId": 34,
"logoUrl": "",
"scene": 2
},
"lockName": "N20_95bc67"
}
}
}
]
}
The lock with alias ‘ZZZ front’ is the one that cannot be powered, so I am unable to remove from the account in the ttlock app
Thanks, I'll have a think about how to handle this better.
If you want, you could try and use your API credentials to delete the lock directly in the API per this doc https://euopen.sciener.com/document/doc?urlName=cloud%2Flock%2FdeleteEn.html
Thanks. I was able to remove the lock. Appreciate all of your assistance.
I removed the lock after your most recent update, which did fix the error message.
Since you removed the lock in the bad state I'll go ahead and close this, thanks again for the report.
Cielsa Dawn Fingerprint Digital Doorknob model: SN279_PV53 Firmware: 5.3.3.210601
integration reports error “KeyError: 'modelNum'” on load.
Originally posted by @Jayva2002 in https://github.com/jbergler/hass-ttlock/issues/1#issuecomment-1502480648