skillfed

py-unifi-access

Async Python client for the UniFi Access local API with WebSocket event support

py-unifi-access v1.6.1 77.0K downloads/30d#14,571 on PyPI2
Permissive license MIT Active released

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-access

uv

uv add py-unifi-access

poetry

poetry add py-unifi-access

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Typing :: Typed

Tags

unifi access api clientasync unifi door controlunifi websocket eventshome assistant unifi integrationunifi lock management pythonreal-time unifi device updates
home-assistantunifi-hardwareasync-client

More Networking packages