litime-ble
Lightweight Python library and CLI to read Li-Time BLE battery statistics via Bluetooth Low Energy.
New in 0.2.0: Device discovery, enhanced logging, comprehensive examples, and CLI module support.
Install
pip install litime-ble
Or install from source:
pip install .
Quick start
Device Discovery
Find your Li-Time battery automatically:
from litime_ble import find_litime_batteries_sync
batteries = find_litime_batteries_sync(timeout=5.0)
if batteries:
mac_address = batteries[0]['address']
print(f"Found battery: {mac_address}")
Battery Reading
from litime_ble import BatteryClient
# Synchronous (simple)
with BatteryClient.sync(address="C8:47:80:15:5C:0F") as client:
status = client.read_once()
print(f"Battery: {status.voltage_v:.1f}V, {status.soc_percent:.0f}%")
print(status.json()) # Full data as JSON
# Asynchronous (recommended)
import asyncio
from litime_ble import BatteryClient
async def read_battery():
client = BatteryClient(address="C8:47:80:15:5C:0F")
async with client.session():
status = await client.read_once_async()
return status
status = asyncio.run(read_battery())
CLI
# Discover batteries
python -m litime_ble discover --battery-only
# Read battery status
python -m litime_ble read --address C8:47:80:15:5C:0F --json
# Or use the installed command
litime-battery read --address C8:47:80:15:5C:0F --json
Documentation & Examples
- Documentation - Complete API docs and usage guide
- Examples - Ready-to-run example scripts with CLI options
- Developer Guide - Setup, testing, and contribution guidelines
Developer
Quick test:
# PowerShell
$env:PYTHONPATH = (Resolve-Path src).Path; python -m pytest -q
# macOS/Linux
PYTHONPATH=$(pwd)/src python -m pytest -q
Code quality:
ruff check src --fix
License
This project is licensed under the MIT License.
It follows the same license as the original codebase it was based on: litime-bluetooth-battery.
Copyright (c) 2025 Konnexio Inc.
Metadata
Release files for litime-ble 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| litime_ble-0.2.2.tar.gz | 26.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| litime_ble-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.4 kB
Release files / litime_ble-0.2.2.tar.gz
| Download URL | litime_ble-0.2.2.tar.gz |
|---|---|
| Size | 26.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0dcb3ef634a13b68f9456a0f31aba344c4fec4b52e85b074ae3b3f43e6c77e33
|
|
BLAKE2b-256 checksum How to use checksums |
ce5c7fcd65c7c71d275e06556bb156dbbe915a634961d37e184be7b6e0e58d10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 12, 2025.
Transparency logRelease files / litime_ble-0.2.2-py3-none-any.whl
| Download URL | litime_ble-0.2.2-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
813114429e3b24ce7eac58fcddd9a826aa8fcd6483ab9bbb46a0165894d44c61
|
|
BLAKE2b-256 checksum How to use checksums |
0b941ad22acda9495cc25ee59aeede7f28978deba733776c188291ca355a1933
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 12, 2025.
Transparency logSecurity for litime-ble 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for litime_ble-0.2.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 12, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.