Feature request: Configurable restart interval

It would be great if the restart interval (IoTaWatt/WiFi.cpp at 3598eeba7972687bda2e11aabdf75f41683f2bd2 · boblemaire/IoTaWatt · GitHub) could be configured. This doesn’t have to be an option in the web interface, but e.g. just an extra entry in the config.txt file. I would like to set this interval to about 12 hours, because some installations don’t have a wifi available at night. Basically the restart is not a problem, only the gaps of some minutes due to the access point mode every hour without wifi and the many extra log entries.

I appreciate the problem, but this solution tempts the laws of unintended consequences. The one hour WiFi reset is a watchdog timer that was inserted to compensate for some unpredictable behavior in the lower level WiFi and tcp code. There are cases where the device just doesn’t recover from a disconnect/reconnect sequence. I realize that you want to only want to change that reset time selectively, but the next issue will be how come after the wifi was disconnected for eight hours it doesn’t recover when the WiFi comes back on? My answer is “I don’t know, but I do reboot the whole shebang after an hour of radio silence”. To which there will be another request for some remedy to the problem of extended timeout. And then we’re playing whackamole.

So lets look at the real problem, which is that the WiFi-Manager blocks while it is in AP mode after startup, and that is ocuring every hour. Long term, the solution is to lose the WiFi Manager and do AP configuration asynchronously. Realistically, that’s a long ways off.

So maybe the plan should be to not invoke WiFi-Manager to reconnect after a non-power fail restart. The only reason it’s needed there is to provide a window to change WiFi networks. I don’t have a problem with requiring a power cycle to do that, and in fact that extra physical interaction would enhance WiFi security.

I think it’s relatively easy to just let it reconnect after a programmed restart (or exception, or wdt) rather than use the WiFi Manager. I’ll try that out and if it works as I expect, I’ll put that in. So you would still get the hourly restarts, but sampling should not be significantly interrupted.

1 Like