aioesphomeapi
Python API for interacting with ESPHome devices.
What it is and what it does
aioesphomeapi is an async Python client for the ESPHome Native API protocol, enabling programmatic interaction with devices running ESPHome firmware. It handles connection management, encryption via the Noise protocol, and state subscription over an async event loop. The library depends on protobuf for message serialization, cryptography libraries for encryption, and zeroconf for device discovery.
Typical usage involves instantiating an APIClient with device hostname and port, establishing an encrypted connection with a pre-shared key, then querying device information or subscribing to state changes via callbacks. The package includes CLI tools for log watching and device discovery, and falls back gracefully to pure Python if the optional Cython extension cannot be built.
Use it for:
- Monitor and retrieve state from ESPHome sensors, switches, and lights in a home automation system.
- Subscribe to real-time state changes and trigger actions based on device events.
- Integrate ESPHome devices with external systems like InfluxDB or custom dashboards.
- Discover ESPHome devices on the local network and query their capabilities programmatically.
- Build automation workflows that read device telemetry and send control commands asynchronously.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Async Python client library for communicating with ESPHome devices over the Native API, supporting encrypted and plaintext connections.
Yes. Active maintenance (release within 1 day), no known vulnerabilities, permissive MIT license, and medium install friction with graceful fallback make this suitable for production ESPHome integrations. Install if you need to programmatically interact with ESPHome devices; the optional Cython extension is a nice-to-have but not required.
Install
aioesphomeapi on PyPI
pip
pip install aioesphomeapiuv
uv add aioesphomeapipoetry
poetry add aioesphomeapiInstalling aioesphomeapi
Before you install
Medium install friction due to optional Cython extension that requires a C compiler and Python development headers; falls back to pure Python if unavailable. Active maintenance with release within 1 day of query.
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
import aioesphomeapi
import asyncio
async def main():
api = aioesphomeapi.APIClient(
"device.local",
6053,
noise_psk="YOUR_ENCRYPTION_KEY"
)
await api.connect(login=True)
device_info = await api.device_info()
print(device_info)
asyncio.run(main())
Requires ESPHome device with Native API component enabled; Python 3.11 or later.
Verify before relying
- Whether Cython extension provides measurable performance benefit for typical use cases.
- Compatibility with ESPHome versions prior to 2026.1.0 and password authentication support details.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 9 — aiohappyeyeballs, async-interrupt, protobuf, tzdata, tzlocal, zeroconf, chacha20poly1305-reuseable, cryptography, noiseprotocol |
| Maintenance | actively maintained — 1 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,050,770/month — #4,442 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: aioesphomeapi-45.10.2-cp311-cp311-macosx_10_9_x86_64.whl; aioesphomeapi-45.10.2-cp311-cp311-macosx_11_0_arm64.whl; aioesphomeapi-45.10.2-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl; aioesphomeapi-45.10.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; aioesphomeapi-45.10.2-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl; aioesphomeapi-45.10.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; aioesphomeapi-45.10.2-cp311-cp311-musllinux_1_2_aarch64.whl; aioesphomeapi-45.10.2-cp311-cp311-musllinux_1_2_armv7l.whl; aioesphomeapi-45.10.2-cp311-cp311-musllinux_1_2_i686.whl; aioesphomeapi-45.10.2-cp311-cp311-musllinux_1_2_x86_64.whl; aioesphomeapi-45.10.2-cp311-cp311-win32.whl; aioesphomeapi-45.10.2-cp311-cp311-win_amd64.whl; aioesphomeapi-45.10.2-cp312-cp312-macosx_10_13_x86_64.whl; aioesphomeapi-45.10.2-cp312-cp312-macosx_11_0_arm64.whl; aioesphomeapi-45.10.2-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl; aioesphomeapi-45.10.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; aioesphomeapi-45.10.2-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl; aioesphomeapi-45.10.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; aioesphomeapi-45.10.2-cp312-cp312-musllinux_1_2_aarch64.whl; aioesphomeapi-45.10.2-cp312-cp312-musllinux_1_2_armv7l.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
serialxSerialx provides synchronous and native…
permissive · top 15,000 on PyPI
aioshellyAsynchronous Python library for controlling…
permissive · top 15,000 on PyPI
esphomeESPHome configures and controls…
permissive · top 15,000 on PyPI
aiofloProvides an async Python library for…
permissive · top 15,000 on PyPI
esphome-device-builderESPHome Device Builder is a web dashboard for…
permissive · top 15,000 on PyPI
bleak-esphomeProvides a Bleak backend that proxies Bluetooth…
permissive · top 15,000 on PyPI
rokuecpAn asynchronous Python client for controlling…
permissive · top 15,000 on PyPI
aiounifiAsynchronous Python library for communicating…
permissive · top 15,000 on PyPI
wiimwiim provides a Python API to discover,…
permissive · top 15,000 on PyPI