Ikea Tradfri not working after Gateway reset

After having to reset my Tradfri gateway (I wasn’t able to connect both my remote and a lightstrip at the same time) HASS can’t connect to my Gateway anymore. The log shows an error related to the encryption.

2017-11-05 16:05:47 ERROR (MainThread) [coap] Fatal DTLS error: code 115
2017-11-05 16:05:47 ERROR (MainThread) [coap] Exception CancelledError() can not be represented as errno, setting -1.
2017-11-05 16:05:47 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File “/usr/lib/python3.6/asyncio/tasks.py”, line 181, in _step result = coro.throw(exc)
File “/usr/lib/python3.6/site-packages/homeassistant/components/tradfri.py”, line 108, in gateway_discovered allow_tradfri_groups)
File “/usr/lib/python3.6/site-packages/homeassistant/components/tradfri.py”, line 141, in _setup_gateway gateway_info_result = yield from api(gateway.get_gateway_info())
File “/usr/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py”, line 149, in request result = yield from self._execute(api_commands)
File “/usr/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py”, line 139, in _execute _, res = yield from self._get_response(msg)
File “/usr/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py”, line 92, in _get_response r = yield from pr.response
File “/usr/lib/python3.6/asyncio/futures.py”, line 331, in iter yield self # This tells Task to wait for completion. File “/usr/lib/python3.6/asyncio/tasks.py”, line 244, in _wakeup future.result()
File “/usr/lib/python3.6/asyncio/futures.py”, line 244, in result raise self._exception File “/usr/lib/python3.6/site-packages/aiocoap/protocol.py”, line 814, in _run_outer yield from cls._run(app_request, response, weak_observation, protocol, log, exchange_monitor_factory)
File “/usr/lib/python3.6/site-packages/aiocoap/protocol.py”, line 863, in _run blockresponse = yield from blockrequest.response
File “/usr/lib/python3.6/asyncio/futures.py”, line 331, in iter yield self # This tells Task to wait for completion. File “/usr/lib/python3.6/asyncio/tasks.py”, line 244, in _wakeup future.result()
File “/usr/lib/python3.6/asyncio/futures.py”, line 244, in result raise self._exception OSError: [Errno -1] No error information

After this it keeps spamming:

2017-11-05 16:05:47 ERROR (MainThread) [coap] Fatal DTLS error: code 115
2017-11-05 16:05:47 ERROR (MainThread) [coap] Exception CancelledError() can not be represented as errno, setting -1.

Somebody knows how to reset the tradfri component or knows what else to do?

I’m running Hass.io with latest HASS version on a raspberry pi 3

I have the same issue , latest version of hass.io running on RPI 3

solved it.
remove .tradfri_conf in the configuration folder and reconfigure the gateway after a reboot

removed it… reboot… added key and result…none
Traceback (most recent call last):
File “/usr/lib/python3.6/asyncio/tasks.py”, line 179, in _step
result = coro.send(None)
File “/usr/lib/python3.6/site-packages/homeassistant/components/tradfri.py”, line 66, in configuration_callback
psk = yield from api_factory.generate_psk(callback_data.get(‘key’))
File “/usr/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py”, line 193, in generate_psk
self._psk = yield from self.request(command)
File “/usr/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py”, line 149, in request
result = yield from self._execute(api_commands)
File “/usr/lib/python3.6/site-packages/pytradfri/api/aiocoap_api.py”, line 141, in _execute
api_command.result = _process_output(res, parse_json)
File “/usr/lib/python3.6/site-packages/pytradfri/command.py”, line 71, in result
self._result = self._process_result(value)
File “/usr/lib/python3.6/site-packages/pytradfri/gateway.py”, line 28, in process_result
return result[ATTR_PSK]
TypeError: ‘NoneType’ object is not subscriptable

Well for me the error was due to a wrong token in the .tradfri_conf. Have you tried resetting the gateway in between?

just did it
that file never showed again on my config folder…
I have a weird I that can be read as 1 that I might have insisted more than once… but log shows an error not really related to wrong key… :frowning:
and by the way… was working few days back

as far as I’m aware aiocoap is the part of pytradfri that handles the encryption. but your error is different from the one I got anyway.
There’s some issues concerning the tradfri open on github, I suppose those get fixed within the next weeks.

tradfri gateway fw 1.2.42

not within the firmware of the gateway, within homeassistant

I’m facing the same issue. Not able to configure the IKEA gateway.

Everything is newly installed and updated, running Hassbian :frowning:

/Brygger

I know that. But read somewhere about reset gateway remove ll lamps etc…well it doesnt work :frowning:stuck with no lights. bummer

I added the IKEA component in configuration.yaml file besides having Discovery enabled. And now it shows up twice in the “Configurator” pane on the overview page(?)

Still nothing works. This is getting weird :astonished:

happened the same for me
doesn’t help

This is the error code I see in the log file:

2017-11-09 20:33:07 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/tradfri.py", line 66, in configuration_callback
    psk = yield from api_factory.generate_psk(callback_data.get('key'))
  File "/srv/homeassistant/lib/python3.5/site-packages/pytradfri/api/aiocoap_api.py", line 193, in generate_psk
    self._psk = yield from self.request(command)
  File "/srv/homeassistant/lib/python3.5/site-packages/pytradfri/api/aiocoap_api.py", line 149, in request
    result = yield from self._execute(api_commands)
  File "/srv/homeassistant/lib/python3.5/site-packages/pytradfri/api/aiocoap_api.py", line 141, in _execute
    api_command.result = _process_output(res, parse_json)
  File "/srv/homeassistant/lib/python3.5/site-packages/pytradfri/command.py", line 71, in result
    self._result = self._process_result(value)
  File "/srv/homeassistant/lib/python3.5/site-packages/pytradfri/gateway.py", line 28, in process_result
    return result[ATTR_PSK]
TypeError: 'NoneType' object is not subscriptable

I’m not sure it is a bug, but it seems that it cannot write the tradfri.conf file.

it looks more like the pre shared key for the encryption is an empty string.
and the .tradfri_conf is hidden, might wanna try ls -a in a console in your configuration folder

This is the content of my configuration folder…

pi@hassbian:/home/homeassistant/.homeassistant $ ll -a
total 14572
drwxr-xr-x 5 homeassistant homeassistant     4096 Nov 10 14:44 .
drwxr-xr-x 4 homeassistant homeassistant     4096 Nov  8 23:59 ..
-rw-r--r-- 1 homeassistant homeassistant      204 Nov  9 19:56 automations.yaml
-rw-r--r-- 1 homeassistant homeassistant     2998 Nov  9 21:22 configuration.yaml
-rw-r--r-- 1 homeassistant homeassistant      192 Nov  9 01:20 customize.yaml
drwxr-xr-x 2 homeassistant homeassistant     4096 Nov  8 23:59 deps
-rw-r--r-- 1 homeassistant homeassistant     2522 Nov  9 21:52 groups.yaml
-rw-r--r-- 1 homeassistant homeassistant        6 Nov  8 23:59 .HA_VERSION
-rw-r--r-- 1 homeassistant homeassistant   907070 Nov 10 14:44 home-assistant.log
-rw-r--r-- 1 homeassistant homeassistant 13926400 Nov 10 14:44 home-assistant_v2.db
-rw-r--r-- 1 homeassistant homeassistant     1845 Nov 10 12:27 .ios.conf
-rw-r--r-- 1 homeassistant homeassistant      361 Sep 24 22:25 known_devices.yaml
-rw-r--r-- 1 homeassistant homeassistant       45 Sep 24 21:06 lights.yaml
-rw-r--r-- 1 homeassistant homeassistant        2 Sep 24 21:07 media_player.yaml
-rw-r--r-- 1 homeassistant homeassistant       74 Nov  9 01:11 phue.conf
-rw-r--r-- 1 homeassistant homeassistant        0 Nov  8 23:59 scripts.yaml
-rw-r--r-- 1 homeassistant homeassistant      501 Nov  9 01:09 secrets.yaml
-rw-r--r-- 1 homeassistant homeassistant      837 Nov  9 21:40 sensor.yaml
-rw-r--r-- 1 homeassistant homeassistant      412 Nov  9 01:25 switches.yaml
drwxr-xr-x 2 homeassistant homeassistant     4096 Nov  9 00:00 tts
-rw-r--r-- 1 homeassistant homeassistant       44 Nov  9 00:01 .uuid
drwxr-xr-x 2 homeassistant homeassistant     4096 Nov  9 00:42 www

From my point of view it looks allright. But I don’t have the .tradfri_conf file in my inventory. Is it mandatory for Tradfri to get connected?

/Kaspar

yes it is, because the token for the encryption between the gateway and HASS is saved in that file

Ok, then what is the ‘tradfri.conf’ file I had earlier when I ran hass.io (and it worked)?

I don’t know, maybe a deprecated configuration file for tradfri?

honestly…to me… and I am having exactly same problem… looks like UI is not sending the typed string to the core. That is why lot of people does not have issues… and others (like and you) have. We deleted the tradfri.conf where they key was… and not we cannot add that key?

Is that a possibility?