chrysn / aiocoap

The Python CoAP library
Other
262 stars 119 forks source link

Tradfri: Home Assistant: TypeError("'NoneType' object does not support item assignment") #333

Open Mariusthvdb opened 6 months ago

Mariusthvdb commented 6 months ago

system: Home Assistant Core 2023.12.2 Supervisor 2023.12.0 Operating System 11.2 Frontend 20231208.2 Please help me filing this, running HomeAssistant and the Tradfri integration.

log shows

Logger: coap
Source: runner.py:188
First occurred: 10:11:08 (4010 occurrences)
Last logged: 10:18:53

An exception that is not an aiocoap Error was raised from a transport; please report this as a bug in aiocoap: CredentialsMissingError('No suitable credentials for coaps://192.168.1.99/15001/65680')
An exception that is not an aiocoap Error was raised from a transport; please report this as a bug in aiocoap: TypeError("'NoneType' object does not support item assignment")

and the Tradfri integration has become horribly unreliable because connection is lost all the time. there are a great deal of partnering wanring/errors, this mention aiocoap too:

Logger: root
Source: /usr/src/homeassistant/homeassistant/bootstrap.py:402
First occurred: 10:13:35 (2987 occurrences)
Last logged: 10:18:53

Uncaught exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiocoap/transports/tinydtls.py", line 170, in wrapper
    return getattr(self, __method)(*args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiocoap/transports/tinydtls.py", line 280, in _read
    self.coaptransport.ctx.dispatch_message(message)
  File "/usr/local/lib/python3.11/site-packages/aiocoap/messagemanager.py", line 109, in dispatch_message
    success = self._process_response(message)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiocoap/messagemanager.py", line 335, in _process_response
    return self.token_manager.process_response(response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiocoap/tokenmanager.py", line 167, in process_response
    if key not in self.outgoing_requests:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

there are many more mentioning the tinytdls, and of course issues have been raised in Home Assistant Tradfri integration

https://github.com/home-assistant/core/issues/105004 https://github.com/home-assistant/core/issues/85254#issuecomment-1838614615 and more.

Hope you can have some pointers what to do, where to look. Instruct me to debug this please. thanks

Mariusthvdb commented 5 months ago

getting worse and worse

Scherm­afbeelding 2024-01-31 om 10 41 50
chrysn commented 5 months ago

Are there any clues as to what else changed when this became more frequent? Were more clients added to tradfri, or components updated whose changelogs could contain hints?

Mariusthvdb commented 5 months ago

not really no, not that I can imagine.

maybe only some beter logging in the scripts/automations section, so making things more obvious?

as a matter of fact, Ive even taken out some of the entities to go to the new Dirigera, or ZHA.

Ive tried to describe things as accurately as possible, and add new info if and when applicable. It's all we can do as users, the core dev team is the only team that can further investigate having all required knowledge.