Skip to main content

Relay and control for tessie

Project description

tessie relay

A relay and control server for tessie MQTT messages.

Installation

This project uses uv for management and currently uses Python 3.11.

Running

pip install tessie_relay

Example script:

from tessie_relay.psi_coldbox import Coldbox
from time import sleep

def handle_error_message(error_payload):
    """
    Custom callback to handle "Error" messages.
    :param error_payload: The parsed "Error" payload
    """
    print("WARNING: Error detected!")
    print(error_payload)


if __name__ == "__main__":

    # initialize the Coldbox controller and provide a callback for alarms
    coldbox = Coldbox(host='coldbox02.psi.ch', error_callback=handle_error_message)

    with coldbox:
        coldbox.flush()
        print("air temperature    ", coldbox.get_air_temperature())
        print("water temperature  ", coldbox.get_water_temperature())
        print("interlock status   ", coldbox.get_interlock_status(timeout=10))
        print("traffic light      ", coldbox.get_traffic_light())
        print("flow switch        ", coldbox.get_flow_switch())
        print("lid                ", coldbox.get_lid_status())
        channel = 8
        print(f"voltage probes for channel {channel} = ", coldbox.get_voltage_probe(channel)) 

        try:
            while True:
                print("relative humidity ", coldbox.get_relative_humidity())
                sleep(10)
        except KeyboardInterrupt:
            print('interrupted!')

    print("shutting down")

Development

Important: for local development, please make sure to always prepend uv.

After changes have been made to the library (which means code in the src directory), update the local tessie_relay installation as follows:

uv pip install -e .

Then to test your changes, take e.g. the code in examples/run_coldbox.py and make the changes that would test the code. Then run:

uv run examples/run_coldbox.py

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

tessie_relay-0.1.3.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

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

tessie_relay-0.1.3-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file tessie_relay-0.1.3.tar.gz.

File metadata

  • Download URL: tessie_relay-0.1.3.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.4

File hashes

Hashes for tessie_relay-0.1.3.tar.gz
Algorithm Hash digest
SHA256 cb29f1478e6361a609920d53f28177027a1d7e80b1a25fa0f7d23ba557778bdb
MD5 34dc0a19ad4238ab815d47a71ed02137
BLAKE2b-256 6f81f2e1e7313f86fcfed0e7a137d0b1625393af800891ffbea7ddcdbb4395e6

See more details on using hashes here.

File details

Details for the file tessie_relay-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for tessie_relay-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c76d9ab060768ded2950cb46d768a19c97cd9ecfcd6a89390148f1a398473d2e
MD5 aaf38245686a0c62275f04bd6165eff0
BLAKE2b-256 37047b270e612c61c5b035cc828bde5cd5c53f69569502df4194b08349cf6d44

See more details on using hashes here.

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