Wifi network config inside container with fallback to hotspot?

Hi there, I was wondering if it’s possible to configure the list of wifi networks networkmanager will connect to from within the container, and whether it’s possible to have it fall back to creating a hotspot if it can’t connect to any of the networks in its’ list?

My use case is that I want to have my device create a hotspot on boot if it’s out of range of a known wifi network (over which its’ web UI will be accessible, advertised using avahi/multicast DNS) or to join a known network if one is available. The web UI has a wifi configuration page to allow you to add networks, and a button that causes the device to rescan/join a known network if it’s in range. I’ve looked at the resin-wifi-connect project briefly, but I don’t want to have a captive portal type flow (since the devices will frequently be used out of wifi coverage, setting up their own networks, and connecting to each other).

Another key point here is that I don’t want them to change configuration once they’ve joined a network unless they lose their connection, i.e. once they are in hotspot or client mode they stay that way until either the client loses their wifi connection (in which case they should create a hotspot) or they are manually reconfigured via the UI.

Is this vaguely possible? I’d appreciate a pointer to how to configure the list of wifi networks from within the container also :slight_smile: thanks!

For configuring the list of networks from within the container you may check our
Changing the Network at Runtime section in the networking docs which has a similar example.

All in all what you target should be all possible, but also quite some work :wink: