Python client for the TIREMO SDK REST and live WebSocket APIs
Project description
tiremo-sdk-client
Async Python client for the TIREMO SDK. REST bootstrap plus a WebSocket live channel for telemetry, presence, and alarms.
Requires Python 3.10+.
Documentation
| Topic | Link |
|---|---|
| SDK Live Data | docs.tiremo.ai/developer-guide/sdk-live-data |
| API Key Security | docs.tiremo.ai/developer-guide/sdk-api-key-security |
Getting started
1. Install
pip install tiremo-sdk-client
From source (development):
cd client-python
make venv lint
2. Get an API key
Create a product-scoped API key in the Tiremo Platform Administration → API Credentials UI.
Use a secret key for backend services. Use create_live_token() when handing off to untrusted clients.
3. Create a client
from tiremo_sdk import TiremoClient
client = TiremoClient(
api_key="your-api-key",
base_url="https://sdk.tiremo.ai",
)
All methods are async — run them inside asyncio.run() or your async framework.
4. Choose a live connection mode
| Method | When to use |
|---|---|
connect_live_with_secret_key() |
Trusted backend scripts and workers |
create_live_token() + connect_live_with_token() |
Serving browser or mobile clients |
Usage examples
TiremoClient — REST
get_telemetry_latest(device_identifier, *, keys=None)
latest = await client.get_telemetry_latest(
"cameradevice9",
keys=["temperature", "humidity"],
)
print(latest["deviceIdentifier"])
print(latest["timestamp"])
print(latest["data"]["temperature"])
Pass keys=None to fetch all keys on the latest point.
create_live_token()
token_response = await client.create_live_token()
token = token_response["token"]
expires_at = token_response["expiresAt"]
connect_live_with_token(token)
live = client.connect_live_with_token(token)
await live.connect()
connect_live_with_secret_key()
live = client.connect_live_with_secret_key()
await live.connect()
TiremoLiveClient — WebSocket
connect() / disconnect()
await live.connect()
# ...
await live.disconnect()
on(event, handler)
Handlers may be sync or async. Returns an unsubscribe callable.
async def on_telemetry(event: dict) -> None:
print(event["data"])
live.on("telemetry", on_telemetry)
live.on("connected", lambda e: print(e["productIdentifier"]))
live.on("presence", lambda e: print(e["deviceIdentifier"], e["isOnline"]))
live.on("alarm", lambda e: print(e["alarmType"], e["severity"]))
live.on("error", lambda e: print(e["code"], e["message"]))
subscribe_telemetry(subscription_id, device_identifier, *, keys=None)
await live.subscribe_telemetry(
"temp-sub",
"cameradevice9",
keys=["temperature"],
)
subscribe_presence(subscription_id, device_identifier)
await live.subscribe_presence("presence-sub", "cameradevice9")
subscribe_alarm(subscription_id, device_identifier)
await live.subscribe_alarm("alarm-sub", "cameradevice9")
unsubscribe(subscription_id)
await live.unsubscribe("temp-sub")
Ping/pong heartbeats are handled automatically.
Full example
import asyncio
from tiremo_sdk import TiremoClient
async def main() -> None:
client = TiremoClient(
api_key="your-api-key",
base_url="https://sdk.tiremo.ai",
)
latest = await client.get_telemetry_latest("cameradevice9", keys=["temperature"])
print("Latest:", latest["data"])
live = client.connect_live_with_secret_key()
async def on_connected(_event: dict) -> None:
await live.subscribe_telemetry("temp", "cameradevice9", keys=["temperature"])
async def on_telemetry(event: dict) -> None:
print("Live:", event["data"])
live.on("connected", on_connected)
live.on("telemetry", on_telemetry)
await live.connect()
await asyncio.sleep(60)
await live.disconnect()
asyncio.run(main())
Related packages
| Package | Use case |
|---|---|
@empa-electronics/tiremo-sdk-client-js |
Browser / bundler |
@empa-electronics/tiremo-sdk-client-node |
Node.js 18+ |
License
ISC — Empa Electronics
Project details
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 tiremo_sdk_client-0.1.3.tar.gz.
File metadata
- Download URL: tiremo_sdk_client-0.1.3.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
440ed19163e4c84a82b6672c1b2d115e04da165073d64535dfc11fa4da40ffc0
|
|
| MD5 |
60dcbc3c672f9ab43441238c21dd96d1
|
|
| BLAKE2b-256 |
bf2f07ededff5d1bda8165a9481ad778402ee8e17f6d55aa375f5039e33ac2e7
|
File details
Details for the file tiremo_sdk_client-0.1.3-py3-none-any.whl.
File metadata
- Download URL: tiremo_sdk_client-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d93882f05820b3c652f2cb6413f500c037910e869410228bf1c1702d0933109
|
|
| MD5 |
2350d39afc39e83c884d4b55a7cacfed
|
|
| BLAKE2b-256 |
d96ec7672da6efd4b17339778ecb7263c2766150e87ceb7f6d5871d8d4b7022a
|