Configure multiple WiFi SSID


#1

Hi all,
recently for I project I needed to be able to configure several WiFi SSID/PSK on the same device, with different priorities (so that the device would preferably connect to one network, but fallback to another one if the first is not available). I noticed that nerves_network does not currently seem to support that. The problem is that, when setting a new entry, nerves_wpa_supplicant currently removes all entries and force select of the new one.

I ended up implementing my own solution on top of nerves_network, if there’s interest in porting this feature to the main library I can share my code.


#2

well… do please share - could also make for great blog/medium posts (along with the update thing)…

one thing I wonder is if you do a scan to find available/strongest ssid… say I have 10+ aps in the known list (or even 100 or 1000)… then a scan for strongest/available aps and then matching against the list of known aps, would make a lot of sense…

anyways just a thought for perfection when/if something like this is hopefully added to nerves_network…

the use case is certainly there.


#3

Oh yes that feature would be great. I assume though that it would have to be supported by wpa_supplicant on which NervesNetwork and my code both rely.

Or maybe it’s possible already? I know wpa_supplicant allows users to specify priorities, but I don’t know how the algorithm works, nor if it takes signal strength into consideration.

Anyway, I will soon share at least a gist. A full generic solution outside of my specific use case will take a bit more polish, but if the Nerves maintainers like the idea I can contribute a pull request.


#4

Here’s a gist: https://gist.github.com/lucaong/8dfd088c06cb6b53d1d4f9eb87c778c2

I am on the go now, but when I have more time I can work on a pull request to NervesNetwork and WpaSupplicant if there’s interest in it. I would love to hear opinions and comments from the Nerves maintainers.