/unifi-network-ops:applying-unifi-changesfrom unifi-network-ops
Use before writing any configuration to a UniFi controller - PUT/POST/DELETE against wlanconf, networkconf, rest/device, radio settings, firewall, or IPS. Covers merge-not-replace PUT semantics, verifying runtime state rather than stored config, provisioning and DFS outage windows, referential integrity on deletes, and the shell traps that have silently corrupted payloads.
Ships in unifi-network-ops. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Reading a UniFi controller is safe. Writing to one is not. A single config PUT reprovisions devices, bounces radios, and drops every wireless client on the affected APs.
Core principle: rc: ok means the controller accepted your payload. It does not mean
the device applied it, and it does not mean you changed what you think you changed.
Every incident described in this skill happened on a real network with a competent operator. None were exotic.
Before any of: PUT /rest/wlanconf, PUT /rest/device, PUT /rest/networkconf,
PUT /rest/setting/*, DELETE /rest/*, POST /cmd/*.
REQUIRED FIRST: capturing-a-unifi-baseline. If you do not have a snapshot and a
native .unf backup, you are not ready to write.
capturing-a-unifi-baseline).unf backup downloaded — the only full-restore pathOutage budget:
| Change | Downtime |
|---|---|
| Non-DFS channel or power change | ~30 s on that radio |
| DFS channel change | ~100 s (~77 s of it Channel Availability Check, radio silent) |
WLAN (wlanconf) change | Site-wide reprovision — every AP |
| Network/VLAN delete | Reprovisions switches with affected ports |
PUT /rest/<collection>/<id> merges your payload into the stored object.
Consequences:
x_passphrase: "" is rejected by validation even
on an open network, and virtual_network_override_id: null returns InvalidPayload.
To "remove" such a reference you must repoint it at another valid object, not null it.This is the single most destructive trap in this skill. It caused a total 2.4 GHz outage.
# ☠️ BROKEN — do not do this
for ssid in a b c d; do
jq ... > /tmp/payload.json # zsh `noclobber` makes `>` FAIL on an existing file
curl -X PUT ... -d @/tmp/payload.json
done
Under zsh with noclobber set, > fails on an existing file. Only the first
iteration writes a payload. Every later iteration silently re-sends the first one.
The result: four different SSIDs were overwritten with a copy of the first, all four
briefly became the same network on the same band, and every 2.4 GHz-only device in the
building had no SSID to join.
# ✅ CORRECT — pipe jq straight into curl, nothing touches disk
for id in "${ids[@]}"; do
jq -nc --arg id "$id" '{minrate_ng_data_rate_kbps:6000, minrate_setting_preference:"manual"}' \
| curl -sk -X PUT -H "X-API-KEY: $KEY" -H 'Content-Type: application/json' \
-d @- "$API/rest/wlanconf/$id"
# then RE-READ this object before moving to the next one
done
Re-read and verify each object after each write. Not at the end of the loop — after each write. The outage above ran for minutes because verification was batched to the end.
GID is a reserved integer variable in zsh. Assigning a hex string throws "bad math
expression". Same class as UID, EUID, PPID. Never name a loop variable GID.du is commonly aliased (e.g. to dust) in modern shells; use command du in scripts.A device can accept a config change and silently continue running the old value.
Observed: a long-range AP accepted a channel change with rc: ok, the config read back
correct, and radio_table_stats showed it still on the old channel. Transmit power
from the same PUT applied fine — so a partial application looks like a full one.
# After ANY radio change, check the runtime, not the config you just wrote:
curl -sk -H "X-API-KEY: $KEY" "$API/stat/device" \
| jq -r --arg m "$MAC" '.data[]|select(.mac==$m)|.radio_table_stats[]
| "\(.radio) ch=\(.channel) state=\(.state)"'
# Want: state == "RUN" on the channel you asked for.
# DFS_WAIT is normal and transient (~77s). INIT for minutes is not.
If the runtime disagrees with the config:
curl -sk -X POST -H "X-API-KEY: $KEY" -H 'Content-Type: application/json' \
-d "{\"cmd\":\"force-provision\",\"mac\":\"$MAC\"}" "$API/cmd/devmgr"
Some values are ignored unless a companion field is also set. The PUT returns rc: ok
and nothing changes.
| You set | Also required | Otherwise |
|---|---|---|
minrate_ng_data_rate_kbps | minrate_setting_preference: "manual" | Silently ignored while "auto" |
tx_power: <n> | tx_power_mode: "custom" | Named modes ignore the value |
Always diff the object after the write. rc: ok proves nothing about a gated field.
// operator lies about falsejq '.min_rssi_enabled // "ABSENT"' # returns "ABSENT" for a legitimate `false`
jq 'has("min_rssi_enabled")' # ✅ correct presence test
// treats false and null identically. Auditing boolean settings with // will
report disabled features as missing ones.
Measured on a live 5-AP site: across 10 radios, // reported 5 as "ABSENT" while
has() returned true for all 10. Those 5 were not missing the field — they had
min_rssi_enabled: false. An audit built on // would have concluded the setting was
unavailable on half the radios.
Batching a radio change and a WLAN change close together triggers overlapping
reprovisions. On one site this left three APs of the same model and firmware wedged in
state=INIT with channel=null and zero VAPs up, for more than six minutes.
Diagnostics at the time: dev_state=1 and 113–162 day uptimes, so they had not crashed —
the radios simply never came back up. A field-level diff against baseline showed no
config corruption. One of the wedged APs had a channel that never changed. Reverting
the config did not recover them, and force-provision did not either.
Recovery: POST /cmd/devmgr {"cmd":"restart","mac":"<mac>"}.
Prevention: apply one change class at a time and confirm every AP reaches RUN
before starting the next class. Order that works well:
RUN after each)wlanconf changes (site-wide reprovision)Observed on Network 10.6 with switch DHCP snooping on (global_switch.dhcp_snoop: true):
a network created over the API came up with its gateway interface and DHCP server
reported up, clients associated on the right VLAN, and a static address could ping the
gateway, yet DHCP DISCOVERs never got an OFFER. Firewall changes, removing the network
from IDS, toggling dhcpd_enabled, and force-provisioning the gateway all failed to fix
it. Toggling dhcp_snoop off and back on fixed it, with snooping left on. Each toggle
reprovisions every switch.
# PUT rest/setting/global_switch/<id> {"dhcp_snoop":false} -> wait for switches state 1
# PUT rest/setting/global_switch/<id> {"dhcp_snoop":true} -> wait again, then retest
Test with a fresh DISCOVER, not a client rejoin. A client that already held a lease
on the subnet reuses it via INIT-REBOOT plus an ARP check of the router, with no DHCP
exchange at all. From an AP that carries the VLAN:
udhcpc -i br0.<vlan> -n -q -f -s /bin/true # -s /bin/true: don't apply the address
Copy the full field set. A minimal POST rest/networkconf produces an object missing
about 20 fields the UI sets, including enabled and dhcpd_leasetime. Copy them from an
existing network of the same purpose rather than relying on defaults.
Zone firewall details on a new zone: creating a zone generates predefined policies
(block to other internal zones, allow to External, allow all to Gateway). A
user-defined ALLOW to Gateway with create_allow_respond: true is rejected ("create
respond traffic not allowed") because the return path already exists. Policy hits on
the v2 API are not live counters; do not diagnose from them.
UniFi enforces referential integrity and will reject the delete. Checking shared port profiles, SSID bindings, and current clients is not sufficient — two reference types are easy to miss:
| Error | Hidden reference | Where |
|---|---|---|
NETWORK_IS_USED_BY_PORT_NATIVE_NETWORK | Per-port native VLAN override | stat/device → port_overrides[].native_networkconf_id |
NETWORK_IS_USED_BY_CLIENT_AS_VIRTUAL_NETWORK | Per-client VLAN override | rest/user → virtual_network_override_id |
Both survive long after the device is gone — one was last seen five months earlier, the other eight. Treat UniFi's rejection as correct and go find the reference.
# Find every reference to a network id before attempting a delete
NID=<network_id>
curl -sk -H "X-API-KEY: $KEY" "$API/stat/device" \
| jq --arg n "$NID" '.data[]|select(.port_overrides[]?.native_networkconf_id==$n)|{name,mac}'
curl -sk -H "X-API-KEY: $KEY" "$API/rest/user" \
| jq --arg n "$NID" '.data[]|select(.virtual_network_override_id==$n)|{name,mac,_id}'
Clear each binding by repointing it at another network (null is rejected), then delete.
Removing a zone deletes every policy referencing it. Before deleting, confirm none of
those policies are user-defined — check for a predefined/rule_index marker and count
them. One cleanup cascaded 18 policies, all boilerplate, losing nothing; that was verified
first, not assumed.
tx_power change alone does not drop clients, so it is not a usable way to force
reassociation.POST /cmd/stamgr {"cmd":"kick-sta","mac":"<client_mac>"}| Command | Purpose |
|---|---|
POST /cmd/devmgr {"cmd":"force-provision","mac":M} | Push config to a device that ignored it |
POST /cmd/devmgr {"cmd":"restart","mac":M} | Recover a device wedged in INIT |
POST /cmd/stamgr {"cmd":"kick-sta","mac":M} | Force one client to reassociate |
POST /cmd/backup {"cmd":"backup","days":"0"} | Generate a native .unf backup |
stat/device → radio_table_stats[].state | The only trustworthy radio status |
Valid enum values that are easy to guess wrong:
| Field | Valid | Rejected |
|---|---|---|
ips_mode | disabled / ids / ips | detection, prevention → api.err.InvalidPayload |
tx_power_mode | auto / low / medium / high / custom | anything else |
minrate_setting_preference | auto / manual | — |
.unf backup| Mistake | Reality |
|---|---|
"rc: ok means it worked" | Gated fields silently no-op. Read back and diff. |
| "Config reads back right, so it applied" | Runtime can differ. Check radio_table_stats. |
| Omitting a field to clear it | PUT merges. The old value survives. |
| "The new network's DHCP server is up, so DHCP works" | Switch DHCP snooping can drop it. Test with a fresh DISCOVER; toggle dhcp_snoop to reprovision. |
| Building payloads in a temp file in a loop | noclobber re-sends the first payload to every object. |
| Batching radio + WLAN changes | Overlapping reprovisions wedge APs in INIT. |
| Trusting your own "unreferenced" pre-flight | Check port_overrides and virtual_network_override_id. |
| Reverting to recover a wedged AP | Reverting did not help. restart did. |
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub devondragon/unifi-network-ops --plugin unifi-network-ops4 skills in this plugin
/capturing-a-unifi-baselineUse when connecting to a UniFi controller (UDM/UDM Pro/UDM SE/Cloud Key) for the first time, auditing a UniFi site, or before making any UniFi configuration change - covers which API surface to use, what an API key can and cannot read, capturing a restorable snapshot, and which captured files contain cleartext credentials./reviewing-unifi-securityUse when auditing the security posture of a UniFi network - zone-based firewall policies, VLAN segmentation, guest isolation, IDS/IPS configuration, port forwards, management exposure, or WPA/SSID settings. Also use when deciding which security findings are worth recommending to a specific owner./tuning-unifi-wifi-rfUse when diagnosing or fixing UniFi WiFi performance - slow wireless, high channel utilization or airtime, co-channel interference, sticky clients stuck on a distant AP at poor dBm, DFS/radar channel questions, transmit power and min-RSSI decisions, or 2.4GHz minimum data rate. Also use before claiming a UniFi RF metric shows a problem.