Tradfri setup failed in 0.60.0 (Python 3.6.3)

So, I set up Tradfri a couple weeks ago and everything worked fine. About a week ago I upgraded to Python 3.6.3 and Home Assistant 0.60.0 and Tradfri stopped working. For some reason I had to install autoconf and DTLSSocket using:

apt get install autoconf and pip install dtlssocket.

Everything worked fine after that. Now, a couple of days later Tradfri broke once again. I didn’t update anything. It just stopped working and I’m now receiving the following errors:

Tradfri setup failed.

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py", line 92, in _get_response
    r = yield from pr.response
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 332, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
  File "/srv/homeassistant/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 "/srv/homeassistant/lib/python3.6/site-packages/aiocoap/protocol.py", line 865, in _run
    blockresponse = yield from blockrequest.response
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 332, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
aiocoap.error.RequestTimedOut

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/tradfri.py", line 154, in _setup_gateway
    gateway_info_result = yield from api(gateway.get_gateway_info())
  File "/srv/homeassistant/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py", line 152, in request
    result = yield from self._execute(api_commands)
  File "/srv/homeassistant/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py", line 142, in _execute
    _, res = yield from self._get_response(msg)
  File "/srv/homeassistant/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py", line 98, in _get_response
    raise RequestTimeout('Request timed out.', e)
pytradfri.error.RequestTimeout: ('Request timed out.', RequestTimedOut())

Also, in the frontend I now see the Tradfri component again which keeps asking for the security code, which is already in my .tradfri_psk.conf. It’s not literally in there, but I’m guessing its a token or a hashed version of it. The .conf file is there though.

Has anyone else received these errors recently? If so, did you fix it?

Rebooting the Tradfri Gateway and Home Assistant doesn’t help. I didn’t try anything else yet, since everything has been working fine the last couple of days and I didn’t update anything.

Edit: I’m on Raspbian using a Virtual Env.

Ok, so I just noticed that my Tradfri Gateway wasn’t connected to the internet anymore. The ‘Internet’ (middle) light was pulsing, which indicates that it isn’t connected to the internet or that something is wrong with the connection.

I’m not sure why it wasn’t connected, but it didn’t get an IP from my router. I’ve given it a static IP, so that I can check it’s status in Home Assistant using the nmap device tracker, but it wasn’t assigned that IP (or any other).

After rebooting my router and trying several other things it worked again.

3 Likes

Thank you for posting your solution @thmry. I had the same problem and didn’t realize it was just a connection error.

The Trådfri UI could really use an error message in case the gateway cannot be reached.

Hi all,

Just wanted to confirm that it is probably a network issue. I ran into the same problem where Hassio told me there was an error with the Tradfri Setup. After a while I noticed Hassio said it found new integrations at the same time: Ikea Tradfri. Turned out that resetting my router (which I did earlier after a firmware upgrade) assigned a new IP to the Tradfri hub. After giving the Tradfri Hub the IP it should have (according to Hassio, you can see that on the page with the integrations) and rebooting both the router and Hassio everything was back online. The main reason I didn’t want to re-setup the Tradfri platform was a fear that all lights, remotes and wallplugs from Ikea would get a new id in hassio, therefore getting new entity id’s and thus not working in all my automations.

So in short: If you get an error about Tradfri not being setup correctly, please check if Hassio can find the Ikea hub on the IP it thinks it should have!