I bought myself an ESP32 to see how the code works compared to an ESP8266. Didn't manage to get it into my network until I found that there is one wrong line in the Wifi setup of the code. After removing this line the ESP successfully connects to the Wifi.
In my case, I've observed that it works also when maintaining the line you suggest to delete. I will however add a comment to the code, to signal that this might solve some issues. Thanks for the contribution
I bought myself an ESP32 to see how the code works compared to an ESP8266. Didn't manage to get it into my network until I found that there is one wrong line in the Wifi setup of the code. After removing this line the ESP successfully connects to the Wifi.