# Problems linking Tradfri Gateway

**URL:** <https://community.openhab.org/t/problems-linking-tradfri-gateway/36284>\
**Category:** Bindings\
**Created:** [November 17, 2017, 6:56am UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284 "2017-11-17T06:56:54Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![renegade2k](https://community.openhab.org/user_avatar/community.openhab.org/renegade2k/32/106512_2.png) [@renegade2k](https://community.openhab.org/u/renegade2k)\
**Post date:** [November 17, 2017, 6:56am UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284/1 "2017-11-17T06:56:54Z")

</div>

Hey guys.  
I’m new to obenHAB and i wanted to try to get some “real” automation with Tradfri, i.e. when i leave my home and my smartphone disconnects the wifi, lights should turn off.  
So i installed openHABianpi on my RPi2 and done the initial setup like in the beginners guide.

I got already my AVM FIrtzBox connected and also the thermostats, which i can control. So it seems i’m doing things right ^^  
When trying to connect Tradfri, the binding does not find any devices. Connecting the gateway manually with its ip openHAB tells me, the state is “unknown” and i still can’t find any devices like the lights.  
I tried resetting the whole gateway to factory defaults, so it falls back to firmware version 1.0.0008. THEN it’s visible, but when i link it, the state is “UNINITIALIZED - HANDLER\_CONFIGURATION\_PENDING”.  
Guessed i need to do the initial setup over the tradfri app, but doing this, it updates the gateway again to 1.2.42 and the state changes to “offline”. Doing the regular restart, i.e. unplug the power and plug it in again, does not change anything.

Help me plz ☹

---

<div class="post-metadata">

**Author:** ![ei\_Gelb\_Geek](https://community.openhab.org/user_avatar/community.openhab.org/ei_gelb_geek/32/14503_2.png) [@ei\_Gelb\_Geek](https://community.openhab.org/u/ei_Gelb_Geek)\
**Post date:** [November 17, 2017, 12:30pm UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284/2 "2017-11-17T12:30:06Z")

</div>

![03](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/c/c/cc4ff4e3af4fa6fd99eb9a397657bf8d8e67e4e3.png)

Security Code ?!?!

---

<div class="post-metadata">

**Author:** ![hmerk](https://community.openhab.org/user_avatar/community.openhab.org/hmerk/32/56432_2.png) [@hmerk](https://community.openhab.org/u/hmerk)\
**Post date:** [November 17, 2017, 5:25pm UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284/3 "2017-11-17T17:25:10Z")

</div>

Security code can be found on the back side of your Tradfri gateway.

---

<div class="post-metadata">

**Author:** ![ei\_Gelb\_Geek](https://community.openhab.org/user_avatar/community.openhab.org/ei_gelb_geek/32/14503_2.png) [@ei\_Gelb\_Geek](https://community.openhab.org/u/ei_Gelb_Geek)\
**Post date:** [November 17, 2017, 5:42pm UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284/4 "2017-11-17T17:42:31Z")

</div>

I know. My Answer was mean as Question, because without Security Code you have the Issue he discribe.

---

<div class="post-metadata">

**Author:** ![renegade2k](https://community.openhab.org/user_avatar/community.openhab.org/renegade2k/32/106512_2.png) [@renegade2k](https://community.openhab.org/u/renegade2k)\
**Post date:** [November 17, 2017, 5:47pm UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284/5 "2017-11-17T17:47:28Z")

</div>

Well, i entered the Security Code from the backside, and i guess it was right, cause i checked it twice.  
I will still try it on (or two ^^) more time just to be sure.

> because without Security Code you have the Issue he discribe

You mean the “UNINITIALIZED - HANDLER\_CONFIGURATION\_PENDING” error or the “unknown” state error?  
And do i have to enter something special into “Thing ID” field? Or is it just a random generated Number?

PS: Just noticed, i see the gateway when searching with the “HTTP binding” for devices, but it’s invisible when searching with teh “tradfri binding”.

---

<div class="post-metadata">

**Author:** ![onshi](https://community.openhab.org/letter_avatar_proxy/v4/letter/o/e495f1/32.png) [@onshi](https://community.openhab.org/u/onshi)\
**Post date:** [November 17, 2017, 6:13pm UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284/6 "2017-11-17T18:13:50Z")

</div>

I had some difficulty with my Tradfri gateway recenty, around the time that IKEA updated the firmware… which may or may not have been related. I know the code was entered correctly as I presumed this was the problem. It seemed to resolve itself after a few reboots (of the gateway and of openhab). Sorry I can’t be of more help.

---

<div class="post-metadata">

**Author:** ![renegade2k](https://community.openhab.org/user_avatar/community.openhab.org/renegade2k/32/106512_2.png) [@renegade2k](https://community.openhab.org/u/renegade2k)\
**Post date:** [November 17, 2017, 6:16pm UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284/7 "2017-11-17T18:16:00Z")

</div>

Indeed i have not tried rebooting both devices after linking the gateway manually.  
I just updated the RPi over ssh and will try it now.

_Feedback asap 😉_

---

<div class="post-metadata">

**Author:** ![renegade2k](https://community.openhab.org/user_avatar/community.openhab.org/renegade2k/32/106512_2.png) [@renegade2k](https://community.openhab.org/u/renegade2k)\
**Post date:** [November 20, 2017, 3:33pm UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284/8 "2017-11-20T15:33:53Z")

</div>

So, its done, but still not working ☹

Restarted the GW … nothing.  
Restarted the RPi … nothing.  
Restarted both at the same time and i don’t know, whether it was just bad luck, or the error was associated to each other, but my GW was frozen, so i can’t even control it from the tradfri app on my smartphone.

Finally i did a full factory reset on the GW and done the whole setup thing again (this is so damn nasty to sync all remotes to GW and then sync all bulbs to each remote -.-\*).  
In this step i also did a full reinstall of openhabian on my RPi and now i just stuck where i startet from…  
I can’t find my tradfri … Adding it manually results in “OFFLINE - COMMUNICATION\_ERROR”.  
But the GW is now up and running, as i can control it through the app and also see in in my FritzBox as a running network device.

PS: only thing i found in the log files:

> 2017-11-20 16:29:24.275 [ThingAddedEvent] - Thing ‘tradfri:gateway:409aa389’ has been added.  
> 2017-11-20 16:29:24.341 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:409aa389’ changed from UNINITIALIZED to INITIALIZING  
> 2017-11-20 16:29:24.381 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:409aa389’ changed from INITIALIZING to UNKNOWN  
> 2017-11-20 16:30:37.809 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:409aa389’ changed from UNKNOWN to OFFLINE (COMMUNICATION\_ERROR)

PPS:  
I also tried adding the GW manually by “hardcoding” it into the system. so i removed my GUI added GW and created a tradfri.things file. Added there:

> Bridge tradfri:gateway:mygateway [host=“192.168.178.125”, code=“\< my actual security code \>”] {  
> 0100 myDimmableBulb [id=65537]  
> }  
> Restarted the RPi and … got the same error XD

---

<div class="post-metadata">

**Author:** ![renegade2k](https://community.openhab.org/user_avatar/community.openhab.org/renegade2k/32/106512_2.png) [@renegade2k](https://community.openhab.org/u/renegade2k)\
**Post date:** [November 21, 2017, 4:23pm UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284/9 "2017-11-21T16:23:46Z")

</div>

Oooookaaaay.

**I did it finally!!!**

You wont believe … The Security Code printed on the backside is **WRONG**!  
I just figured it out, as i was randomly checking everything and extracted the information from the QR code.  
A letter, which should be a “g” was printed as “q”, but a few letters on the “g” was again printed as a “g” … so it’s impossible to see it!

Thx for the help guys!

---

<div class="post-metadata">

**Author:** ![TTNo13](https://community.openhab.org/letter_avatar_proxy/v4/letter/t/2bfe46/32.png) [@TTNo13](https://community.openhab.org/u/TTNo13)\
**Post date:** [November 29, 2017, 11:17pm UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284/10 "2017-11-29T23:17:50Z")

</div>

Hi!  
I Have a very similar problem with my IKEA Tradfri Gateway.  
Started out with a Openhab 2.2.1 and that did not detect the gateway at all.  
Upgraded to 2.2.2-snap: Now the gateway (Current firmware 1.2.42) is detected with an IP adress but never gets online. I am unsure if The Pre sheared security key is returned from the gateway. I have seen “\*\*\*\*” in the line but I am unsure if that was my browser propsing to use the security code as I asked Chrome to remember the “password”

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/a/e/ae19fe86638860b85b4ff54572c886b9f45f68a6.png)  
I have tried restarting, rebooting, removing the bindings and installing again without success, and even scanned the DOT matrix code (renegade2k) to ensure that the security code was correctly printed.

## See Event Log:

## ‘tradfri:gateway:gwdcefcabc8263’ changed from OFFLINE (COMMUNICATION\_ERROR): No response from gateway. Might be due to an invalid security code. to OFFLINE (CONFIGURATION\_ERROR): Either security code or identity and pre-shared key must be provided in the configuration! 2017-11-29 22:38:55.407 [me.event.ThingUpdatedEvent] - Thing ‘tradfri:gateway:gwdcefcabc8263’ has been updated. 2017-11-29 22:38:55.418 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:gwdcefcabc8263’ changed from OFFLINE (CONFIGURATION\_ERROR): Either security code or identity and pre-shared key must be provided in the configuration! to UNKNOWN 2017-11-29 22:39:05.863 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:gwdcefcabc8263’ changed from UNKNOWN to OFFLINE (COMMUNICATION\_ERROR): No response from gateway. Might be due to an invalid security code. 2017-11-29 22:40:38.607 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:gwdcefcabc8263’ changed from OFFLINE (COMMUNICATION\_ERROR): No response from gateway. Might be due to an invalid security code. to UNINITIALIZED 2017-11-29 22:40:38.614 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:gwdcefcabc8263’ changed from UNINITIALIZED to UNINITIALIZED (HANDLER\_MISSING\_ERROR) 2017-11-29 22:41:59.978 [home.event.InboxAddedEvent] - Discovery Result with UID ‘tradfri:gateway:gwdcefcabc8263’ has been added. 2017-11-29 22:41:59.996 [me.event.InboxRemovedEvent] - Discovery Result with UID ‘tradfri:gateway:gwdcefcabc8263’ has been removed. 2017-11-29 22:42:00.023 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:gwdcefcabc8263’ changed from INITIALIZING to UNKNOWN 2017-11-29 22:42:00.078 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:gwdcefcabc8263’ changed from UNINITIALIZED to INITIALIZING 2017-11-29 22:42:03.410 [me.event.ThingUpdatedEvent] - Thing ‘tradfri:gateway:gwdcefcabc8263’ has been updated. 2017-11-29 22:42:10.734 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:gwdcefcabc8263’ changed from UNKNOWN to OFFLINE (COMMUNICATION\_ERROR): No response from gateway. Might be due to an invalid security code. 2017-11-29 22:52:08.919 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:gwdcefcabc8263’ changed from REMOVING to REMOVED 2017-11-29 22:52:08.930 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:gwdcefcabc8263’ changed from REMOVED to UNINITIALIZED 2017-11-29 22:52:08.992 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:gwdcefcabc8263’ changed from OFFLINE (COMMUNICATION\_ERROR): No response from gateway. Might be due to an invalid security code. to REMOVING 2017-11-29 22:52:08.995 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:gwdcefcabc8263’ changed from REMOVED to UNINITIALIZED (HANDLER\_MISSING\_ERROR) 2017-11-29 22:52:34.688 [home.event.InboxAddedEvent] - Discovery Result with UID ‘tradfri:gateway:gwdcefcabc8263’ has been added. 2017-11-29 22:55:31.771 [me.event.InboxRemovedEvent] - Discovery Result with UID ‘tradfri:gateway:gwdcefcabc8263’ has been removed. 2017-11-29 22:55:31.778 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:gwdcefcabc8263’ changed from INITIALIZING to OFFLINE (CONFIGURATION\_ERROR): Either security code or identity and pre-shared key must be provided in the configuration! 2017-11-29 22:55:31.781 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:gwdcefcabc8263’ changed from UNINITIALIZED to INITIALIZING 2017-11-29 23:00:00.775 [me.event.ThingUpdatedEvent] - Thing ‘tradfri:gateway:gwdcefcabc8263’ has been updated. 2017-11-29 23:00:00.783 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:gwdcefcabc8263’ changed from OFFLINE (CONFIGURATION\_ERROR): Either security code or identity and pre-shared key must be provided in the configuration! to UNKNOWN 2017-11-29 23:00:11.262 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:gwdcefcabc8263’ changed from UNKNOWN to OFFLINE (COMMUNICATION\_ERROR): No response from gateway. Might be due to an invalid security code.

I really would appreciate some inputs. This is my first flirt with Openhab and I really would hate to throw the towel.‘’

Br. TTNo13  
PS: Unsure if it is significant: but in the Openhab.log it was reported that no IP adress was found in the Gatway. It wos online and the right IP adress was shown in the Thing Configuration. (TTNo13)

* * *

## Started Paper UI at /paperui 2017-11-29 22:05:37.882 [WARN] [iscovery.TradfriDiscoveryParticipant] - Discovered Tradfri gateway doesn’t have an IP address: [ServiceInfoImpl@4088961 name: ‘gw-dcefcabc8263.\_coap.\_udp.local.’ address: ‘(null):0’ status: ‘DNS: JmDNS-IP-1 [/192.168.0.20] state: probing 1 task: null’, has NO data, empty] 2017-11-29 22:05:37.967 [INFO] [g.discovery.internal.PersistentInbox] - Added new thing ‘tradfri:gateway:gwdcefcabc8263’ to inbox.

END

---

<div class="post-metadata">

**Author:** ![renegade2k](https://community.openhab.org/user_avatar/community.openhab.org/renegade2k/32/106512_2.png) [@renegade2k](https://community.openhab.org/u/renegade2k)\
**Post date:** [November 30, 2017, 6:04pm UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284/11 "2017-11-30T18:04:08Z")

</div>

Hm …  
I’m really not a pro, but several things seems strange to me.

1. I see your Headline - “Configuration \> Things \> Edit \> Ikea\_Tradfri”. When i edit mine, it looks like "Configuration \> Things \> Edit \> Trådfri Gateway ". Are you sure you chosen the Tradfri Gateway, as you was detecting your “thing”?
2. You got “identity” which might be the MAC-adress and “Pre-Shared key” which is a riddle to me … Mine for compare: ![1111](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/5/5/55de1222a0c4fe4f211687fd917dcebdd7dd2e12.png)  
Maybe the last point is which makes you GW looks like offline, cause your log says

> Either security code or identity and pre-shared key must be provided in the configuration

So it seems even you entered the security key your config still waiting for identitiy and PSK

---

<div class="post-metadata">

**Author:** ![TTNo13](https://community.openhab.org/letter_avatar_proxy/v4/letter/t/2bfe46/32.png) [@TTNo13](https://community.openhab.org/u/TTNo13)\
**Post date:** [December 1, 2017, 9:03pm UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284/12 "2017-12-01T21:03:11Z")

</div>

Thanks for your feedback. The difference in the GUI is because I’m using 2.2.0 snapshot an have named the gateway.  
Still not working so I’m getting a little irritated. 🙂 I guess I’ll just have to wait for an update.  
TT

---

<div class="post-metadata">

**Author:** ![sgebhardt](https://community.openhab.org/user_avatar/community.openhab.org/sgebhardt/32/72418_2.png) [@sgebhardt](https://community.openhab.org/u/sgebhardt)\
**Post date:** [January 22, 2018, 5:01pm UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284/13 "2018-01-22T17:01:16Z")

</div>

Hi TTNo13,

did you find a solution for your problem? I have a similar problem with my Tradfri Gateway.

---

<div class="post-metadata">

**Author:** ![ei\_Gelb\_Geek](https://community.openhab.org/user_avatar/community.openhab.org/ei_gelb_geek/32/14503_2.png) [@ei\_Gelb\_Geek](https://community.openhab.org/u/ei_Gelb_Geek)\
**Post date:** [January 22, 2018, 11:33pm UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284/14 "2018-01-22T23:33:06Z")

</div>

OH2 Release Build 2.2.0 and Tradfri Gateway Firmware 1.3.0.4 should fix all Problems.

---

<div class="post-metadata">

**Author:** ![ei\_Gelb\_Geek](https://community.openhab.org/user_avatar/community.openhab.org/ei_gelb_geek/32/14503_2.png) [@ei\_Gelb\_Geek](https://community.openhab.org/u/ei_Gelb_Geek)\
**Post date:** [January 22, 2018, 11:35pm UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284/15 "2018-01-22T23:35:58Z")

</div>

and check your Security Code … Scan the QR Code with a Mobilphone and look if the printed Code is similar to the scanned Code …

iOS = Camera App  
Android = Any QR Code App

---

<div class="post-metadata">

**Author:** ![sgebhardt](https://community.openhab.org/user_avatar/community.openhab.org/sgebhardt/32/72418_2.png) [@sgebhardt](https://community.openhab.org/u/sgebhardt)\
**Post date:** [January 23, 2018, 12:43pm UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284/16 "2018-01-23T12:43:16Z")

</div>

Thanks for your help. I found the solution for my problem. As suggestedin another thread i replaced the network cable.

> [@IKEA Trådfri Gateway](https://community.openhab.org/t/ikea-tradfri-gateway/26135/90):
>
> Found this on another forum. Might help people with gateway connectivity problems. I manage 3 OH2 sites and will try this on a problem site this upcoming weekend. My gateway is no longer visible in the router client list, so a bad cable could very well be the reason. The network cable that came with the gateway was delivered as a big knot, so I suspected that it would cause problems. As soon as I swapped it with a better cable, all problems vanished. The app now connects to the gateway insta…

For later reference:  
My OH is “relatively” new and on version 2.2.0 (Openhabian fresh installed at the christmas days). And my Tradfri Gateway is on Firmware 1.3.0.4.

---

<div class="post-metadata">

**Author:** ![jaxon](https://community.openhab.org/user_avatar/community.openhab.org/jaxon/32/72122_2.png) [@jaxon](https://community.openhab.org/u/jaxon)\
**Post date:** [March 18, 2018, 10:13pm UTC](https://community.openhab.org/t/problems-linking-tradfri-gateway/36284/17 "2018-03-18T22:13:21Z")

</div>

I also had this problem, the “Security code” code was right (both QR and printed) but still didn’t work when I entered it in “Configuration \> Things \> Edit \> Trådfri Gateway”. It guess the obtained “Identity” code was old one, so I had to manually clear that one.

I guess that should be cleared when one are entering a new Sercurity Code.
