I had created an infinity mirror clock a few years back,

esp8266
gplus
(Dushyant Ahuja) #1

I had created an infinity mirror clock a few years back, and recently decided to upgrade it with an ESP8266 - basically to get time from an NTP server and some basic MQTT control.

Unfortunately, I’m running into a small problem. Every time my router is down, or reboots - the clock does not connect again until I physically switch if off and on. Here is the code I’m using:

Any help would be appreciated

(Stefan Salowsky) #2

From a quick look at the code I would think the WiFi doesn’t reconnect automatically. What I saw of the library you used is that when it cannot connect in the set timeout it creates an access point on its own. Check if there is a Wifi network called “InfinityClock” after your router restarts. If thats the case you could try to set the timeout higher. I know my router takes longer to be up again than 180 seconds. You could also try using “connectWifi” instead of “autoConnect”, I think it only tries to connect to the Wifi and won’t set up an AP if it can’t connect.

(Stefan Salowsky) #3

Forget what I said about “connectWifi”, it’s private you won’t be able to use it, but you can still try setting the timeouts higher

(Dushyant Ahuja) #4

@Stefan_Salowsky discussions on the wifimanager library github said that the ESP8266 should try to connect automatically, without needing anything in the loop. I’m stumped.

(Stefan Salowsky) #5

That might be, but it has a timeout after which it just gives up connecting to your wifi and sets up an access point of its own…

(Stefan Salowsky) #6

See here: https://github.com/tzapu/WiFiManager/blob/740005b21e5f5e5c6092dbd4d3037e4edee19113/WiFiManager.cpp#L173
the comment tells us what the library is doing. As I wrote earlier, just check for the Wifi net “InfinityClock”, if it is there it’s the timeout

(Dushyant Ahuja) #7

@Stefan_Salowsky InfinityClock is coming up, but goes off after 180 seconds and the system tries to reconnect again. Looks like there was a bug in the old version of ESP8266 arduino core (2.4.0) that I was working with. Have updated the ESP8266 arduino core to the latest. Will report back if that helps. Thanks.

(Stefan Salowsky) #8

Sounds good. I’ll wait for the results :blush: