CLI for UniFi Network controller
Project description
unifi-cli
CLI for UniFi Network controller with an interactive TUI dashboard. Designed for both human operators and AI agents.
Quick start
# Install (pick one)
cargo install unifi-cli # From source
uvx unifi-cli --help # Run without installing (via uv)
pip install unifi-cli # Via pip
# Configure
unifi config init # Interactive setup (prompts for host + API key)
# Use
unifi clients list # List connected clients
unifi devices list # List network devices
unifi tui # Interactive dashboard
Generate an API key in your UniFi controller under Settings > API.
Installation
From crates.io
cargo install unifi-cli
From PyPI
pip install unifi-cli
# or run without installing:
uvx unifi-cli clients list
From GitHub releases
Pre-built binaries for Linux (x64, arm64), macOS (x64, arm64), and Windows (x64) on the releases page.
Configuration
Run unifi config init for interactive setup, or configure manually:
Environment variables
export UNIFI_HOST=https://unifi.example.com
export UNIFI_API_KEY=YOUR_KEY
Config file
~/.config/unifi/config.toml:
host = "https://unifi.example.com"
api_key = "YOUR_KEY"
Multi-controller profiles
[profiles.home]
host = "https://home.example.com"
api_key = "KEY_1"
[profiles.office]
host = "https://office.example.com"
api_key = "KEY_2"
unifi --profile office clients list
# or: UNIFI_PROFILE=office unifi clients list
CLI flags
unifi --host https://unifi.example.com --api-key YOUR_KEY clients list
Priority: CLI flags > environment variables > config file.
TUI dashboard
unifi tui # Launch interactive dashboard
Real-time dashboard with:
- Client list with bandwidth, connection info, and signal strength
- Device overview with status and firmware versions
- Event feed from the controller
- Client actions: kick, block/unblock, lock/unlock AP
- Device actions: restart, upgrade firmware, locate LED
- Filter clients by name with
/
Live port monitor
unifi devices ports aa:bb:cc:dd:ee:ff --live # Real-time port stats
Commands
Clients
unifi clients list # List connected clients
unifi clients list --wired # Wired clients only
unifi clients list --wireless --name tasmota # Filter by type and name
unifi clients list --watch # Auto-refresh
unifi clients show aa:bb:cc:dd:ee:ff # Show client details
unifi clients top # Top clients by bandwidth
unifi clients block aa:bb:cc:dd:ee:ff # Block a client
unifi clients unblock aa:bb:cc:dd:ee:ff # Unblock a client
unifi clients kick aa:bb:cc:dd:ee:ff # Disconnect a client
unifi clients set-fixed-ip MAC IP [--name] # Set DHCP reservation
Devices
unifi devices list # List network devices
unifi devices list --watch # Auto-refresh
unifi devices show aa:bb:cc:dd:ee:ff # Show device details
unifi devices ports aa:bb:cc:dd:ee:ff # Show switch/router ports
unifi devices restart aa:bb:cc:dd:ee:ff # Restart a device
unifi devices upgrade aa:bb:cc:dd:ee:ff # Upgrade firmware
unifi devices locate aa:bb:cc:dd:ee:ff # Blink locate LED
unifi devices locate aa:bb:cc:dd:ee:ff --off # Stop blinking
Events
unifi events list # Recent controller events
unifi events list --limit 50 # Last 50 events
Networks
unifi networks # List all networks
System
unifi system health # Show subsystem health
unifi system info # Show controller info
Configuration
unifi config init # Interactive setup
unifi config check # Verify connectivity and API key
Shell completions
unifi completions zsh --install # Install zsh completions
unifi completions bash --install # Install bash completions
unifi completions fish --install # Install fish completions
Agent-friendly design
unifi-cli is designed to work well with AI agents and automation scripts.
Automatic JSON output
When stdout is not a terminal (piped or redirected), output switches to JSON automatically:
# Human at terminal: formatted table
unifi clients list
# Agent piping output: JSON automatically
data=$(unifi clients list)
# Force JSON mode
unifi --json clients list
Clean stdout/stderr separation
Data goes to stdout. Messages go to stderr. Piping always captures clean data:
unifi clients list > clients.json # stdout: JSON, stderr: "66 clients"
unifi --quiet clients list # Suppress stderr messages
Structured mutation responses
unifi --json clients block aa:bb:cc:dd:ee:ff
# {"action": "block", "mac": "AA:BB:CC:DD:EE:FF", "status": "ok"}
Runtime schema introspection
unifi schema # Dumps all commands, arguments, output fields as JSON
Distinct exit codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Configuration error |
| 3 | Authentication error (401/403) |
| 4 | Not found (404) |
| 5 | API error (server error) |
Development
make check # Lint and test
make test # Run tests
make install # Build and install
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unifi_cli-0.1.6.tar.gz.
File metadata
- Download URL: unifi_cli-0.1.6.tar.gz
- Upload date:
- Size: 76.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27f0ee2cd4fa8abe9bfe2c061e54728e37f18ec02804f80cff25dd49e6192906
|
|
| MD5 |
9581787a44ee3923ce3d651c164bf7aa
|
|
| BLAKE2b-256 |
1869942371cb44afe980550dcf29ef6dca1d01f2bc2c0d0bccc565ff1f75f849
|
File details
Details for the file unifi_cli-0.1.6-py3-none-win_amd64.whl.
File metadata
- Download URL: unifi_cli-0.1.6-py3-none-win_amd64.whl
- Upload date:
- Size: 5.7 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03cc49afc31f5822e47758782836b672f57bdf7e206e152df5f429587ba9ca1d
|
|
| MD5 |
4c68158f090cb51299c1ca8122f9007f
|
|
| BLAKE2b-256 |
4b8321ce9752505210c9264f8d5a1a73e5aa76894912764cd0791ad66fdfda11
|
File details
Details for the file unifi_cli-0.1.6-py3-none-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: unifi_cli-0.1.6-py3-none-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 5.9 MB
- Tags: Python 3, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cafe29e2e0ae65bcda2669a50974010e69f92a4f7b96a3c3d161328b25a6526d
|
|
| MD5 |
0a607fdd7621cca972c8e3c7877d2fec
|
|
| BLAKE2b-256 |
206bf25682d3776b7f1943ec072e5a6137320acd0b871faad1db46a1155055a5
|
File details
Details for the file unifi_cli-0.1.6-py3-none-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: unifi_cli-0.1.6-py3-none-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 5.5 MB
- Tags: Python 3, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e874022673ecc804af1a7158483a9fae6b5d03bd3d7392642a6c04fd47c2112
|
|
| MD5 |
d198385bd1886b5c3dd50c30df85e12b
|
|
| BLAKE2b-256 |
4ea11a2785de978ede042c7b266fc39855791772b6b400058e612e932fb043c4
|
File details
Details for the file unifi_cli-0.1.6-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: unifi_cli-0.1.6-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 5.5 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8259a9420b4e8f97644c4b7c3106d09681c28338f70a2ba65fc70ef4ed4c3bd3
|
|
| MD5 |
14052e39b79eb548b5330ddd1e46153c
|
|
| BLAKE2b-256 |
509255be8eea2542a0f1bd6a1e6cd56456b3cce3766e1f529fe33319c9ba9f2e
|
File details
Details for the file unifi_cli-0.1.6-py3-none-macosx_10_12_x86_64.whl.
File metadata
- Download URL: unifi_cli-0.1.6-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 5.7 MB
- Tags: Python 3, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67b282db14a82ad4551952d82429014f3cfe031d3b4e5f06dd05f85c1bd915e0
|
|
| MD5 |
7fa29f27a85e912dd35850032f9c2806
|
|
| BLAKE2b-256 |
1139f3ff473eb8aab244c396200839424cdd44b80f97d4b1cd4f1cfc8ea916c0
|