Add UniFi Protect API Key Only connection mode - #1
Closed
nberardi wants to merge 3 commits into
Closed
Conversation
Support authenticating with a UniFi OS Integration API key via the public Protect Integration API, similar to Home Assistant's API-key-only mode, while keeping the existing local user account path. API Key Only currently covers cameras (RTSPS streams, snapshots, detections) and lights; sensors, locks, intercom, privacy masks, and dynamic bitrate remain local-user features. Co-authored-by: Nick Berardi <me@nickberardi.com>
Owner
Author
|
I am getting the following errors when running locally |
The API-key-only path was calling getBootstrap twice after login, which exceeded UniFi's 10 req/s public Integration API limit and returned 429. A failed second bootstrap then reset still-connecting websockets; closing a CONNECTING ws emits an error with no listener and crashed the plugin. - Bootstrap only once after login - Rate-limit and retry public API requests on 429 - Fetch cameras/lights sequentially; prime RTSPS with GET-only at bootstrap - Safely terminate CONNECTING websockets on reset Co-authored-by: Nick Berardi <me@nickberardi.com>
Owner
Author
|
Thanks for the logs — this was a real bug in the API Key Only path. Root cause
Fix (in
Please reload |
Co-authored-by: Nick Berardi <me@nickberardi.com>
nberardi
marked this pull request as ready for review
September 3, 2026 17:57
Owner
Author
|
Opened upstream against Closing this fork PR in favor of the upstream one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an API Key Only connection mode to the UniFi Protect plugin, alongside the existing local user account flow — modeled after Home Assistant’s approach in home-assistant/core#176410.
Connection modes
X-API-KEY) against the public Integration APIAPI keys are created in the UniFi OS local portal under Settings → Control Plane → Integrations.
API Key Only capabilities
Not available in API Key Only (use Local User)
Implementation notes
ProtectPublicApiclient (plugins/unifi-protect/src/public-api.ts) talks to/proxy/protect/integration/v1/*Test plan
/meta/info