A python client for the Thermocktat, a lightweight, multi-protocol thermostat emulator.
Project description
Thermocktat client
A http client for thermocktat.
Thermocktat = mock + thermostat
It emulates a thermostat device with realistic controls and temperature simulation, and supports many control protocols (http, mqtt, modbus, bacnet, knx...).
It is primarily design to test and demo Building Management Systems (BMS) software.
This lib is a lightweight wrapper around its http API.
See the source repo for details.
Installation
uv add thermocktat-client # or: pip install thermocktat-client
Usage
Sync
from thermocktat_client import ThermocktatSync
with ThermocktatSync.connect("http://localhost:8080") as tmk:
print(tmk.snapshot.temperature_setpoint)
tmk.set_temperature_setpoint(23.5)
tmk.set_mode("cool")
print(tmk.snapshot.mode)
Async
import asyncio
from thermocktat_client import ThermocktatAsync
async def main():
async with await ThermocktatAsync.connect("http://localhost:8080") as tmk:
print(tmk.snapshot.temperature_setpoint)
await tmk.set_temperature_setpoint(23.5)
await tmk.set_mode("cool")
asyncio.run(main())
Pure construction (no network on init)
__init__ is side-effect-free. Call .sync() (or use .connect(...), which combines construct + sync) before reading .snapshot, otherwise properties raise NotSyncedError.
tmk = ThermocktatSync("http://localhost:8080")
tmk.sync()
print(tmk.snapshot)
Injecting a custom httpx client
Useful for auth, retries, or sharing a connection pool. The client is the caller's to close.
from httpx import Client
from thermocktat_client import ThermocktatSync
external = Client(headers={"Authorization": "Bearer ..."})
tmk = ThermocktatSync.connect("http://...", client=external)
# external.close() when you're done
Contributing
See CONTRIBUTING.md.
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 thermocktat_client-0.3.0.tar.gz.
File metadata
- Download URL: thermocktat_client-0.3.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69daabf461a2e922ee6a28519017a46b099d2b7160dff1908e630c03fd6a2b82
|
|
| MD5 |
ee9890d9d113a902f6345108b68a6829
|
|
| BLAKE2b-256 |
beb30d9de4024b206abf05cf6421b6447a4c93eb919068d18d73c757a3b54440
|
Provenance
The following attestation bundles were made for thermocktat_client-0.3.0.tar.gz:
Publisher:
release-python-client.yaml on Agrid-Dev/thermocktat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
thermocktat_client-0.3.0.tar.gz -
Subject digest:
69daabf461a2e922ee6a28519017a46b099d2b7160dff1908e630c03fd6a2b82 - Sigstore transparency entry: 1342529678
- Sigstore integration time:
-
Permalink:
Agrid-Dev/thermocktat@e53fa30dc83e6d5490ca09faf700999ccf2896ba -
Branch / Tag:
refs/tags/python-client/v0.3.0 - Owner: https://github.com/Agrid-Dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python-client.yaml@e53fa30dc83e6d5490ca09faf700999ccf2896ba -
Trigger Event:
push
-
Statement type:
File details
Details for the file thermocktat_client-0.3.0-py3-none-any.whl.
File metadata
- Download URL: thermocktat_client-0.3.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f35001f2feb60c8957e13340d641cb17215dce00d9b57d05e064cf220b5f028f
|
|
| MD5 |
20f64e0a335836ff45a31c0411757704
|
|
| BLAKE2b-256 |
352adf4610c55b967bd0e5959af80411fe4d2a8db78267ea65155d340867025a
|
Provenance
The following attestation bundles were made for thermocktat_client-0.3.0-py3-none-any.whl:
Publisher:
release-python-client.yaml on Agrid-Dev/thermocktat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
thermocktat_client-0.3.0-py3-none-any.whl -
Subject digest:
f35001f2feb60c8957e13340d641cb17215dce00d9b57d05e064cf220b5f028f - Sigstore transparency entry: 1342529690
- Sigstore integration time:
-
Permalink:
Agrid-Dev/thermocktat@e53fa30dc83e6d5490ca09faf700999ccf2896ba -
Branch / Tag:
refs/tags/python-client/v0.3.0 - Owner: https://github.com/Agrid-Dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python-client.yaml@e53fa30dc83e6d5490ca09faf700999ccf2896ba -
Trigger Event:
push
-
Statement type: