skillfed

uiprotect

Python API for Unifi Protect (Unofficial)

uiprotect v15.14.2 111.1K downloads/30d#12,434 on PyPI101
Permissive license MIT Active released

What it is and what it does

uiprotect is an async Python library that communicates with UniFi Protect surveillance software running on Ubiquiti hardware (CloudKey+, UNVR, Dream Machine Pro/SE/Pro Max). It exposes both a programmatic API via ProtectApiClient and a command-line interface for managing cameras, events, sensors, lights, and other devices. The library is primarily designed for Home Assistant integration but can be used standalone.

The library increasingly relies on Ubiquiti's official Public Integration API where available, falling back to undocumented private APIs for features not yet exposed officially. It is built entirely on async/await patterns and communicates via WebSocket for real-time updates. Authentication supports both username/password and API-key modes, with public-only mode available for API-key-only workflows. Core dependencies include aiohttp for HTTP, PyAV for audio streaming to speakers, pydantic for data validation, and orjson for fast JSON parsing.

Use it for:

  • Integrate UniFi Protect cameras and events into Home Assistant for home automation workflows.
  • Build custom monitoring dashboards or alerting systems that consume UniFi Protect events via WebSocket.
  • Automate camera settings, recordings, or device management across multiple UniFi Protect instances.
  • Export event logs or generate sample data for testing and analysis.
  • Develop CLI tools to query NVR status, manage API keys, or control connected devices remotely.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides an async Python API and CLI for interacting with UniFi Protect surveillance systems on Ubiquiti hardware, supporting camera control, event management, and real-time updates via WebSocket.

Yes. The package is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and low install friction. It is production-stable (Development Status 5) and well-suited for Home Assistant users or developers building UniFi Protect integrations. The primary constraint is the requirement for Python 3.11+, a POSIX system, and network access to a UniFi Protect 7.1+ instance; Windows users must use Docker or WSL.

Install

uiprotect on PyPI

pip

pip install uiprotect

uv

uv add uiprotect

poetry

poetry add uiprotect

Installing uiprotect

Before you install

Low friction install with a pure-Python wheel. Active maintenance with a recent release (30 days ago) and ongoing commits. Requires Python 3.11+ and a POSIX system; Windows requires Docker or WSL. PyAV dependency adds a compiled component but is pre-packaged.

License in practice

MIT license permits commercial and private use with minimal restrictions, making it suitable for integration into Home Assistant and other projects without licensing concerns.

Quickstart

pip install uiprotect

from uiprotect import ProtectApiClient

protect = ProtectApiClient(host, port, username, password, verify_ssl=True)
await protect.update()
for camera in protect.bootstrap.cameras.values():
    print(camera.name)

Requires Python 3.11+, a POSIX-compatible system (not Windows without Docker/WSL), and network access to a UniFi Protect instance running version 7.1 or later.

Verify before relying

  • Stability of private API fallback when official Public Integration API does not cover a feature.
  • Compatibility across different UniFi OS Console hardware models (CloudKey+, UNVR, Dream Machine variants).
  • Performance characteristics under high-frequency WebSocket event loads.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.11)
Install friction low — pure-Python wheel
Runtime dependencies 13 — aiofiles, aiohttp, aiozoneinfo, av, convertertools, orjson, packaging, platformdirs, propcache, pydantic, pydantic-extra-types, pyjwt, yarl
Maintenance actively maintained — 30 days since the last release
Last repo commit
First released
Downloads 111,088/month — #12,434 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: uiprotect-15.14.2-py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Build ToolsTopic :: Software Development :: Libraries

Tags

unifi protect api clientubiquiti camera control pythonunifi surveillance automationunifi protect websocket eventscamera management apiunifi nvr integrationhome assistant unifi protect
async-apihome-automationsurveillance

More Libraries packages