netbox-unifi-sync
netbox_unifi_sync is a NetBox 4.2+ plugin that runs UniFi -> NetBox sync jobs inside NetBox workers.
Visual Overview
flowchart LR
U["UniFi Controller(s)"] --> P["netbox_unifi_sync plugin<br/>NetBox Jobs (RQ)"]
P --> N["NetBox DCIM/IPAM/Wireless"]
A["Plugin UI<br/>Settings/Controllers/Mappings"] --> P
Architecture & Internal Flow
Runtime Execution Flow
flowchart TD
A[Scheduled Job / Manual Trigger] --> B[NetBox RQ Worker]
B --> C[Load Plugin Settings]
C --> D[Authenticate to UniFi]
D --> E[Fetch Data from UniFi API]
E --> F[Normalize / Map Data]
F --> G[Create / Update NetBox Objects]
G --> H[Write Audit Log]
Detailed Sync Pipeline
flowchart LR
U[UniFi API] --> V[Devices]
U --> W[VLANs]
U --> X[WLANs]
U --> Y[DHCP Scopes]
V --> M1[Device Mapping]
W --> M2[VLAN Mapping]
X --> M3[Wireless Mapping]
Y --> M4[IP Range Mapping]
M1 --> NB[NetBox ORM]
M2 --> NB
M3 --> NB
M4 --> NB
NB --> DB[(NetBox Database)]
Object Lifecycle Logic
flowchart TD
A[UniFi Object] --> B{Exists in NetBox?}
B -- Yes --> C[Update Object]
B -- No --> D[Create Object]
C --> E[Mark as Synced]
D --> E
E --> F{Cleanup Enabled?}
F -- Yes --> G[Remove Stale Objects]
F -- No --> H[Keep Orphaned Objects]
Authentication Flow
flowchart LR
A[Plugin Settings] --> B{Auth Mode}
B -- API Key --> C[Attach Authorization Header]
B -- Username/Password --> D[Session Login]
D --> E[Optional MFA]
C --> F[Authenticated API Session]
E --> F
F --> G[Execute Requests]
Error Handling & Retry Logic
flowchart TD
A[API Request] --> B{Success?}
B -- Yes --> C[Process Response]
B -- No --> D{Retry < Max Attempts?}
D -- Yes --> E[Backoff + Retry]
D -- No --> F[Log Error]
F --> G[Mark Job Failed]
Features
- Device sync (devices, interfaces, VLANs, prefixes, WLANs, uplink relations, IP assignments)
- Security Appliance sync — VLAN subinterfaces and gateway IPs created correctly, including Integration API controllers
- MAC address sync — per-port MACs (Legacy API) or device base MAC on Port 1 (Integration API); NetBox 4.5
MACAddressmodel compatible - DHCP scope sync to NetBox IP Ranges
- Client IP sync to NetBox IPAM with
unifi-clienttagging, stable MAC markers, descriptions, and interface assignment by MAC when NetBox has a matching DCIM or virtualization interface - NetBox Change Log support for global settings, controllers, and site mappings
- UniFi auth via API key or legacy login (username/password + optional MFA)
- Manual and scheduled sync jobs
- Runtime settings stored in plugin models (
Settings,Controllers,Site mappings)
Quick Start
1. Install
pip install netbox-unifi-sync
PyPI project page: https://pypi.org/project/netbox-unifi-sync/
For netbox-docker, add the package to local_requirements.txt before build:
echo "netbox-unifi-sync" >> local_requirements.txt
2. Enable plugin in NetBox
PLUGINS = ["netbox_unifi_sync"]
PLUGINS_CONFIG = {
"netbox_unifi_sync": {}
}
3. Apply migrations
python manage.py migrate
4. Configure in UI
Go to:
Plugins -> UniFi Sync
Configure:
- Settings (
tenant_name,netbox_roles, defaults) - Controllers (URL, auth mode, credentials)
- Site mappings (if UniFi/NetBox site names differ)
5. Run first sync
UI: Plugins -> UniFi Sync -> Sync Dashboard -> Run now
CLI:
python manage.py netbox_unifi_sync_run --dry-run --json
python manage.py netbox_unifi_sync_run
python manage.py netbox_unifi_sync_run --cleanup
Credentials
Set credentials only in:
Plugins -> UniFi Sync -> Controllers
Scheduled Jobs
The plugin supports NetBox Scheduled Jobs.
Recommended intervals:
- Small environments: every 30–60 minutes
- Larger environments: every 2–4 hours
NetBox Permissions
For normal NetBox users, grant permissions through NetBox object permissions:
- View dashboard/run history:
viewonnetbox_unifi_sync.SyncRun - Queue a manual sync job:
addonnetbox_unifi_sync.SyncRun - Manage controllers:
view/add/change/deleteonnetbox_unifi_sync.UnifiController - Test controller connectivity:
changeonnetbox_unifi_sync.UnifiController - Manage site mappings:
view/add/change/deleteonnetbox_unifi_sync.SiteMapping - Manage global settings:
view/changeonnetbox_unifi_sync.GlobalSyncSettings - View audit log:
viewonnetbox_unifi_sync.PluginAuditEvent
The legacy custom permission netbox_unifi_sync.run_sync is still accepted by
the view for compatibility, but NetBox object permissions map naturally to
netbox_unifi_sync.add_syncrun.
The legacy custom permission netbox_unifi_sync.test_controller is also
accepted, but NetBox object permissions map naturally to
netbox_unifi_sync.change_unificontroller.
Security Notes
- SSL verification defaults to true
- Secrets are redacted in run history and audit logs
- Timeouts, retries, and backoff are configurable
Documentation
- Server install guide
- NetBox plugin mode
- Configuration reference
- Troubleshooting
- Release and PyPI publish
- netbox-docker setup
- Wiki source pages
- GitHub Wiki
Maintainer: Release to PyPI
- Bump version in:
- pyproject.toml (
[project].version) - netbox_unifi_sync/version.py (
__version__) - netbox-plugin.yaml (
compatibility[].release)
- pyproject.toml (
- Configure PyPI Trusted Publisher (OIDC) for this repository/workflow.
- Create tag
vX.Y.Zeither:- via GitHub Actions
Create Release Tag (manual)(recommended), or - manually with git:
git tag -a vX.Y.Z -m "Release vX.Y.Z"git push origin vX.Y.Z
- via GitHub Actions
release.ymlruns on the tag push, gates on lint/tests, and creates the GitHub Release.publish-python-package.ymlruns onrelease: publishedand publishes to PyPI (can also be run manually for retry).
Metadata
Release files for netbox-unifi-sync 0.3.25
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| netbox_unifi_sync-0.3.25.tar.gz | 224.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| netbox_unifi_sync-0.3.25-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 412.5 kB
Release files / netbox_unifi_sync-0.3.25.tar.gz
| Download URL | netbox_unifi_sync-0.3.25.tar.gz |
|---|---|
| Size | 224.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a0621f29ebcfc5a0a653c8d563e432d751f665a0b0f768d2e4916ad308d1d6a
|
|
BLAKE2b-256 checksum How to use checksums |
123eda685104ef10a204da72b1d66062bcf3939fded3a1853bef50d853d20552
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency logRelease files / netbox_unifi_sync-0.3.25-py3-none-any.whl
| Download URL | netbox_unifi_sync-0.3.25-py3-none-any.whl |
|---|---|
| Size | 188.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c053fd9a23ac65b84e6e5f27ef631a00ac1d1bd4cc6113cd6839728909f4a09c
|
|
BLAKE2b-256 checksum How to use checksums |
198bbd83e9a8ac452f4db261fa3ad882de73583134c3ee0991b7a42963903567
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 10, 2026.
Transparency log