Tradfri - "invalid config"

I have just setup Home Assistant so if I am missing anything on this post I am happy to amend it.

I have recently bought some Ikea Tradfri smart lights which I can use with Home Assistant. I am trying to add the Tradfri lights to my configurations.yaml file so that I can control them with Home Assistant. When I reboot my Pi (2) and go to http://hassbian.local:8123 on the states page I am presented with this:

screen shot 2017-05-22 at 18 43 11

I have tripled check my configurations.yaml file for the Tradfri lights but this error still comes up. This is the Tradfri part of my configurations.yaml part. I have changed the host key and api_key to keep them private:

tradfri:
host: 123.456.89.7
api_key: 76FFDfbbhR

This is what my log says as well about the issue:

2017-05-22 18:22:34 ERROR (MainThread) [homeassistant.setup] Setup failed for tradfri: Component failed to initialize.

and

I have changed the IP address and the part next to it to keep them private I have replaced them with some random number:

2017-05-22 18:22:57 WARNING (Thread-11) [netdisco.ssdp] Found malformed XML at http://123.456.7.89:12345/description0.xml: 2017-05-22 18:22:58 WARNING (Thread-11) [netdisco.ssdp] Found malformed XML at http://123.456.7.89:12345/description1.xml: 2017-05-22 18:22:58 WARNING (Thread-11) [netdisco.ssdp] Found malformed XML at http://123.456.7.89:12345/description3.xml:

Thanks so much for looking at this and I am happy to provide more information about this issue if needed. :+1:

Did you shortened your API-Key before posting it here? My API-Key is 16 chars long

Yes I did. I only did that to keep my api-key private

And you followed the instructions to install libtool, autoconf, etc?

Yes I ran the following:

$ sudo apt-get install libtool
$ sudo apt-get install autoconf

$ git clone --depth 1 --recursive -b dtls https://github.com/home-assistant/libcoap.git
$ cd libcoap
$ ./autogen.sh
$ ./configure --disable-documentation --disable-shared --without-debug CFLAGS="-D COAP_DEBUG_FD=stderr"
$ make
$ sudo make install

Okay. And the “malformed XML”-error belongs to the IP of your Gateway, right? Did you tried to restart the gateway? I didn`t get these errors from my Gateway. And did you updated the gateway? My version is 1.1.0015

I will try to restart my gateway and see if that works. My software is all up to date according to the Tradfri app

Unfortunately, I have restarted my gateway and then my Pi but I am still unable to connect to my Tradfri lights.

Okay, that’s strange, my setting is the same and it works for me. Did a tradfri.conf appeared in your config-directory? And do you have the discovery-mode enabled?

Yes, I have got discovery-mode enabled. I have entered the API-key in many time but it still doesn’t work. This is what it say:

Long shot but double check the key you are using. I had an issue with a L or I or 1 that I was entering wrong.

1 Like

OK, i’ll look at it again.

Right, i remember having this issue, too :smiley:

I have had a look once again but I am having no look. I am going to reinstall home assistant and try again.

I have reinstalled Home Assistant but the same probelm is still occuring?

another long shot but are you sure your IP address is correct? The IP address entered into your config.yaml is the IP address of your Ikea gateway?

Did you set everything up in the app first?

Final long shot, make sure you are not confusing the MAC address and API key, they are both 16 digits long.

Can i just confirm that the security code is the api-key and how did you find out your ip address of your gateway?

Thanks

Yes Security code = api-key

You will need to log in to your router and look it up. (if you don’t know how, either google it or post the make/model here for some help) The MAC address is printed on the back of the gateway and there should be a table of attached devices and the current IP address assigned.

It is a good idea to assign a fixed IP to the gateway (and really any home assistant device) as it won’t change that way in the future. Generally your DHCP server will continually give the same IP, but it is not guaranteed, it can create some headaches in the future if it does change randomly.

I have the same problem as dylanmurphy.
I tried the setup explained in https://learn.pimoroni.com/tutorial/sandyj/controlling-ikea-tradfri-lights-from-your-pi
that works perfectly.

This also tells me that the IP and the security code is valid of the tradfri hub I used in the HA config. I can controll my Receiver and Chromecast with Home assistant so the HA setup is working either.
Firmware level of the hub is 1.1.0015.

Any thoughts?

I have been having issues with connecting my hub when I restart HA. I get an invalid config notification that only is resolved by rebooting the hub letting it boot and then rebooting HA. Might be worth a try for you, reboot the hub and then HA.

I was going to submit a issue on Github but I can’t seem to reproduce it consistently.