Thinger client doesn't re-connect after public ip change on the router

Hi, that’s one of the things I’m currently facing with Thinger. I thought its time to report it - also someone might be able to give me an advice.

I’m running Thinger client on both ESP8266 and Linux computer. Yes I compiled the code for Ubuntu 14.04 x64. Anyway, my public IP changes once every week or every time I reboot the router. When that happens, I loose both devices (ESP8266 and PC) from the connected devices and I can not control both any more. Even if I wait for 1 week.

Before using ubuntu, I thought its something with the ESP8266 so I added the following code but later I realized its not WL_CONNECTED issue.

  if(WiFi.status() != WL_CONNECTED) {
        while (WiFi.status() != WL_CONNECTED) {
          delay(5000);
          thing.add_wifi(SSID, SSID_PASSWORD);
        }
    }

The code above was added to the void loop() with the hope that it would attempt to reconnect if wireless is not connected.

If I restart the ESP8266 everything goes back to normal. Same if I re-run the code on Ubuntu.

Any thoughts?

Hi @yahya_khaled I think this won’t change anything, as this is currently handled inside the thing.handle() method. Checkout the following code, and you will see how this is checked constantly:

I recommend you to enable the debug, to try to verify what is happening when you reboot your router. Please, copy the DEBUG Output here to check what is happening in the reboot process.
http://docs.thinger.io/arduino/#coding-enabling-debug-output

I have no such issues while using WiFi, and both my NodeMCUs and Linux devices are able to keep connected for months easily (even when my router lost the internet connection or it receives a new dynamic ip). What is your router model?

Bests.

Hi @yahya_khaled! I have been testing and working with some specific conditions to try to reproduce the issue, and seems that I have found something. I just released a new library (2.4.3), that should be available in the following hours as a regular Arduino library update.

Hope this update fix all the connectivity problems!

I will try tonight. I typically use Arduino compiler - so I will check if I can update the library. I guess you meant to say Arduino rather Android?

Yes! you are right! I mean Arduino :slight_smile:

I just updated the library and re-flashed the ESP8266. I will test it for while and we see how we go.

Great! Let me know if it improved something.

Bests.

I have another piece of the puzzle that might help you. Another device I have is running on the older C library; device status is “Conencted” under “/#/console/devices” but its “not connected” under “#/console/device/my_device”. Also if I click the “View API” I can see the following error in console “api.thinger.io/v2/users/my_user/devices/my_device/api:1 GET https://api.thinger.io/v2/users/my_user/devices/my_device/api 404 (Not Found)”

BTW; I replaced the original info by my_device and my_user

Somehow the device is online but not online. In reality the device is still online in my PC. I only experience this after the router reboots or public IP lease renew. I hope this wont be the case with the new release of the library.

This issue should be improved in the latest arduino library.

Hi Alvarolb; you are a genius!! For me that is a major bug fix . It did resolve the issue. I just checked - public IP has changed and the device is still working. I never had this working before.

Thank you for updating the libraries.

1 Like

Great! Really good news! Thanks for testing! :grinning:

Its still running smoothly - very stable for 2 weeks.
One thing though - not sure if related to your library. THE ESP8266 seems to work as client and AP mode at once. There is an AP called ESP_01CCC0. Goes off with power off.

All worked well. Now I moved on to testing the new Linux-client on Ubuntu. I trust it is updated as well. Will post back if I encountered any issues.

Great @yahya_khaled ! And, yes, I have to update the linux client also with some new features. Will take a look also to the issue I found in the Arduino library.