jomjol / AI-on-the-edge-device

Easy to use device for connecting "old" measuring units (water, power, gas, ...) to the digital world
https://jomjol.github.io/AI-on-the-edge-device-docs/
5.26k stars 580 forks source link

add a Delay between the WiFi reconnections #3068

Open hex7c0 opened 1 month ago

hex7c0 commented 1 month ago

to slow down WiFi reconnections during issues like, as an example:

[1d00h31m14s] 2024-05-08T09:27:49 <ERR> [WIFI] Disconnected, multiple reconnect attempts failed (201), still retrying...
[1d00h31m20s] 2024-05-08T09:27:55 <ERR> [MQTT IF] Other event id:
[1d00h31m38s] 2024-05-08T09:28:13 <ERR> [WIFI] Disconnected, multiple reconnect attempts failed (201), still retrying...
[1d00h31m42s] 2024-05-08T09:28:17 <ERR> [MQTT IF] Other event id:
[1d00h31m42s] 2024-05-08T09:28:17 <ERR> [MQTT IF] Disconnected, multiple reconnect attempts failed, still retrying...
[1d00h31m57s] 2024-05-08T09:28:32 <ERR> [MQTT IF] Other event id:
[1d00h32m02s] 2024-05-08T09:28:37 <ERR> [WIFI] Disconnected, multiple reconnect attempts failed (201), still retrying...
[1d00h32m20s] 2024-05-08T09:28:55 <ERR> [MQTT IF] Other event id:
[1d00h32m26s] 2024-05-08T09:29:01 <ERR> [WIFI] Disconnected, multiple reconnect attempts failed (201), still retrying...
[1d00h32m42s] 2024-05-08T09:29:17 <ERR> [MQTT IF] Other event id:
[1d00h32m51s] 2024-05-08T09:29:26 <ERR> [WIFI] Disconnected, multiple reconnect attempts failed (201), still retrying...
[1d00h32m57s] 2024-05-08T09:29:32 <ERR> [MQTT IF] Other event id:
[1d00h33m17s] 2024-05-08T09:29:52 <ERR> [WIFI] Disconnected, multiple reconnect attempts failed (201), still retrying...
[1d00h33m20s] 2024-05-08T09:29:55 <ERR> [MQTT IF] Other event id:
[1d00h33m20s] 2024-05-08T09:29:55 <ERR> [MQTT IF] Disconnected, multiple reconnect attempts failed, still retrying...
[1d00h33m35s] 2024-05-08T09:30:10 <ERR> [MQTT IF] Other event id:
[1d00h33m41s] 2024-05-08T09:30:16 <ERR> [WIFI] Disconnected, multiple reconnect attempts failed (201), still retrying...
[1d00h33m57s] 2024-05-08T09:30:32 <ERR> [MQTT IF] Other event id:
[1d00h34m05s] 2024-05-08T09:30:40 <ERR> [WIFI] Disconnected, multiple reconnect attempts failed (201), still retrying...
[1d00h34m20s] 2024-05-08T09:30:55 <ERR> [MQTT IF] Other event id:
[1d00h34m29s] 2024-05-08T09:31:04 <ERR> [WIFI] Disconnected, multiple reconnect attempts failed (201), still retrying...
[1d00h34m42s] 2024-05-08T09:31:17 <ERR> [MQTT IF] Other event id:
[1d00h34m55s] 2024-05-08T09:31:30 <ERR> [WIFI] Disconnected, multiple reconnect attempts failed (201), still retrying...
[1d00h35m05s] 2024-05-08T09:31:40 <ERR> [MQTT IF] Other event id:
[1d00h35m05s] 2024-05-08T09:31:40 <ERR> [MQTT IF] Disconnected, multiple reconnect attempts failed, still retrying...
[1d00h35m19s] 2024-05-08T09:31:54 <ERR> [WIFI] Disconnected, multiple reconnect attempts failed (201), still retrying...

Let me know, what you think :)

caco3 commented 1 month ago

It would be better to move the delay to after the log message and note the delay in the log message (eg. retrying after 5s...)

hex7c0 commented 1 week ago

Good point! added

Let me know if you prefer to split the log before and after the delay

Thanks