This doc captures how we access the UniFi controller via the local tunnel and query client stats with unifi-scheduler.
- SSH jump host:
homepi - Controller IP:
192.168.1.39 - Local tunnel (must be running while you use the CLI):
ssh -N -L 8444:192.168.1.39:443 -L 8443:192.168.1.39:8443 homepi- Endpoint for the CLI:
https://127.0.0.1:8444 - Use a non-MFA UniFi user when running CLI automation.
We currently use a locally built binary in tmp/unifi-scheduler/unifi-scheduler.
cd tmp/unifi-scheduler/unifi-scheduler-master
make buildNotes:
- The local build includes a small allowlist change so
rawrequests can hit/stat/report/*endpoints. - If you re-download the tool, reapply the allowlist change in
pkg/unifi/validation.go.
List clients:
tmp/unifi-scheduler/unifi-scheduler \
--endpoint https://127.0.0.1:8444 \
--tls-insecure \
--username <user> \
--password '<pass>' \
client listGet current client stats (raw):
tmp/unifi-scheduler/unifi-scheduler \
--endpoint https://127.0.0.1:8444 \
--tls-insecure \
--username <user> \
--password '<pass>' \
raw --method GET /stat/staThese endpoints require POST payloads. All timestamps are Unix milliseconds.
5-minute user stats (good for short windows):
tmp/unifi-scheduler/unifi-scheduler \
--endpoint https://127.0.0.1:8444 \
--tls-insecure \
--username <user> \
--password '<pass>' \
raw --method POST /stat/report/5minutes.user '{
"attrs": ["time", "signal", "tx_retries", "rx_rate", "tx_rate"],
"start": 1767374033164,
"end": 1767460433164,
"mac": "aa:bb:cc:dd:ee:ff"
}'Hourly stats (last ~7 days by default):
tmp/unifi-scheduler/unifi-scheduler \
--endpoint https://127.0.0.1:8444 \
--tls-insecure \
--username <user> \
--password '<pass>' \
raw --method POST /stat/report/hourly.user '{
"attrs": ["time", "signal", "tx_retries", "rx_rate", "tx_rate"],
"start": 1766855823601,
"end": 1767460623601,
"mac": "aa:bb:cc:dd:ee:ff"
}'Daily stats (last ~30 days by default):
tmp/unifi-scheduler/unifi-scheduler \
--endpoint https://127.0.0.1:8444 \
--tls-insecure \
--username <user> \
--password '<pass>' \
raw --method POST /stat/report/daily.user '{
"attrs": ["time", "signal", "tx_retries", "rx_rate", "tx_rate"],
"start": 1764868623601,
"end": 1767460623601,
"mac": "aa:bb:cc:dd:ee:ff"
}'- Self-signed TLS: use
--tls-insecureor supply a root CA with--tls-root-ca. - MFA: CLI automation cannot complete WebAuthn challenges; use a non-MFA local UniFi user.
- Stale events:
stat/eventappears stale on this controller; usestat/report/5minutes.userfor recent history.
signal: RSSI (dBm)rx_rate,tx_rate: link ratestx_retries: retry count (higher indicates poor link or interference)time: sample timestamp (ms)