py-unifi-access
Async Python client for the UniFi Access local API with WebSocket event support
What it is and what it does
py-unifi-access is an async Python client library for controlling UniFi Access hardware via its local API. It uses aiohttp for REST calls and provides WebSocket support for real-time device events, with automatic reconnection and exponential backoff. All API responses and WebSocket events are typed using Pydantic v2 models, making it suitable for Home Assistant integrations and other async applications that need structured, type-safe access to UniFi hardware.
The package is designed for stateless operation, fitting Home Assistant's DataUpdateCoordinator pattern. It includes a CLI tool (via the `cli` extra) for debugging WebSocket events by capturing raw and parsed message streams to JSON files, useful when troubleshooting integration issues or reporting bugs.
Use it for:
- Build Home Assistant integrations that monitor and control UniFi Access doors and locks in real time.
- Create automation scripts that unlock doors or check access status based on external triggers.
- Debug WebSocket event parsing by capturing raw event streams to identify schema mismatches.
- Monitor emergency status and device updates across multiple UniFi Access units asynchronously.
- Integrate UniFi Access control into custom smart-home or building-management applications.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Async Python client for UniFi Access local API with WebSocket event support, providing typed access to doors, lock rules, and real-time device updates.
Yes, if you need to control UniFi Access hardware from Python. The package is actively maintained, has low install friction, uses permissive MIT licensing, and provides well-typed async APIs. It is beta-status software with no known vulnerabilities. Install it if you are building Home Assistant integrations or custom automation around UniFi Access; skip it if you do not have UniFi Access hardware or need synchronous APIs.
Install
py-unifi-access on PyPI
pip
pip install py-unifi-accessuv
uv add py-unifi-accesspoetry
poetry add py-unifi-accessInstalling py-unifi-access
Before you install
Low friction installation with a pure-Python wheel. Actively maintained with a release 27 days ago and recent commits. Requires Python 3.12 or later.
License in practice
MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely provided you include the license notice.
Quickstart
pip install py-unifi-access
import aiohttp
from py_unifi_access import UnifiAccessApiClient
async with aiohttp.ClientSession() as session:
client = UnifiAccessApiClient("192.168.1.1", "api-token", session)
await client.authenticate()
doors = await client.get_doors()
Requires Python 3.12 or later; UniFi Access hardware and local API credentials required.
Verify before relying
- Whether WebSocket event parsing covers all UniFi Access event types beyond the 13 documented types.
- Performance characteristics under high-frequency event streams or with many concurrent door operations.
- Compatibility with UniFi Access hardware versions and firmware releases.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.12) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — aiohttp, pydantic |
| Maintenance | actively maintained — 27 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 76,954/month — #14,571 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: py_unifi_access-1.6.1-py3-none-any.whl
Tags
More Networking packages
h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
psutilpsutil retrieves real-time information about…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
uvloopuvloop is a drop-in replacement for Python's…
permissive · top 1,000 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
pyzmqPyZMQ provides Python bindings for ZeroMQ…
permissive · top 1,000 on PyPI
uiprotectProvides an async Python API and CLI for…
permissive · top 15,000 on PyPI
aiounifiAsynchronous Python library for communicating…
permissive · top 15,000 on PyPI
pyisyPyISY is a Python library for asynchronous…
permissive · top 15,000 on PyPI
subarulinkInteract with Subaru's MySubaru Connected…
permissive · top 15,000 on PyPI
gotailwindAsynchronous Python client for controlling and…
permissive · top 15,000 on PyPI
openccu-loom-clientAsync Python REST and WebSocket client for the…
permissive · top 15,000 on PyPI
seamOfficial Python SDK for the Seam API that…
permissive · top 15,000 on PyPI
aioambientAn async Python library for querying Ambient…
permissive · top 15,000 on PyPI
unifi-discoveryDiscovers Unifi devices on a network using…
permissive · top 15,000 on PyPI
fastapi-socketioIntegrates Socket.IO real-time bidirectional…
permissive · top 15,000 on PyPI