Clients
About 1197 words
The clients subject covers everything connected to the site: wired, wireless, guests and VPN users. This guide shows how to find clients, inspect one, and block, unblock, reconnect or forget it.
List clients
$ unifi clients get --wireless --sort signal --limit 5
NAME IP CONNECTION NETWORK EXPERIENCE DOWN UP SIGNAL
Sonos Living Room 192.168.20.51 WiFi 2.4 GHz IoT 99% 320 kbps 6 kbps -48 dBm
MacBook Air 192.168.10.104 WiFi 6 GHz Trusted 99% 3.3 Mbps 870 kbps -49 dBm
Sonos Office 192.168.20.53 WiFi 2.4 GHz IoT 98% 256 kbps 4 kbps -51 dBm
Pixel 9 Pro 192.168.10.101 WiFi 6 GHz Trusted 98% 4.8 Mbps 620 kbps -52 dBm
ThinkPad X1 192.168.10.105 WiFi 5 GHz Trusted 97% 640 kbps 210 kbps -55 dBm
5 clientsSorting by signal, usage or connection time adds that column to the table, and on a terminal the last line counts what is listed. Without --sort signal the table has an UPLINK column instead, which names the switch and port of a wired client (Core Switch #26) or the access point of a wireless one. Blocked clients come last. --output wide adds the MAC address, vendor, signal, total usage and connection time. On a terminal that is too narrow for all of them it hides the least important columns and says so on standard error (5 columns hidden; widen the terminal or pipe the output.); in a pipe or a file it always prints every column.
Shortcut flags
| Flag | Keeps |
|---|---|
--wired, --wireless | clients by connection type |
--guests | clients on a guest network |
--blocked | blocked clients, which are otherwise listed along with the rest |
--network <name> | clients on one network |
--limit <n> | the first n clients after sorting |
Sorting
--sort takes one of name, ip, network, type, experience, signal, down, up, usage or connected, and --reverse flips the order. The numeric keys sort highest first, so --sort usage --limit 10 is the top ten by total traffic and --sort signal starts with the strongest signal.
Filters
--filter takes a filt-rs expression: conditions such as field == "value" joined with &&, || and !. Text goes in double quotes, so put the whole expression in single quotes for your shell. The language has no unary minus, which is why -70 dBm reads 0 - 70:
$ unifi clients get --filter 'signalDbm < 0 - 70'
NAME IP CONNECTION NETWORK UPLINK EXPERIENCE DOWN UP
Shelly Plug Dryer 192.168.20.61 WiFi 2.4 GHz IoT AP Hallway Mesh 84% 0 bps 1 kbps
Shelly Plug Washer 192.168.20.60 WiFi 2.4 GHz IoT AP Hallway Mesh 86% 0 bps 1 kbps
Smart Meter Reader 192.168.20.65 WiFi 2.4 GHz IoT AP Living Room 79% 0 bps 2 kbps
Weather Station 192.168.20.62 WiFi 2.4 GHz IoT AP Living Room 71% 0 bps 1 kbps
4 clientsMore examples:
unifi clients get --filter 'vendor contains "apple" && type == "WIRELESS"' # Apple devices on WiFi
unifi clients get --filter 'experience < 80' # clients having a bad time
unifi clients get --filter 'uplinkDeviceName == "Core Switch"'
unifi clients get --filter 'txRateBps > rate("20Mbps")' # downloading at more than 20 Mbit/s
unifi clients get --filter 'name contains "sonos" || vendor contains "sonos"'
unifi clients get --filter 'connectedAt > ago(1h)' # joined in the last hourThe fields are the JSON field names of a client: band, blocked, channel, connectedAt, experience, guest, hostname, id, ip, mac, name, network, online, rxBytes, rxRateBps, signalDbm, ssid, txBytes, txRateBps, type, uplinkDeviceMac, uplinkDeviceName, uplinkPortIdx, vendor and vlan. A typo in a field name fails with the list of valid fields instead of silently matching nothing.
One thing trips people up: tx and rx are counted from the network's side. txRateBps and txBytes are what the network sends to the client, which the table shows as DOWN; rxRateBps is the client's upload.
The filter reference documents the operators and the size(), rate() and ip() helpers.
Show one client
unifi clients get <client> with an argument shows one client as a table row, and describe shows everything known about it. A client answers to its name, hostname, MAC address, IP address or ID. A partial name works as long as it matches one client; unifi clients get sonos fails in the demo site and lists the three Sonos speakers it could mean.
$ unifi clients describe nas
NAS ● Online
Identity
Hostname nas
MAC 02:df:25:61:cc:b4
Vendor Synology
Guest no
Network
IP 192.168.40.10
Network Servers
VLAN 40
Connected 301d ago
Connection
Type wired
Switch Core Switch
Port NAS (#26)
Experience 100%
Traffic
Download 38.4 Mbps
Upload 4.2 Mbps
Downloaded 1.8 TB
Uploaded 912 GBA wireless client shows its access point, SSID, band, channel and signal in the Connection section instead.
Get data out
unifi clients get --output json | jq -r '.[] | select(.type == "WIRELESS") | [.name, .signalDbm] | @tsv'
unifi clients get nas --output json | jq .ipA list prints a JSON array, and a single client prints one object.
Act on a client
$ unifi clients block "Guest-iPhone" --yes
✓ Blocked Guest-iPhone.
$ unifi clients unblock "Guest-iPhone"
✓ Unblocked Guest-iPhone.
$ unifi clients unblock "Guest-iPhone"
● Guest-iPhone is not blocked.
$ unifi clients reconnect "iPad Air" "Pixel 9 Pro"
✓ Asked iPad Air to reconnect.
✓ Asked Pixel 9 Pro to reconnect.| Verb | Effect | Asks first |
|---|---|---|
block | Keeps the client off the network until you unblock it | when the client is connected |
unblock | Lets a blocked client back on | no |
reconnect | Disconnects a client for a moment so that it connects again, often to a better access point | no |
forget | Removes the client and everything the controller remembers about it: name, fixed address, statistics | always |
block, unblock and reconnect take several clients at once. Every name has to match a client before anything happens; after that, an action that fails for one client doesn't stop the others, each gets its own line, and the exit code is 1 when any of them failed.
The actions look at the current state first. Asking for something that is already the case, such as unblocking a client that isn't blocked, changes nothing, prints a notice and exits 0, so a script can repeat a command without special cases.
A question is asked only when something live goes offline or is destroyed. On a terminal you answer it; without a terminal the command fails unless you pass --yes, so a script never blocks a device by accident. Ctrl-C at the question aborts with exit code 130.
VPN clients have no MAC address and can't be blocked this way; disable their VPN user instead.
Give a client a name or a fixed address
Aliases, fixed IP addresses and notes belong to the client's record on the controller, which the known-clients subject manages by MAC address:
unifi known-clients get
unifi known-clients set 02:df:25:61:cc:b4 --alias NAS --fixed-ip 192.168.40.10
unifi known-clients set 02:df:25:61:cc:b4 --note "Synology in the rack, bay 2"known-clients is a configuration subject like networks, so it also has describe, create, edit and delete, and its objects can be exported and applied as KnownClient manifests. See Settings for how those verbs work.
