Skip to main content

CLI for UniFi Network controller

Project description

unifi-cli

codecov

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

unifi_cli-0.1.5.tar.gz (76.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

unifi_cli-0.1.5-py3-none-win_amd64.whl (5.6 MB view details)

Uploaded Python 3Windows x86-64

unifi_cli-0.1.5-py3-none-manylinux_2_28_x86_64.whl (5.8 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

unifi_cli-0.1.5-py3-none-manylinux_2_28_aarch64.whl (5.5 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

unifi_cli-0.1.5-py3-none-macosx_11_0_arm64.whl (5.4 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

unifi_cli-0.1.5-py3-none-macosx_10_12_x86_64.whl (5.7 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file unifi_cli-0.1.5.tar.gz.

File metadata

  • Download URL: unifi_cli-0.1.5.tar.gz
  • Upload date:
  • Size: 76.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for unifi_cli-0.1.5.tar.gz
Algorithm Hash digest
SHA256 2f2cec25babe9f1deea0984c18e7e16168cc0c134447e24856965df963533705
MD5 3be2d70809331ee769db05ee9773d4e0
BLAKE2b-256 19a80e92c327328c2cb012ffed976a4fb20a5cd74de21b2f82de8ad07729bbb6

See more details on using hashes here.

File details

Details for the file unifi_cli-0.1.5-py3-none-win_amd64.whl.

File metadata

  • Download URL: unifi_cli-0.1.5-py3-none-win_amd64.whl
  • Upload date:
  • Size: 5.6 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for unifi_cli-0.1.5-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 117e6aa05cf8354ebb451a513747ed17776f9533ed7dbf3979392ead13036cc9
MD5 81b279ae964951b5d3215810934cf8d6
BLAKE2b-256 9b74ec2bf7138a86badf9c107f20b569a493e78dc46f4732591faae90bc50f45

See more details on using hashes here.

File details

Details for the file unifi_cli-0.1.5-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for unifi_cli-0.1.5-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0db942a31d4f3c1504bfc8cc7def85315bc914f278ab0f7a937079b4faed0b98
MD5 78c0c5fdce2d3a17a36e1179dcc8f29f
BLAKE2b-256 b5da359713f263646142417588d77a20834c8d2d6314e0b19f71f269e3258a95

See more details on using hashes here.

File details

Details for the file unifi_cli-0.1.5-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for unifi_cli-0.1.5-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c3c41c67bf39fd40d4320ec4e0ebd05003be66ff39b500fedb5da7e027e53442
MD5 4df93b6f07eb3789ec7ab15445d8ba8e
BLAKE2b-256 97a1813f683aa6f35320a138517d033716706cf9d2cf9b918dac74bbf65bee09

See more details on using hashes here.

File details

Details for the file unifi_cli-0.1.5-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for unifi_cli-0.1.5-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e95cf08858d234cbac1083f974ab338303cfbfef69cc5a4cafa96ba80f09e84b
MD5 ce84765d3be5dd5528d4b08f5298fc2d
BLAKE2b-256 113fb44cdb53a6142f0c1d25be771b3177985d8382445010f8b70336d4d3433e

See more details on using hashes here.

File details

Details for the file unifi_cli-0.1.5-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for unifi_cli-0.1.5-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 43c65d795ec98a4f34cc1bc631630c98fc679a61d5a66c4493a75f8f2d999cab
MD5 56816bc83685975fe3f26bf1fc629711
BLAKE2b-256 ef7f05f5a6e9723558a14767ae0ee9b87f1d514414e72ac8f0204c1346cc9222

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page