Configure Wifi via hotspot

I have a NanoPi Neo Air with DietPi installed that I occasionally move around to different sites, and I don’t necessarily know the wifi credentials at that site ahead of time.

It would be extremely useful if I were able to set up the board such that if it is unable to connect to a wifi network, it instead hosts an access point that I can connect to to enter credentials manually.

Unfortunately, I can’t even install the “Wifi Hotspot” package to get started with experimenting on this, as the board does not have ethernet.

Has anyone done something like this before?

I think you can preconfigure the wifi by editing the /boot/dietpi.txt before you install it in the board.
I would normally suggest the travelmate package of OpenWrt, which is tailor made for such scenarios, but I don’t see your device in the supported list.

I’m aware I can preconfigure the wifi. The issue is that I need to bring these devices, already flashed, to somewhere where I may not know the wifi credentials until I am on-site. The device is intended to remain at the site permanently, so it does need to have the local credentials itself, rather than connecting to some other hotspot I bring with me.

Currently the only way to configure the wifi in such a scenario is:

  1. start up some other hotspot that the device is preconfigured for
  2. wait for device to connect, then use that hotspot to ssh in
  3. update the credentials to the new network

Or alternately using a uart adapter to replace 1 & 2. Both of these are a pain.

I’m looking for a piece of software which would check if any pre-configured wifi networks are in range. If so, connect. If not, start a hotspot with no password, that if connected to, displays a webpage that shows all the networks it can see, and allows someone to enter the password for that network.

ESPHome has this existing and easily usable for any ESP32, but as far as I can tell there is no linux equivalent.

At least we don’t have such functionality available on our tooling. You would need to use 3rd party software or develop something yourself.

That makes sense to me. I haven’t been able to find anything that does this OOTB, so I’ll probably develop my own.

Where would I look for documentation on how dietpi stores wifi credentials and such? My naive approach would be to develop something that would directly write to/read from /etc/wpa_supplicant/wpa_supplicant.conf but based on the log messages shown when I configure a network using dietpi-config, I gather there is a database of some sort somewhere that is parsed to programmatically generate wpa_supplicant.conf? I would need to edit this database in order to preserve the changes entered by the user.

wpa_supplicant database file should be located at /var/lib/dietpi/dietpi-wifi.db

1 Like

Hi, did you manage to create or find a service? I am looking for the same solution…