Install & Compatibility
Where this runs
tested against v55 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.762s · 28.3MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 4.6s · import 0.676s · 31MB
28MB installed
● package 28MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Controller
✓ from aiounifi import Controller
✗ from aiounifi.controller import Controller
Controller is exported from the top-level package since v45
Site
✓ from aiounifi import Site
✗ from aiounifi.models.site import Site
Site model class is available at top-level since v60
Connect to a UniFi controller and list sites.
import asyncio
from aiounifi import Controller
async def main():
controller = Controller(
host="192.168.1.1",
username="admin",
password="password",
port=8443,
ssl_verify=False
)
await controller.initialize()
sites = await controller.get_sites()
print(sites)
await controller.close()
asyncio.run(main())
Errors
Common errors & fixes
aiounifi.exceptions.Unauthorized
Invalid credentials or session expired.
fixEnsure username/password are correct and call `await controller.initialize()` to re-authenticate.
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.1.1:8443 ssl:default [getaddrinfo failed]
Wrong host or port, or network unreachable.
fixCheck controller IP and port; if using default HTTPS port (8443), ensure it's correct.
AttributeError: 'Controller' object has no attribute 'login'
Code uses deplicated `login()` method removed in newer versions.
fixUse `controller.initialize()` instead of `controller.login()`.
Upgrade
Version history
91latest on PyPI · released May 25, 2026
Audit
Dependencies
aiohttprequiredAsync HTTP client for API requests