Unifi Dhcp Reservation
Declarative DHCP fixed-IP reservations on a local UniFi controller (UDM / UDM Pro / UDM SE). sync reads every reservation the controller holds; drift compares a desired set against it without writing, reporting missing, mismatched, unmanaged, duplicate and DHCP-pool-overlapping entries; apply reconciles the controller to the desired set and supports dryRun. device_drift does the same read-only comparison for adopted hardware, which cannot hold reservations at all and is addressed through device config instead — the one surface drift is blind to. Reservations live on the legacy Network API as user objects carrying use_fixedip/fixed_ip. Adds TOTP/MFA login support, which the upstream @mgreten/unifi auth flow lacks — UniFi SSO accounts with MFA reject password-only logins with MFA_AUTH_REQUIRED. Catches the failure mode where a reservation silently never takes effect because its address is already claimed by a statically-configured host. forget_client prunes stale client records the controller still remembers, refusing any MAC that holds a reservation or a live lease unless forced.
Global Arguments
| Argument | Type | Description |
|---|---|---|
| host | string | UDM IP address or hostname, e.g. 192.0.2.1 |
| username | string | UniFi admin username |
| password | string | UniFi admin password (use a vault reference) |
| totpSecret? | string | Base32 TOTP secret for MFA-enabled accounts (use a vault reference). |
| site | string | UniFi site name |
| Argument | Type | Description |
|---|---|---|
| desired | array | The reservation set that should exist. |
| Argument | Type | Description |
|---|---|---|
| macs? | array | Only these MACs (any separator style). |
| ips? | array | Only these addresses. |
| unreservedOnly | boolean | Only hosts without a fixed-IP reservation. |
| Argument | Type | Description |
|---|---|---|
| desired | array | The reservation set that should exist. |
| Argument | Type | Description |
|---|---|---|
| start | string | First address of the new DHCP range. |
| stop | string | Last address of the new DHCP range. |
| dryRun | boolean | Report what the change would displace without writing. |
| Argument | Type | Description |
|---|---|---|
| devices | array | The devices to pin. |
| netmask | string | |
| gateway | string | Default gateway for the fabric. |
| dns1? | string | |
| dns2? | string | |
| dryRun | boolean |
| Argument | Type | Description |
|---|---|---|
| desired | array | The reservation set that should exist. |
| dryRun | boolean | Report the actions that would be taken without writing. |
| Argument | Type | Description |
|---|---|---|
| macs | array | MACs to forget. Normalized before use, so any separator works. |
| force | boolean | Forget even a MAC that holds a reservation or a live lease. |
| dryRun | boolean | Report the actions that would be taken without writing. |
Resources
Compare the controller's DHCP reservations against the desired set, raise an Apprise notification when they diverge, and record a full host inventory. Static addressing drifts silently across three places at once -- in-guest config, controller reservations, and device-local settings -- and nothing announces it. This is what makes the controller half of that noticed without being asked. Read-only. Every method used here (drift, inventory) is non-writing; the reconciling methods (apply, set_pool,
Compare the static addressing on adopted UniFi hardware against fabric-devices.json and raise an Apprise notification when it diverges. Companion to @sntxrr/unifi-drift-watch, which covers DHCP reservations and is blind to this. Adopted devices cannot hold reservations at all -- the controller rejects them with api.err.FixedIpAlreadyUsedByDevice -- so APs and switches are addressed through device config instead, and nothing was watching it. A switch was once found carrying a stale config_network
Modified 1 models
Added 2 workflows
Modified 1 models
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License declared1/1earned
- Verified public repository2/2earned