home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.71k stars 30.83k forks source link

two tradfri gateways, discovery enabled, now log gets flooded by "[coap] Fatal DTLS error: code 115" #15287

Closed linuxlurak closed 5 years ago

linuxlurak commented 6 years ago

Home Assistant release with the issue: hass --version

0.72.1

Last working Home Assistant release (if known): not known

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

Linux homeautomation 4.15.0-23-generic #25-Ubuntu SMP Wed May 23 18:02:16 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

lsb_release -c

Codename: bionic

No venv or docker is used.

Component/platform:

Description of problem:

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

discovery:

tradfri:
        #    host: 192.168.10.6
    allow_tradfri_groups: false

Traceback (if applicable):

2018-07-03 20:04:20 INFO (MainThread) [homeassistant.components.discovery] Unknown service discovered: homekit {'host': '192.168.10.5', 'port': 80, 'hostname': 'TRADFRI-Gateway-XXXXXX.local', 'properties': {'id': 'XXXXXXX', 'md': 'TRADFRI gateway', 'pv': '1.0', 's#': '1', 'c#': '25', 'sf': '1', 'ff': '1', 'ci': '2'}}
2018-07-03 20:04:20 INFO (MainThread) [homeassistant.components.discovery] Unknown service discovered: homekit {'host': '192.168.10.6', 'port': 80, 'hostname': 'TRADFRI-Gateway-YYYYYYYYY.local.', 'properties': {'id': 'YYYYYYY', 'md': 'TRADFRI gateway', 'pv': '1.0', 's#': '1', 'c#': '50', 'sf': '1', 'ff': '1', 'ci': '2'}}
[... CUT OUT OTHER DISCOVERED DEVICES, NOT RELEVANT HERE]
2018-07-03 20:04:21 ERROR (MainThread) [coap] Fatal DTLS error: code 115
2018-07-03 20:04:21 ERROR (MainThread) [coap] Exception CancelledError() can not be represented as errno, setting -1.
2018-07-03 20:04:21 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/tradfri.py", line 121, in gateway_discovered
    allow_groups)
  File "/usr/local/lib/python3.6/dist-packages/homeassistant/components/tradfri.py", line 149, in _setup_gateway
    gateway_info_result = await api(gateway.get_gateway_info())
  File "/home/homeassistant/.homeassistant/deps/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py", line 152, in request
    result = yield from self._execute(api_commands)
  File "/home/homeassistant/.homeassistant/deps/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py", line 142, in _execute
    _, res = yield from self._get_response(msg)
  File "/home/homeassistant/.homeassistant/deps/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py", line 92, in _get_response
    r = yield from pr.response
  File "/home/homeassistant/.homeassistant/deps/lib/python3.6/site-packages/aiocoap/protocol.py", line 816, in _run_outer
    yield from cls._run(app_request, response, weak_observation, protocol, log, exchange_monitor_factory)
  File "/home/homeassistant/.homeassistant/deps/lib/python3.6/site-packages/aiocoap/protocol.py", line 865, in _run
    blockresponse = yield from blockrequest.response
OSError: [Errno -1] Unknown error -1
2018-07-03 20:04:21 ERROR (MainThread) [coap] Fatal DTLS error: code 115
2018-07-03 20:04:21 ERROR (MainThread) [coap] Exception CancelledError() can not be represented as errno, setting -1.
2018-07-03 20:04:21 ERROR (MainThread) [coap] Fatal DTLS error: code 115
2018-07-03 20:04:21 ERROR (MainThread) [coap] Exception CancelledError() can not be represented as errno, setting -1.
2018-07-03 20:04:21 ERROR (MainThread) [coap] Fatal DTLS error: code 115

Additional information: I have two gateways. I don't know how to hard code them in config section of tradfri component.

This does not work:

tradfri:
   host: 192.168.10.5
   host: 192.168.10.6
    allow_tradfri_groups: false

So I commented the host key/value pair and trusted in the discovery component.

This are the locally installed modules of pip3:

pip3 list

> Package Version > ------------------- --------- > aiocoap 0.3 > aiohttp 3.3.2 > android-backup 0.1.0 > appdirs 1.4.3 > asn1crypto 0.24.0 > astral 1.6.1 > async-timeout 3.0.0 > attrs 18.1.0 > certifi 2018.4.16 > cffi 1.11.5 > chardet 3.0.4 > click 6.7 > colorlog 3.1.4 > construct 2.9.31 > cryptography 2.2.1 > Cython 0.26.1 > distro-info 0.18 > DTLSSocket 0.1.7 > homeassistant 0.72.1 > idna 2.6 > idna-ssl 1.0.1 > Jinja2 2.10 > MarkupSafe 1.0 > multidict 4.3.1 > netdisco 1.3.1 > netifaces 0.10.6 > paho-mqtt 1.3.1 > pip 10.0.1 > pretty-cron 1.0.2 > pycparser 2.18 > PyDispatcher 2.0.5 > pygobject 3.26.1 > python-apt 1.6.1 > python-miio 0.3.8 > pytradfri 5.5.1 > pytz 2018.4 > PyYAML 3.12 > requests 2.18.4 > setuptools 39.0.1 > six 1.11.0 > tqdm 4.19.8 > typing 3.6.4 > unattended-upgrades 0.1 > urllib3 1.22 > voluptuous 0.11.1 > yarl 1.2.4 > zeroconf 0.20.0

The file .tradfri_psk.conf in ./homeassistant/ exists and I tested the saved identities and keys successful with command coap-client -m post -u "ID" -k "KEY" -e '{"9090":"IDENTITY"}' "coaps://192.168.10.6:5684/15011/9063" for both gateways.

So ist not a problem with wrong keys.

It seems it starts having troubles as soon as the second gateway is detected and perhaps then starts talking to the wrong gateway with the wrong keys or ID.

At the moment the only way is to list tradfri in the ignore list of discovery but this way I can only use one gateway as its seems to be not allowed to list two hosts in the tradfri component...

linuxlurak commented 6 years ago

I am not able to handle this problem by myself and hack the code accordingly... But if one of you devs needs an additional tradfri gateway please contact me and give me your details (paypal or anything else). I'm willing to donate some gateways.

mhristache commented 6 years ago

I see the same errors messages on my hassio running on rpi3 and I am only running one ikea trådfri gateway.

balloobbot commented 5 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

balloobbot commented 5 years ago

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍