Use BerryLan to setup Raspberry Pi Zero W to permanently stay in AP mode

When testing out berrylan and I setup my Raspberry Pi Zero W in AP mode, I found that when I rebooted, the Raspberry Pi did not restart AP mode but instead reconnected to the last wifi device. I was wondering if there was a way to change this functionality so that even with saved wifi connections, the pi will boot in AP mode.
I’m using a physical button on the GPIO pins to restart the service to allow a user to make changes to the settings. (Discussed in this post What happens when a user changes their SSID password down the road? - #9 by simon.stuerz).
As the Pi Zero W can’t scan for wifi networks while in access point mode, it would also be ideal for the pi to shutdown the access point when the button is pressed.
So to clarify, the two things I’m looking to know if it’s possible:
Keeping Pi in AP mode even after reboot
Shutting down AP when physical button is pressed when spinning up NetworkManager service.
My thanks and appreciation to any suggestions on this task.

Hi @MyersN13,
I guess you want to check out and especially
to configure your wanted behaviour.

Also I would suggest to play around with nmcli to set init-values of desired network interfaces. Since this is Ubuntu’s standard network manager you will find plenty of resources in the web. You might use a script, that is triggered with nymea gpio (magic).

Hmm… I have noticed this too though… While the client mode reconnects fine after rebooting, the AP mode doesn’t seem to come back up again. While nmcli sure should work, the idea of BerryLan would be not to require nmcli :slight_smile:

Found this in the code… certainly a bug. Will fix.

Pull request up:

Next experimental build (and next stable release) should have this fixed, although I still need to do some deeper testing with it. Perhaps it still does the wrong thing if the user configures multiple connections (e.g. by re-entering setup with the pushbutton).

1 Like

After testing on a Raspberry Pi Zero W:
If multiple connections are set in /etc/NetworkManager/system-connections/, any wifi network that it has stored and is available it always seems to pick first regardless of if autoconnect is set to TRUE on any AP setup. Removing all other connections from the folder, leaving only the AP with autoconnect set to TRUE, the pi does indeed autostart the hotspot.
As BerryLan is typically for a headless setup, is there a need to store previous Wifi and AP connections? Would it make sense for this folder to be cleared when a new connection is made (or when the button is pressed)?

In this testing I additionally confirmed the second part of my original post. Restarting the service with the button after the pi has rebooted into AP mode prevents BerryLan from being able search for wifi. (It only lists the name of the currently configured AP). Definitely seems to need the hotspot to stop before restarting nymea-networkmanager. I was thinking I could achieve this with a seperate script watching the same GPIO pin on its own but realized timing between the script executions with nymea could be an issue.
Curious to know your thoughts.