Unofficial typed Python APIs for selected T&D Ondotori BLE advertisements
Project description
ondotori-ble
Unofficial alpha software. This project is independent of T&D Corporation.
ondotori-ble is a typed Python library for receiving selected current-value
advertisements from T&D Ondotori data loggers over Bluetooth Low Energy (BLE).
It does not pair with a logger, change settings, download recorded history, or
provide a command-line interface.
from ondotori_ble import read_all
for reading in read_all(duration=75):
print(reading.serial_number, reading.model, reading.measurements)
Support boundary
The package keeps unknown T&D packets observable, but it only converts a value when the layout and conversion have adequate evidence.
| Device or family | Status | Evidence |
|---|---|---|
| TR41, TR42, TR45 | Temperature decoded | T&D public example |
| TR41A, TR42A | Temperature decoded | T&D public example |
| TR43A, TR32B | Temperature and humidity decoded | T&D public example |
Family C3 |
Raw-only; product model unassigned | Independent observation |
| RTR501B/502B/503B/505B/507B measurement modes | Not decoded | More evidence required |
| TR-7wb, TR7A, TR7A2 and related BLE layouts | Not decoded | More evidence required |
Legacy RTR units without B |
Out of scope | Not a BLE transport |
This alpha does not claim support for every T&D Bluetooth model or mode. See the protocol documentation for the exact evidence boundary.
Install
Python 3.11 or newer is required. While the project is in alpha, allow pre-releases explicitly:
uv add --prerelease allow ondotori-ble
Read without knowing a serial number
read() returns the first T&D advertisement observed before its deadline:
from ondotori_ble import read
reading = read(timeout=75)
if reading.is_decoded:
print(reading.temperature_c, reading.humidity_percent)
else:
print(f"Raw family {reading.family_code:02X}: {reading.raw_data.hex()}")
Use read("5F440123") when the eight-digit serial is known. The serial in this
example is synthetic.
Read every observed logger
from ondotori_ble import read_all
readings = read_all(duration=75)
The function waits for the complete collection window and returns the newest
packet from every serial observed in that interval, sorted by serial. BLE
discovery is probabilistic: no finite duration can guarantee that every nearby
device was received. Use decoded_only=True to exclude raw-only packets.
Async and server use
Async applications have matching read_async(), read_all_async(), and
scan_async() functions. A long-running service can use the managed stream:
from ondotori_ble import stream_readings
async for reading in stream_readings(deduplicate=False):
await repository.store(reading.as_dict())
deduplicate=False emits every received advertisement. With the default
True, only payload changes are emitted per serial. Storage should still use
an application-defined idempotency policy because BLE does not guarantee
exactly-once delivery.
Advanced applications can manage lifecycle and inspect health directly:
from ondotori_ble import OndotoriScanner
async with OndotoriScanner() as scanner:
async for reading in scanner:
print(reading.as_dict())
print(scanner.state, scanner.stats, scanner.last_error)
Decode an existing packet
The pure decoder does not require Bluetooth hardware:
from ondotori_ble import decode_advertisement
reading = decode_advertisement(
bytes.fromhex("2301445f00000000d2041f06000000000000")
)
assert reading.temperature_c == 23.4
assert reading.humidity_percent == 56.7
Bleak separates T&D's company identifier (0x0392) from its payload. Set
company_id_included=True only when input still begins with little-endian
92 03.
Development
uv sync --all-groups
lefthook install
uv run ruff check .
uv run ruff format --check .
uv run ty check
uv run pytest
uv run --group docs mkdocs build --strict
uv build --no-sources
The full documentation is at ameyanagi.github.io/ondotori-ble. Ondotori, T&D, and related product names are trademarks of their respective owner.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ondotori_ble-0.1.0a1.tar.gz.
File metadata
- Download URL: ondotori_ble-0.1.0a1.tar.gz
- Upload date:
- Size: 22.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92ce0478191a0f9637da989a740c842a2cdbbe6327f814c2acb4957ee6a2fb5e
|
|
| MD5 |
81f21ebef9f0bce384d1b73d91ff6aac
|
|
| BLAKE2b-256 |
6cb0d26050dca3a89da5bf01ee91fefb55135c46e6052e175986416e7f198bea
|
File details
Details for the file ondotori_ble-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: ondotori_ble-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca241c56fe90bd3908e462a40ef5e47bb2baf8a6c0aa7c6bf60e10473443ce0b
|
|
| MD5 |
7c2e9d252148d69d67cd38b4c514c1a2
|
|
| BLAKE2b-256 |
fe409fb9c861306635f422c2c4f2a9fd02a09f29a2724f00af405bd5c7f2b0f6
|