xiaomi-ble
Manage Xiaomi BLE devices
What it is and what it does
xiaomi-ble is a Python library for communicating with Xiaomi smart devices over Bluetooth Low Energy. It wraps the complexity of BLE protocol handling—using bleak for cross-platform Bluetooth access and related libraries for device data parsing and cryptography—into a simpler interface for discovering and reading sensor data from Xiaomi devices.
The library is in Pre-Alpha development, meaning its API and feature set are still evolving. It depends on a substantial stack of Bluetooth and cryptographic libraries (aiohttp, bleak, bleak-retry-connector, bluetooth-data-tools, bluetooth-sensor-state-data, cryptography, home-assistant-bluetooth, orjson, pycryptodomex, sensor-state-data) to handle the low-level work. It targets Python 3.11 and later and is actively maintained, with recent releases and ongoing commits.
Use it for:
- Read sensor data (temperature, humidity, battery) from Xiaomi smart home devices in a home automation setup
- Discover and enumerate Xiaomi BLE devices on a local network for device inventory or pairing workflows
- Integrate Xiaomi device telemetry into a Home Assistant or custom IoT dashboard
- Decrypt and parse Xiaomi device payloads for research or reverse-engineering Xiaomi BLE protocols
- Monitor Xiaomi device state changes asynchronously in a long-running service or daemon
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Manages Xiaomi BLE (Bluetooth Low Energy) devices by providing a Python interface to discover, connect to, and interact with Xiaomi devices over Bluetooth.
Yes, if you need to integrate Xiaomi BLE devices into a Python application and accept Pre-Alpha stability. The library is actively maintained, has low install friction, carries no known vulnerabilities, and uses a permissive license. However, verify that your target Xiaomi devices are supported and be prepared for API changes as the library matures.
Install
xiaomi-ble on PyPI
pip
pip install xiaomi-bleuv
uv add xiaomi-blepoetry
poetry add xiaomi-bleInstalling xiaomi-ble
Before you install
Low friction installation with a pure-Python wheel. Active maintenance (last commit 2026-08-10) and recent release (25 days old). Pre-Alpha status signals the library is still stabilizing; expect API changes or incomplete feature coverage.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you must include a copy of the license and note any modifications.
Quickstart
pip install xiaomi-ble
import asyncio
from xiaomi_ble import XiaomiBluetoothDeviceData
# Requires bleak for BLE scanning and connection
await XiaomiBluetoothDeviceData.discover()
Requires a system with Bluetooth hardware and appropriate OS-level Bluetooth drivers (Linux, macOS, or Windows with BLE support).
Verify before relying
- Which specific Xiaomi device models are supported by this version
- Whether the library handles device pairing or assumes pre-paired devices
- Real-world reliability and latency characteristics for typical Xiaomi devices
- Whether decryption of Xiaomi cloud keys is automatic or requires manual setup
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (<4.0,>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 10 — aiohttp, bleak, bleak-retry-connector, bluetooth-data-tools, bluetooth-sensor-state-data, cryptography, home-assistant-bluetooth, orjson, pycryptodomex, sensor-state-data |
| Maintenance | actively maintained — 25 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 80,704/month — #14,275 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: xiaomi_ble-1.16.0-py3-none-any.whl
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
bumbleBumble is a full-featured Bluetooth stack…
permissive · top 15,000 on PyPI
govee-bleProvides Python bindings to discover, connect…
permissive · top 15,000 on PyPI
micloudLogs into Xiaomi cloud accounts and retrieves…
permissive · top 15,000 on PyPI
python-miioPython library and CLI tool for controlling…
copyleft · top 15,000 on PyPI
uart-devicesProvides a Python interface to interact with…
permissive · top 15,000 on PyPI
airthings-bleLibrary to communicate with Airthings…
permissive · top 15,000 on PyPI
simplepybleSimplePyBLE provides cross-platform Bluetooth…
noncommercial · top 15,000 on PyPI
yalexs-bleProvides Bluetooth control of Yale and August…
copyleft · top 15,000 on PyPI
kegtron-bleProvides Bluetooth Low Energy (BLE) support for…
permissive · top 15,000 on PyPI
aiobmsbleAsynchronous Python library for querying…
permissive · top 15,000 on PyPI