Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thermocktat_client-0.3.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thermocktat_client-0.3.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

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

Hashes for thermocktat_client-0.3.0.tar.gz
Algorithm Hash digest
SHA256 69daabf461a2e922ee6a28519017a46b099d2b7160dff1908e630c03fd6a2b82
MD5 ee9890d9d113a902f6345108b68a6829
BLAKE2b-256 beb30d9de4024b206abf05cf6421b6447a4c93eb919068d18d73c757a3b54440

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermocktat_client-0.3.0.tar.gz:

Publisher: release-python-client.yaml on Agrid-Dev/thermocktat

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file thermocktat_client-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for thermocktat_client-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f35001f2feb60c8957e13340d641cb17215dce00d9b57d05e064cf220b5f028f
MD5 20f64e0a335836ff45a31c0411757704
BLAKE2b-256 352adf4610c55b967bd0e5959af80411fe4d2a8db78267ea65155d340867025a

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page