-->
Page 1 of 1

Which services to be restarted after temp. loss of WiFi

PostPosted: Wed Jul 24, 2019 1:37 pm
by Ladi
Hi there,

I hope someone can answer my question.

I'm running my smarthome system with ESP8266 since more than a year now but suffer from time to time from connection problems. After a loss of WiFi (e.g. update of router with new firmware) the ESP8266s are not all reconnecting to MQTT and even WiFi. I'm not sure if this is because some services need to be restarted. And this is now exactly my question to which I couldn't find any answer yet for a long time. All code examples assume a fresh start (reboot) of ESP8266 and then all required services are initialized after WiFi is available.

The trivial answer would be "just reboot, when you lost WiFi" and then this standard procedure applies. But I can't do this, since most of the ESPs also check for manual operation (roller shutters up and down, lights on and off, ...). So I need to continue running the ESP and wait until WiFi comes back.

These services are required and initialized in the setup() loop:
ArduinoOTA,
webServer (ESP8266WebServer),
MDNS (ESP8266mDNS),
NTPclientLib,
MQTT (pubsubclient)

Do I need to restart (xxx.begin() ) these again, after WiFi is reconnected or will they remain active?

MQTT is clear, I think NTP as well (at least I found I have to reactivate).

Would be great if someone here could drop me a few words, so I can narrow down my problem of non-connecting ESP8266s.

Thanks in advance