Fix WiFi to prefer strongest AP when multiple APs have same SSID (#9963)

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
Dayowe 2025-07-29 23:10:53 +02:00 committed by GitHub
parent 56c88807ee
commit daccaf36a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -533,9 +533,17 @@ void WiFiComponent::check_scanning_finished() {
return false;
if (a.get_matches() && b.get_matches()) {
// if both match, check priority
// For APs with the same SSID, always prefer stronger signal
// This helps with mesh networks and multiple APs
if (a.get_ssid() == b.get_ssid()) {
return a.get_rssi() > b.get_rssi();
}
// For different SSIDs, check priority first
if (a.get_priority() != b.get_priority())
return a.get_priority() > b.get_priority();
// If priorities are equal, prefer stronger signal
return a.get_rssi() > b.get_rssi();
}
return a.get_rssi() > b.get_rssi();