core: TRADFRI cannot be set up - "Unknown error occured"

Home Assistant release with the issue:

0.100.1

Last working Home Assistant release (if known): unknown

Operating environment (Hass.io/Docker/Windows/etc.):

Docker

Integration:

https://www.home-assistant.io/integrations/tradfri/

Description of problem: When setting up Tradfri, the integration panel to enter the security code comes up. No matter what I enter (correct or incorrect data), it gives shows “Unknown error occured”.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):


Traceback (if applicable):

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 40, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 73, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 231, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 128, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 164, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 48, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 90, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 89, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 132, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/usr/src/homeassistant/homeassistant/components/tradfri/config_flow.py", line 55, in async_step_auth
    self.hass, host, user_input[KEY_SECURITY_CODE]
  File "/usr/src/homeassistant/homeassistant/components/tradfri/config_flow.py", line 164, in authenticate
    key = await api_factory.generate_psk(security_code)
  File "/usr/local/lib/python3.7/site-packages/pytradfri/api/aiocoap_api.py", line 195, in generate_psk
    self._psk = await self.request(command)
  File "/usr/local/lib/python3.7/site-packages/pytradfri/api/aiocoap_api.py", line 155, in request
    result = await self._execute(api_commands)
  File "/usr/local/lib/python3.7/site-packages/pytradfri/api/aiocoap_api.py", line 146, in _execute
    _, res = await self._get_response(msg)
  File "/usr/local/lib/python3.7/site-packages/pytradfri/api/aiocoap_api.py", line 105, in _get_response
    await self._reset_protocol(e)
  File "/usr/local/lib/python3.7/site-packages/pytradfri/api/aiocoap_api.py", line 77, in _reset_protocol
    protocol = await self._get_protocol()
  File "/usr/local/lib/python3.7/site-packages/pytradfri/api/aiocoap_api.py", line 72, in _get_protocol
    return (await self._protocol)
  File "/usr/local/lib/python3.7/site-packages/pytradfri/api/aiocoap_api.py", line 93, in _get_response
    protocol = await self._get_protocol()
  File "/usr/local/lib/python3.7/site-packages/pytradfri/api/aiocoap_api.py", line 72, in _get_protocol
    return (await self._protocol)
  File "/usr/local/lib/python3.7/site-packages/aiocoap/protocol.py", line 528, in create_client_context
    self.transport_endpoints.append((yield from TransportEndpointUDP6.create_client_transport_endpoint(new_message_callback=self._dispatch_message, new_error_callback=self._dispatch_error, log=self.log, loop=loop, dump_to=dump_to)))
  File "/usr/local/lib/python3.7/site-packages/aiocoap/transports/udp6.py", line 191, in create_client_transport_endpoint
    sock = socket.socket(family=socket.AF_INET6, type=socket.SOCK_DGRAM)
  File "/usr/local/lib/python3.7/socket.py", line 151, in __init__
    _socket.socket.__init__(self, family, type, proto, fileno)
OSError: [Errno 97] Address family not supported by protocol

Additional information: It makes no difference if using discovery or manual setup in configuration.yaml. For testing I managed to get pytradfri directly setup inside the docker container of home-assistant. From there the commandline was able to connect to the Tradfri gateway and receive status information.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 23 (3 by maintainers)

Most upvoted comments

I have in my docker compose file added a section like this

...  
homeassistant:
      container_name: home-assistant
      image: homeassistant/home-assistant:0.102.3
      environment:
        - AIOCOAP_CLIENT_TRANSPORT=tinydtls
        - AIOCOAP_SERVER_TRANSPORT=tinydtls
 ...

and that solved it for me immediately

Hi,

marten@marten-hass:/$ hass --version 0.103.6

Found this in the log ile “/usr/local/lib/python3.7/site-packages/aiocoap/credentials.py”, line 285, in credentials_from_request raise CredentialsMissingError(“No suitable credentials for %s” % uri) aiocoap.credentials.CredentialsMissingError: No suitable credentials for coaps So I have now tried to change the manifest.json in tradfri to user pytradfri 6.3.1 instead and that did the trick!

Thanks!!

On 23 Apr 2020, at 21:45, Cato Kolås notifications@github.com wrote:

hm, what version of HA are you running? And do any logfiles (like syslog, home-assistant.log) say anything related to this?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/27545#issuecomment-618623251, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOLWROZY4HNXABMMKVQOGXTROCLDZANCNFSM4JADE2EA.