Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4978

General discussion • How to list WiFi AP:s with same ssid and connect to the strongest

$
0
0
I have a longish home (20x7 meters) and my fiber system enters at the far end where my main router is also located.
Since the WiFi reach is not good to the other end of the house I have used a LAN cable from the main router and connected a WiFi router running as an access point in the first room on that end of the house. Both are ASUS devices.
The AP is set to serve the same SSID as the main router does and the idea was that WiFi devices would select the strongest channel with the wanted SSID when connecting.

But this turns out not to work, some devices connect to the main router even though its signal strength is very low, but still visible.

And now I have an IOT device that fails due to low WiFi signal and reboots and still connects to the same far away router even though the AP close to it has a rock solid strength.
The IOT device is an ESP8266 based module and it sits about 10 m away from the house so its distance to the main router is approx 30-35 m.

So I would like to know how to:

1) From an RPi device command line list all of the WiFi networks on the air with a specific ssid, their strengths and MAC address (or other unique ID)
2) Make a connection script that can check which is strongest and force the WiFi connect to use that network
I hope I can use that info in order to modify the code on the IOT to do the same...

I am not at home now but I have access to the LAN via VPN and can execute commands on the local rpi devices command line via PuTTY all from my summer home.

So I have tried this on an rpizero in the same room as the close access point:

Code:

$ sudo wpa_cli -i wlan0 scanOK$ sudo wpa_cli -i wlan0 scan_results | grep "osse"88:d7:f6:ba:91:78       2447    -34     [WPA2-PSK-CCMP][WPS][ESS]       bossefiber64:20:9f:24:a1:d7       2472    -92     [WPA2-PSK-CCMP][WPS][ESS]       BosseGuest
The result is a bit strange because it only lists the "bossefiber" network once even though it is served both from the AP (88:d7:f6:ba:91:78) and the main router, which also serves the guest network which *is* listed.
Notice the strength of BosseGuest! -92 versus -34 dBm!!!!

So I tried the same commands on an RPi5 sitting 50 cm from the main router in the far end of the house:

Code:

$ sudo wpa_cli -i wlan0 scan$ sudo wpa_cli -i wlan0 scan_results | grep "osse"c8:7f:54:4d:be:28       2417    -26     [WPA2-PSK-CCMP][WPS][ESS]       bossefiber64:20:9f:24:a1:d7       2472    -41     [WPA2-PSK-CCMP][WPS][ESS]       BosseGuest
(Results from the 5G band manually removed.)

Now the list contains stuff which does not include the far end access point but the closest/strongest versions...

So my question is really if it is possible to:
- List more than one instance of the same ssid (differing by MAC)
- Only list the 2.4 GHz band networks

This is all done in order to get a grip on the real problem that is how I can stop the IOT device from connecting to the far away main router and instead use the close AP. For instance forcing it to use the MAC address when connecting....

The main router signal strength at the IOT device is -96 dBm whereas the AP signal strength is about -70 dBm so one would think it should use that but it does not...

The IOT and a number of RpiZero devices comprise a monitoring system for my home....

TIA

Statistics: Posted by Bosse_B — Fri Jul 19, 2024 8:32 am



Viewing all articles
Browse latest Browse all 4978

Trending Articles