Tradfri 1.8.25 - offline - communication_error

Still not working for me.
Reports the current state, but won’t allow me to change it. I can see my lights are on, but I can’t turn them off!

Update
After a few minutes, it started working, but with a delay.
However, if I reboot again, I have to go through the whole process of removing the gw commenting out my things, re add the gw etc.
Let’s hope I don’t have to reboot again for a while!

@lipp_markus this may not be correct…

I added mine through paper ui then 48hrs moved to files based on the json things file.

My gateway info never changed… curious what identity changes?

@Thedannymullen curious…I have performed the following operation three or four times

  • delete bridge def from text file, restart OH2
  • discover and add bridge through PaperUI;
  • copy out Identity code and delete thing in PaperUI (mostly using the delete function in PaperUI, but once I simply deleted the whole jsonDB and its backups to see if that makes a difference)
  • add newly received identity code in text file for bridge definition
  • OH2 tries to add bridge Thing as now defined in text file, but status is stuck somewhere around “uninitialized”

In every single iteration of the above, I received a different value for the token identity…

I had similar issues before when the power went down, there is an extra thread for this. My workaround there was to change the gateway ip in habmin to something wrong, then back again to the correct value. This helped here, too.

As far as I understood, that is expected behavior and a coap security feature.
See the second link in my post: Restart Tradfri Gateway from rule or Binding

1 Like

@lipp_markus

Here what your new things file should look like, I struggles a little also and realized you have to remove the code parameter and change to identity.

Bridge tradfri:gateway:gwa234fd176b [ host="192.168.1.50", 
// not needed anymore --> code="2YKQdgHqyTPletUL", 
identity="3bccc7c7ced",
 preSharedKey="Rltuc7o" ]  
{
// things here
}

All parameters in this file are from the json things db.

1 Like

For those, like me, looking for the jsondb location:

It solved the issue for me… temporarily. The work around is good for restoring the connection, but awful for new users.

@Thedannymullen thanks much
This is looks exactly like what I have (except, my values for the preSharedKey and identity and are much longer) and I believe was posted earlier by @Johan_S in post#20 in step8 unless I am missing something. Still for me the effects as I described above remain.

@lipp_markus changed a few numbers out just for security sake. Sorry I thought I made correct length.

A git issue for this has been created: https://github.com/openhab/openhab2-addons/issues/5489.

No worries, just thought I’d mention in case there are different versions out there. I had added this observation already to the github issue.

1 Like

I got it working with following steps:

  • Install pytradfri from here
  • Connect to to the gateway with python3 -i -m pytradfri IP
  • Enter Security Code of the gateway

You can now find the generated Identity in the first lines. It looks like
DEBUG:pytradfri.api.libcoap_api:Executing $GATEWAY_IP post ['15011', '9063']: {'9090': 'xxx-your-identity'}

The new pre shared key is a line after and looks like
DEBUG:pytradfri.api.libcoap_api:Received: {"9091":"xxx-your-preshared-key","9029":"1.8.0025"}

With that info you can now connect to the gateway again via the Paper UI in Openhab Things.

  • Add a new Tradfri Gateway
  • Enter Security Code
  • Click on ‘Show More’
  • Enter Identity and PSK
  • Save

When the gateway is back online again go to all relating things, click edit and update the selected gateway there.

2 Likes

I did what you did, but this morning the gateway was offline again.
I have never used config files, just paperUI.
Unsure of what to try next …

@OMR if you use paper ui you can keep using it. In fact you should not have an issue.

I would suggest going back to paper ui. Configure normally by adding the code from the back of gateway. All should just work.

This thread was for an issue when people use config files.

That was what I thought too, so thank you for clarifying.
But I wonder why I get

Gateway was offline when I got home from my Easter vacation. I got it Online several times, but it did not stick. I wonder if it could be related to the Gateway trying to update my 10+ 5 button remotes. Noticed now that several has run out of battery because of the update …
So at the moment, no manual backup either. Must go shopping for CR2032s.
If it keeps bugging me, I have both a HUE and Conbee gateway I can move the lights to.

Yes it’s possible the updates are causing an issue.
If you have not done so, ping gateway ip from a computer make sure it responds then.
I would try deleting the gateway thing from openhab.
Shutdown openhab
Cycle power on gateway
Clear cache
Start openhab.
Add gateway in paper ui

In all the changes I did not clear cache once and had an error. May or may not have been related but a cache clear then start fixed if.

Thanks for pitching in.
I have done som more testing, and it looks like the Ikea Gateway partially hangs.
I can always ping it.
After I manage to get it Online after numerous bundle:restart in karaf, it only stays online for a couple of minutes, 30min max.
Strange thing is that when it goes Offline, I’m not even able to connect with the Ikea Android App.
After power cycling the gateway, it comes Online again for a while.
I have 9 remotes with status Update pending …
Strange behaviour.
Think I will try stopping the bundle while the gateway is Updating the remotes.

I had some trouble with the app when my remote was updating also. I suspect the waiting updates are the issue. Keep us posted!

Maybe I am missing something but I too am having issues with the Tradfri binding after the update. I have followed the suggestions in this thread and done the following:

  1. comment out Things file entries for Tradfri
  2. add gateway via inbox of PaperUI
  3. entered the code from gateway into Thing configuration
  4. restarted services
  5. expanded show more to retreive the identity and pre-shared key
    This is where things get messy. The pre-shared key is just **********.

Where can I get the actual key?

I have tried with just “” for key but it still isn’t working.

Thank you,
Jason…

Hi Jason,
you may get pre-shared key via rest interface:

http://<Your_IP>:8080/rest/things/tradfri:gateway:gwb07xxxxxxxxx

Use your IP/hostname with standard port 8080 and with your Tradfri gateway UID (taken from PaperUI).

Actually, I simply copied and pasted the ******** from the pre-shared key field in PaperUI into my Things file; it “magically” transformed from the series of dots into the plain ASCII sequence (which in my case is the code from the gateway anyway)