chrysn / aiocoap

The Python CoAP library
Other
267 stars 120 forks source link

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

Open Mariusthvdb opened 11 months ago

Mariusthvdb commented 11 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 10 months ago

getting worse and worse

Scherm­afbeelding 2024-01-31 om 10 41 50
chrysn commented 10 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 10 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.

Airblader commented 1 month ago

FWIW, I am getting the same error when trying to connect my Onvis HS2 to Home Assistant.

Mariusthvdb commented 1 month ago

forget this integration, move you Ikea devices to the new Dirigera hub, and integrate them via Homekit devices.

Ive done that some while ago and never looked back.

The existing Ikea TRADFRI integration is flawed beyond fixing, especially since no code owner is available, and the integration is ignored.

Homekit devices is supported very well, so the choice is obvious .

Tbh, I should close this issue, as Ive openend it and found the solution ;-)