AltruistClient
Python async library for discovering and communicating with Altruist ESP32-based sensors over the local network using mDNS (zeroconf) and HTTP.
Features
- Discover sensors on your LAN using Zeroconf (
_altruist._tcp.local.) - Fetch sensor metadata and measurement data from
/data.json - Filter supported sensor names
- Async/AIOHTTP-based for fast, non-blocking usage
Installation
pip install atruistclient
Quick Start
import asyncio
from aiohttp import ClientSession
from zeroconf.asyncio import AsyncZeroconf
from altruistclient import AltruistDiscoverer, AltruistClient
async def main():
async with AsyncZeroconf() as zc, ClientSession() as session:
discoverer = AltruistDiscoverer(zc, session)
devices = await discoverer.get_devices()
for device in devices:
client = AltruistClient(session, device)
data = await client.fetch_data()
print(f"Device {client.device_id} (fw: {client.fw_version})")
print("Sensor names:", client.sensor_names)
print("Data:", data)
asyncio.run(main())
Class Overview
AltruistDiscoverer
- Scans for
_altruist._tcp.local.devices using zeroconf. - Filters and validates devices via their
/data.jsonresponse. - Returns a list of
AltruistDeviceModelinstances.
discoverer = AltruistDiscoverer(zc, session)
devices = await discoverer.get_devices()
AltruistClient
- Handles data fetching and parsing from a specific device.
- Extracts firmware version, sensor types, and measurements.
client = AltruistClient(session, device)
data = await client.fetch_data()
print(client.fw_version, client.sensor_names)
You can also construct it directly from an IP:
client = await AltruistClient.from_ip_address(session, "192.168.1.45")
AltruistDeviceModel
Simple dataclass containing:
id: sensor ID (from/data.json)ip_address: resolved IPfw_version: firmware version (optional)
@dataclass
class AltruistDeviceModel:
id: str
ip_address: str
name: str = "Altruist Sensor"
fw_version: str | None = None
Notes
get_devices()waits 5 seconds for mDNS discovery.- Only devices that respond to
/data.jsonand provide a validsensor_idare returned. - Internally uses
aiohttp.
Metadata
Release files for altruistclient 0.1.1
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 | Actions |
|---|---|---|---|---|
| altruistclient-0.1.1.tar.gz | 7.6 kB | Without provenance | Details for altruistclient-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| altruistclient-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for altruistclient-0.1.1-py3-none-any.whl |
Total release size: 17.3 kB
Release files / altruistclient-0.1.1.tar.gz
| Download URL | altruistclient-0.1.1.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d4f786bcebaf42c411ef1ddb1a226f935b38147c4ff9275ed3622e37ca2a49a1
|
|
BLAKE2b-256 checksum How to use checksums |
a5531cf3fb9b54b58ce0cd8108d1baa86f413447a62b689d6672c11e94e24445
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.9.22 Linux/6.11.0-1014-azure
|
Release files / altruistclient-0.1.1-py3-none-any.whl
| Download URL | altruistclient-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b20af47c3a350ac55187d46ed3ddd3df5bf39cb16a595bab9697a07d80723686
|
|
BLAKE2b-256 checksum How to use checksums |
43e0202e6b791620505f15449ddde9d5490ed05d163ee96f1e01334ac0b5fab0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.9.22 Linux/6.11.0-1014-azure
|
Security for altruistclient 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.