Tradfi Configuration Question

I’m having some issues getting the the tradfri component working and was hoping fro some help. I’m running HA in a virtual_env setup. Just upgraded to release 0.43 to use this component.

I followed the instructions at this link IKEA Tradfri
One thing that wasn’t clear from the instructions was which direction this procedure is run in. I’ve tried inside the virtual environment area (/srv/homeassistant/) and other places, however I seem to continue to have the same problem. One deviation from the procedure in the link above is using sudo on the make install, otherwise the procedure doesn’t seem to complete properly due to permissions issue. Having said that, during the component setup process I get the following error in my HA log file and of course the component doesn’t load.

17-04-23 00:34:05 INFO (MainThread) [homeassistant.setup] Setting up tradfri
17-04-23 00:34:05 ERROR (MainThread) [homeassistant.setup] Error during setup of component tradfri
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/", line 189, in _async_setup_component
    result = yield from component.async_setup(hass, processed_config)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/", line 97, in async_setup
    return (yield from _setup_gateway(hass, config, host, key))
  File "/usr/lib/python3.5/asyncio/", line 206, in coro
    res = func(*args, **kw)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/", line 106, in _setup_gateway
    api = retry_timeout(cli_api_factory(host, key))
  File "/home/homeassistant/.homeassistant/deps/pytradfri/", line 81, in api_factory
    request('get', ['status'])
  File "/home/homeassistant/.homeassistant/deps/pytradfri/", line 50, in request
    return_value = subprocess.check_output(command, **kwargs)
  File "/usr/lib/python3.5/", line 626, in check_output
  File "/usr/lib/python3.5/", line 693, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.5/", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'coap-client'
17-04-23 00:34:05 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: service=process, domain=conversation>
17-04-23 00:34:05 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_data=title=Invalid config, notification_id=invalid_config, message=The following components and platforms could not be set up:
* [tradfri](

This is also the setup I have in configuration.yaml:

  api_key: <REDACTED>

Thanks in advance for any assistance!

The stack trace suggests home assistant can’t find the coap-client program. Where did the program get installed when you ran sudo make install? You can try to call the program yourself from the command line. Does that succeed? You have to make sure the program is accessible and runnable from the command line.

When I built and installed lib-coap I did so as my normal user, ie not as the homeassistant user, since the homeassistant user doesn’t have superuser access.

Thanks for your response.

It definitely feels like a permissions issue. I can invoke coap-client with both my HA user and normal user (although I just get the man page for it). I actually tried installing in several different locations as I wasn’t sure if that had an effect on it:

  • inside the virtual environment (/srv/homeassistant)
  • inside /home/homeassistant

Each time I ran make install (with sudo b/c it would error out when sudo wasn’t used) I ran it in the same location it was installed.

Decided to try and completely wipe out my HA implementation and rebuild it (because of this issue and others where it seemed HA was really unstable/inconsistent). After doing so, I again followed the process for the tradfri bulbs, installing the libcoap file in my virtual environment (although I had to use sudo for the git command). All appears to be working now…

1 Like

Do you also see motion sensor and/or the dimmer button in Hass?
I only see the light and not my sensors.

I wish I could see the brightness and color settings within my view on HA, but I have to click on the view card to be able to change them since they’re listed as a group in HA and Tradfri App.

@PuckStar I don’t see them. There’s a post from the folks working on this that they do not work at this time.

Got the same error myself, and when I ran all commands with sudo (even those without sudo in the docs) from and restarted HA, it worked.