How to automatically reset if WIFI is lost or poor

Hello,

I’m trying to integrate an ESP8266 into my mower.
I’m using a wifi2serial code to send & receive commands.

But I noticed that when the WIFI signal is lost for a long time (at night for example) the module simply doesn’t reconnect anymore (for short interruptions it is ok).

WiFi.config(ESP8266_ip, gateway_ip, subnet_mask);

WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.print("\nConnecting to "); Serial.println(ssid);
uint8_t i = 0;
while (WiFi.status() != WL_CONNECTED && i++ < 20) delay(100);
if(i == 21){
Serial.print(“Could not connect to”); Serial.println(ssid);
while(1) delay(500);
}

I know it is not the best approach but I would like to integrate an hourly reset of the ESP.

Would any of you have a simple way to achieve this ?

Tx !