ESP32 Wi-Fi: joining the strongest access point on a mesh

Measured on a real ESP32, 24 Oct 2026, three access points all on channel 2.

The radio joined the weakest node, about -79 to -84 dBm, instead of the nearest, about -16 dBm. MQTT over WSS then failed with -0x7280 (MBEDTLS_ERR_SSL_CONN_EOF). Connecting took about 130 seconds.

With a full-channel scan sorted by signal, the same board joined the node at -15 to -17 dBm. Wi-Fi was up in 6.4 seconds. MQTT was up in 12.0 seconds. A shared attribute was received and applied 12.5 seconds after a hardware reset.

What the SDK does

The next AutoconnectoSDK release after 1.7.73 sets config.wifiJoinStrongest to true by default. That scans every channel and joins the strongest access point. Set it false to keep the first match. The connect attempt stops after wifiConnectTimeoutMs (default 15 seconds). A failed MQTT connect tries the other of WSS and MQTTS, then waits with a bounded backoff. Library Manager 1.7.73 does not include this yet.

When serial logs are on, the SDK prints one line: [WIFI] joined bssid=… ch=N rssi=-N. It does not print the Wi-Fi password or the device token.enableSerialLogs = false prints nothing, including MQTT traffic.

Examples

ESP32 MQTT · ESP32 quick start · This note on the docs site