mirror of
https://github.com/esphome/esphome.git
synced 2025-07-30 15:16:37 +00:00
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:
parent
56c88807ee
commit
daccaf36a7
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user