I am running a couple RPi powering infoscreens in a building where everyone and their cat made their own undocumented "improvements" to the network configuration (and I am undertooled, undermotivated and possibly underskilled to solve such problems so working networkside is not an option to me)
The result is that there are many networks, some hidden some not, that are accessed through many access points spread through the building (so each AP runs the same 4 WLANs, 2 hidden, 2 visible, all WPA-PSK protected).
The screens are supposed to run on one of the hidden networks (and they worked till someone chose to "streamline" the network without the competences or skills or even the forethought to take pictures of what he was changing. Yes I hope this will have you guys both cringing and chuckling. It's a normal day in IT, right?).
So, the problem is that often times, while all 4 networks are always accessible through the APs, the network the infoscreens are supposed to run on have no internet access (i.e. they fail a simple
I do not want to run those screens on public network because is a fragile and PITA workaround (and because OF COURSE somebody had to block SSH over it.).
What I would need, is to get the Pi to access each wpa_supplicant.conf in turn, maybe weighted by priority, check if they have a full internet connection, possibly ping one of my (thankfully static-IP and stable) servers to tell me what network they are on so that I can admin them.
I have looked around a lot and was able to find ways to test if there is internet connection (by pinging google's DNS, might change to a wget) and ifdown/ifup wlan0. BUT - all the RPi does so far is to connect again to the network with strongest signal OR with higher priority, which of course are either:
the one they are supposed to connect to via Priority that Heaven knows when will work again, so it'll connect to AP and have no internet.
the one I put first in the file and it will ALWAYS choose that when no priority indication is given, as signal strenght for all networks is the same.
What I would like the RPi to do, is to pick a network among those in wpa_supplicant.conf. try to connect. try to check if internet is up. if not, disconnect and pick a DIFFERENT WiFi among the configured ones. Even when internet OK, check every minute if Internet still OK. If not, cycle network. Repeat till one works or till thermodynamic death of universe.
I was unable to set
wpa_roam in such a way to cycle through them. Maybe there are some options in
wpa_supplicant but so far I couldn't find them. It's strange, as I would consider such features to be a big part of IoT network robustness.
Any help? thanks