Skip to content

unifi-cliYour whole UniFi network from the terminal

Clients, devices, switch ports and settings behind one command grammar, with a live dashboard, configuration as code, and JSON output for scripts and agents.

Clients, a switch faceplate and the live dashboard

Recorded against the demo controller that ships with the project: a client list, the ports of a switch, and the live dashboard with its three tabs.

unifi is a command-line client and terminal UI for the UniFi Network application. It talks to a console on your network with a local API key, or to every console of your UI account through the Site Manager cloud connector.

The ports of a switch, drawn the way they sit in the rack
$ unifi ports get "Core Switch" --poe
╭─ Core Switch ─────────────────────────────────────── 18/26 up · PoE 68.9 W ─╮
│  1   3   5   7   9  11    13  15  17  19  21  23      25                    │
│  ▄   ▄   ▂   ▄   ▂ϟ  ▂ϟ    ▄   □   ▆ϟ  ▆   ▂   ×       █↑                   │
│  ▄   ▂   ▄   □   ▂ϟ  ▂ϟ    □   □   ▆ϟ  □   □   □       █                    │
│  2   4   6   8  10  12    14  16  18  20  22  24      26                    │
│                                                                             │
│ █ 10 GbE  ▆ 2.5 GbE  ▄ 1 GbE  ▂ 100 FE  □ down  × disabled  ϟ PoE  ↑ uplink │
╰─────────────────────────────────────────────────────────────────────────────╯

 #  NAME               STATUS    SPEED  POE          PROFILE  NETWORK  CONNECTED TO
 9  Camera Front Door  Up       100 FE  auto 4.1 W   IoT      IoT      Camera Front Door
10  Camera Driveway    Up       100 FE  auto 5.3 W   IoT      IoT      Camera Driveway
11  Camera Backyard    Up       100 FE  auto 3.9 W   IoT      IoT      Camera Backyard
12  Intercom           Up       100 FE  auto 2.8 W   IoT      IoT      Intercom
17  AP Living Room     Up      2.5 GbE  auto 14.2 W  Trunk    Default  AP Living Room
18  Office Switch      Up      2.5 GbE  auto 38.5 W  Trunk    Default  Office Switch
$ unifi ports poe "Core Switch" "Camera Driveway" cycle --yes
✓ Power-cycled port 10 "Camera Driveway" of Core Switch.
  → The powered device needs a minute to boot.

The output above comes from the demo controller that ships with the project, so you can reproduce it without any hardware. The traffic columns of the table are cut here to fit the page.

Install

brew install --cask spechtlabs/tap/unifi-cli

Other platforms and methods are in the installation guide. Then sign in and look around:

unifi login
unifi clients get
unifi dashboard

The quick start walks through a first session in a few minutes.

Scope

unifi-cli manages the UniFi Network application. UniFi Protect and UniFi Access are not supported in this release. The API coverage page lists which commands use the official Network API and which depend on the controller's internal API.

What it does

Each of these is a command you can run today.

Web interface vs. unifi-cli

The same network, two ways to run it

The web interface

Made for clicking through one controller

  • •
    One browser tab per console
    Switching networks means switching tabs
  • •
    Changes by hand
    Every setting is a form, and nothing in your repository records what changed
  • •
    Hard to script
    Renaming twelve ports means twelve dialogs
  • •
    No review step
    A change is live the moment you press apply

unifi-cli

Made for the terminal, scripts and agents

  • •
    unifi --context office clients get
    Any controller and site, one flag away
  • •
    unifi export --dir config/
    The site as YAML files, ready for git
  • •
    unifi ports poe "Core Switch" 9-12 off
    Ranges and names instead of dialogs
  • •
    unifi diff -f config/ -R
    See what would change before unifi apply changes it

Releases

Select your platform

v0.1.1

Features

  • logout: revoke the API key that a UI account sign-in created (f4d26a3)

Bug Fixes

  • dashboard: fit short terminals and align the topology keys (36b12b0)
  • ports: say why a port selection is empty (d706e12)

v0.1.0

Release notes

Features

  • initial release of unifi-cli (2382a48)

Contributors

Your contributions matter. Here's to everyone who's helped bring this to life.