Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute Error: NoneType #59

Open
amm5172 opened this issue Jul 3, 2023 · 6 comments
Open

Attribute Error: NoneType #59

amm5172 opened this issue Jul 3, 2023 · 6 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@amm5172
Copy link

amm5172 commented Jul 3, 2023

Receiving the following error on all of my locks (approximately 160 locks). Integration is set up and I can see that it is successfully collecting data but I have no devices listed in the integration. I have the following error multiple times in my log. Different users, different actions, different locks. Always the same error. AttributeError: 'NoneType' object has no attribute 'battery_level'

Logger: homeassistant.util.logging
Source: util/logging.py:168
First occurred: 3:07:44 PM (7 occurrences)
Last logged: 3:09:35 PM

Exception in _process_webhook_data when dispatching 'ttlock.data_received': (WebhookEvent(id=1847880, mac='C9:4B:4C:F1:B5:E1', battery_level=100, server_ts=datetime.datetime(2023, 7, 3, 15, 7, 44, 197000, tzinfo=zoneinfo.ZoneInfo(key='America/Chicago')), lock_ts=datetime.datetime(2023, 7, 3, 15, 7, 30, tzinfo=zoneinfo.ZoneInfo(key='America/Chicago')), event=Event(EventDescription(action=<Action.unlock: 3>, description='unlock by IC card')), user='hm', success=True),) Traceback (most recent call last): File "/config/custom_components/ttlock/coordinator.py", line 164, in _process_webhook_data new_data.battery_level = event.battery_level ^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'battery_level'

config_entry-ttlock-ee6731597785b54275112671a8614839.json (3).txt

@jbergler
Copy link
Owner

@amm5172 thanks for the report, I poked around a little bit but think I'm going to need more data to debug this one.
Could you please turn debug logging on and reload the extension, then send me the logs when the problem has re-occurred?

@jbergler jbergler added bug Something isn't working question Further information is requested labels Jul 10, 2023
@amm5172
Copy link
Author

amm5172 commented Jul 14, 2023

@amm5172
Copy link
Author

amm5172 commented Jul 14, 2023

ttlock log.txt

@jbergler
Copy link
Owner

Thanks for the logs, it looks like setting up the locks takes so long that webhooks are received before the locks are ready.
I pushed a quick fix that skips processing the webhook in that case.

If you'd be so kind as to upgrade, and generate another debug log - I'd love to try and see if there's more that can be done with startup/setup performance.

@amm5172
Copy link
Author

amm5172 commented Jul 17, 2023

home-assistant_ttlock_2023-07-17T17-23-36.010Z.log
Failed again although it got much further this time

@amm5172
Copy link
Author

amm5172 commented Jul 17, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants