Smart Wi-Fi Manager keeps a Linux computer connected to the best saved Wi-Fi
network. It uses NetworkManager (nmcli) and includes an optional web
dashboard.
It is designed for Raspberry Pi, Ubuntu, drones, robots, and other Linux computers that may move between known networks.
You need Linux with NetworkManager, Python 3, curl, and systemd.
git clone https://github.com/alireza787b/smart-wifi-manager.git
cd smart-wifi-manager
sudo ./install.shThe installer adds the short swm command and starts the Wi-Fi manager. The
dashboard is installed at http://127.0.0.1:9080, where only this computer can
reach it.
See all commands or get help for one command:
swm help
swm help wifi
swm help wifi add
swm help dashboardsudo swm wifi add "YOUR_WIFI_NAME"Type the Wi-Fi password when asked. The password is hidden while you type.
Check the saved networks:
sudo swm wifi listAdd a network without a password:
sudo swm wifi add "OPEN_WIFI_NAME" --openUse either the profile ID or Wi-Fi name in these commands:
# Change a password (the new password is requested safely)
sudo swm wifi password "YOUR_WIFI_NAME"
# Change the Wi-Fi name or priority
sudo swm wifi edit "YOUR_WIFI_NAME" --ssid "NEW_NAME"
sudo swm wifi edit "YOUR_WIFI_NAME" --priority 120
# Temporarily stop or resume using a network
sudo swm wifi disable "YOUR_WIFI_NAME"
sudo swm wifi enable "YOUR_WIFI_NAME"
# Remove a saved network
sudo swm wifi remove "YOUR_WIFI_NAME"Higher priority numbers are preferred. The default priority is 100.
For scripts, read a password from standard input so it does not appear in the process list:
printf '%s' "$WIFI_PASSWORD" | sudo swm wifi add "YOUR_WIFI_NAME" --password-stdinOpen the real JSON config in your terminal editor:
sudo swm config editThe command checks the JSON before saving it. Other useful commands are:
sudo swm config check
sudo swm config showconfig show hides passwords. The config file is
/etc/smart-wifi-manager/config.json.
Check its current state:
sudo swm dashboard statusAllow access from your LAN or VPN:
sudo swm dashboard exposedashboard expose listens on port 9080. The first time it is exposed, it
creates a browser username and password and prints the password once. Save it.
Undo exposure and return to local-only access:
sudo swm dashboard hideReset the browser password:
sudo swm dashboard password --user adminThe password is hidden while you type. Stop the dashboard completely with:
sudo swm dashboard offThe Wi-Fi manager keeps running when the dashboard is hidden or stopped.
unexpose is an alias for hide, and reset-password is an alias for
password.
The dashboard is not meant to be placed directly on the public internet. Use a trusted LAN or VPN and a firewall.
API tokens are for scripts or fleet tools. You do not need one to use the dashboard in a browser.
sudo swm dashboard token create # create and print once
sudo swm dashboard token status # check whether one exists
sudo swm dashboard token rotate # replace and print once
sudo swm dashboard token remove # delete itSave a created token immediately; the manager will not display it again.
Only one API token is active at a time; rotate replaces the old token.
Example API request:
read -rsp "API token: " SWM_API_TOKEN; echo
curl -H "Authorization: Bearer $SWM_API_TOKEN" \
http://DEVICE_IP:9080/api/v1/profiles/summary
unset SWM_API_TOKENsudo systemctl status smart-wifi-manager
sudo journalctl -u smart-wifi-manager -n 50
cat /run/smart-wifi-manager/status.jsonManager modes:
manage: scan and connect automatically.observe: scan and report without switching.disabled: pause Wi-Fi management.
Change the mode in the dashboard under Advanced settings, or edit the raw config.
Fleet bundle operations are documented in the CLI reference. They remain
available under swm profile but are not needed for normal single-computer use.
python3 -m pytest tests -q
bash -n install.sh configure_smart_wifi_manager.sh smart-wifi-manager.sh
(cd dashboard && go test ./...)Apache-2.0 license. See LICENSE.