Tradfri configurator never accepts key

I’m on HASSIO 0.57.2 trying to get my Tradfri hub to connect but after I put the key in the configurator and click ‘Confirm’, nothing seems to happen aside from the message about calling the configurator service. I’ve power cycled the hub multiple times and it did work fine prior to the changes Ikea made. If I leave it alone un-configured the logs fill up with the below message (home-assistant.log had grown to 1.3GB when I left it for a day).

2017-11-06 10:57:19 ERROR (MainThread) [coap] Exception CancelledError() can not be represented as errno, setting -1.
2017-11-06 10:57:19 ERROR (MainThread) [coap] Fatal DTLS error: code 20

Any ideas what I can do to kickstart this? Perhaps the commands needed so I can create my .tradfri_psk.conf file myself?

Have you noticed this breaking change introduced with 0.57.0?

image

Yes, one of the first things I did was remove the api_key from my config. In fact, it’s “configured” via discovery right now so there isn’t any tradfri: blocks in my config.

I’m having the same issue with hassbian.

I also had this issue. But after I entered the key I did a reboot and all was fine. You could also reboot the Tradfri bridge.

I had this updated the hub removed key and was all good is your hub up-to-date in the app?

All is up-to-date and afterwards, I rebooted my Pi since then a dozen times and it’s still working.

If you cannot enter the security key in the “Configure” process, how can you then add the gateway to HA?

Well, I don’t know what is different but after a flurry of rebooting the hub, restarting the docker containers and just for fun rebooting the whole host I was able to get it to configure ¯_(ツ)_/¯

I’ve got the same behaviour as described in the first post, but I cannot get it to work by restarting the hub, host or container. When clicking ‘configure’, putting in the Security Code and clicking ‘confirm’ I always get the following error message:

Nov 14 10:17:43 home-assistant docker[1385]: 2017-11-14 09:17:43 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Nov 14 10:17:43 home-assistant docker[1385]: Traceback (most recent call last):
Nov 14 10:17:43 home-assistant docker[1385]:   File "/usr/lib/python3.6/asyncio/tasks.py", line 181, in _step
Nov 14 10:17:43 home-assistant docker[1385]:     result = coro.throw(exc)
Nov 14 10:17:43 home-assistant docker[1385]:   File "/usr/lib/python3.6/site-packages/homeassistant/components/tradfri.py", line 66, in configuration_callback
Nov 14 10:17:43 home-assistant docker[1385]:     psk = yield from api_factory.generate_psk(callback_data.get('key'))
Nov 14 10:17:43 home-assistant docker[1385]:   File "/usr/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py", line 193, in generate_psk
Nov 14 10:17:43 home-assistant docker[1385]:     self._psk = yield from self.request(command)
Nov 14 10:17:43 home-assistant docker[1385]:   File "/usr/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py", line 149, in request
Nov 14 10:17:43 home-assistant docker[1385]:     result = yield from self._execute(api_commands)
Nov 14 10:17:43 home-assistant docker[1385]:   File "/usr/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py", line 139, in _execute
Nov 14 10:17:43 home-assistant docker[1385]:     _, res = yield from self._get_response(msg)
Nov 14 10:17:43 home-assistant docker[1385]:   File "/usr/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py", line 92, in _get_response
Nov 14 10:17:43 home-assistant docker[1385]:     r = yield from pr.response
Nov 14 10:17:43 home-assistant docker[1385]:   File "/usr/lib/python3.6/asyncio/futures.py", line 331, in __iter__
Nov 14 10:17:43 home-assistant docker[1385]:     yield self  # This tells Task to wait for completion.
Nov 14 10:17:43 home-assistant docker[1385]:   File "/usr/lib/python3.6/asyncio/tasks.py", line 244, in _wakeup
Nov 14 10:17:43 home-assistant docker[1385]:     future.result()
Nov 14 10:17:43 home-assistant docker[1385]:   File "/usr/lib/python3.6/asyncio/futures.py", line 244, in result
Nov 14 10:17:43 home-assistant docker[1385]:     raise self._exception
Nov 14 10:17:43 home-assistant docker[1385]:   File "/usr/lib/python3.6/site-packages/aiocoap/protocol.py", line 814, in _run_outer
Nov 14 10:17:43 home-assistant docker[1385]:     yield from cls._run(app_request, response, weak_observation, protocol, log, exchange_monitor_factory)
Nov 14 10:17:43 home-assistant docker[1385]:   File "/usr/lib/python3.6/site-packages/aiocoap/protocol.py", line 863, in _run
Nov 14 10:17:43 home-assistant docker[1385]:     blockresponse = yield from blockrequest.response
Nov 14 10:17:43 home-assistant docker[1385]:   File "/usr/lib/python3.6/asyncio/futures.py", line 331, in __iter__
Nov 14 10:17:43 home-assistant docker[1385]:     yield self  # This tells Task to wait for completion.
Nov 14 10:17:43 home-assistant docker[1385]:   File "/usr/lib/python3.6/asyncio/tasks.py", line 244, in _wakeup
Nov 14 10:17:43 home-assistant docker[1385]:     future.result()
Nov 14 10:17:43 home-assistant docker[1385]:   File "/usr/lib/python3.6/asyncio/futures.py", line 244, in result
Nov 14 10:17:43 home-assistant docker[1385]:     raise self._exception
Nov 14 10:17:43 home-assistant docker[1385]: OSError: [Errno -2] No error information

I’m using the raspberrypi2-homeassistant image from Docker Hub, version 0.57.3.

Apart from reboots the only way I fixed it was factory reset of a Tradfri GW, deleting the generated file (with IP and hashed password) in confiugration folder and then re-adding everything.

I just reseted my gateway. However, I get the same errors as before in the log and the configuration does not accept my secret code for the gateway. Any other way to get Tradfri working again with 0.57.2?

EDIT: after hours of debugging, I kept copying the wrong secret code from my pass manager. It works after resetting the gateway for me now!

I reset the gateway twice, also checked the secret code several times and still get the same error message. There is no generated file inside the config directory I could delete. This is a new installation initially set up with 0.57.2, later “updated” (pulled the new image) to 0.57.3 so Home Assistant has not yet been able to succesfully communicate with the Tradfri gateway.

Any other suggestions?

I’m having the same problem…

Still not working in 0.58. I just got some Ikea lights and was hoping to use them. I’ve tried installing DLTSSocket manually (after autoconf), but still get errors in the log and it never accepts the key. I’m running Hassbian on a Pi3.

It would be good to see more info added to the component pages to detail any workarounds required. It would save a lot of trawling through the forum.

I couldn’t get Tradfri to work on my Pi2 on Hassbian Stretch image, tried almost every fix. After updating to 0.58 it works.
Packages
sudo apt-get install libtool autoconf

Stop HA and activate virtual environment as when upgrading HA. Ensure pip packages are installed and upgrade (Cython takes 10-15min).

pip3 install --upgrade Cython
pip3 install --upgrade DTLSSocket
pip3 install --upgrade aiocoap

Today I inserted the key and it just accepted it. I don’t know why, but it’s working… I’m in Hassio 0.57.3 and the tradfri stopped working when I updated to this version. Last time I rebooted was 4 days ago.
I inserted the key from outside the home network.

It’s the second time this happens, Tradfri stops working, I try everything and nothing, then I sit on it for a few days, and it works (it happened with this version and with some older version I don’t remember, but I was on Hassbian back then).

No change with the raspberrypi2-homeassistant image version 0.58 and some more gateway resets. I still get the exact same error as already posted.

I’m also still getting this error in my log. Tried restarting the GW and HA. Fails every time :disappointed_relieved:

Just upgraded to 0.58.1 on my Hass.io and thought it was fixed, but no way. It’s a really big show stopper.

UPDATE:

I managed to get it working! But it required a complete reset of the Tradfri gateway.

It seems that the firmware wasn’t upgraded even though the app stated that all was updated (both the gateway, bulbs and remotes). From the app clear all settings and during reset it requested the update to v1.2.xxx. Before my app showed the gateway was something like v1.0.xxx.

When I added all the remotes and the bulbs I rebooted HA and then it was possible to add it :slight_smile:

I hope you all can gain from my experience.