tbnobody / OpenDTU

Software for ESP32 to talk to Hoymiles/TSUN/Solenso Inverters
GNU General Public License v2.0
1.82k stars 511 forks source link

ESP32 does not reconnect to Wifi #2400

Open LPG-PG opened 2 weeks ago

LPG-PG commented 2 weeks ago

What happened?

After an indefinite period of time, the ESP32 module loses the connection to the WiFi. No new DHCP lease is obtained, so neither web, API, MQTT nor ping works.

To Reproduce Bug

It happens ramdomly between 1 and 5 days

Expected Behavior

OpenDTU has to be reboot to fix it temporary

Install Method

Pre-Compiled binary from GitHub releases

What git-hash/version of OpenDTU?

v24.10.15

What firmware variant (PIO Environment) are you using?

generic_esp32

Relevant log/trace output

No response

Anything else?

I checked some parts of the code and I'm not sure, if there is a bug in NetworkSettings.cpp -> NetworkSettingsClass::applyConfig() line 288ff

WiFi.begin(
            Configuration.get().WiFi.Ssid,
            Configuration.get().WiFi.Password,
            WIFI_ALL_CHANNEL_SCAN);

I mean, that Wifi.begin is called with Channel 1 because the enum WIFI_ALL_CHANNEL_SCAN value is 1.

The declaration of the called function is:

wl_status_t begin(char* ssid, char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true);

So the third paramter is the channel, which is in this case 1.

Please confirm the following