Skip to main content

A Python package that provides control of the H401-T-CONTROLLER temperature controller from Okolab

Project description

Okolab

This Python package provides control of the H401-T-CONTROLLER temperature controller from Okolab.

Installation

$ pip install okolab

# List available devices
$ python -m okolab

Usage

from okolab import OkolabDevice

device = OkolabDevice(address="COM3")
device = OkolabDevice(address="/dev/tty.usbmodem1101")
def on_close(*, lost):
  print(f"Connection closed, lost={lost}")

device = Device(address="COM3", on_close=on_close)
# Read temperature
temp = await device.get_temperature1()
temp = await device.get_temperature2()

# Write temperature
await device.set_temperature_setpoint1(37.0)
await device.set_temperature_setpoint2(37.0)
# Read in parallel
await asyncio.gather(
  device.get_temperature1(),
  device.get_temperature2()
)
from okolab import OkolabDeviceDisconnectedError, OkolabDeviceSystemError

# Catching errors
try:
  temp = await device.get_temperature1()
except OkolabDeviceDisconnectedError:
  # The device has been disconnected
except OkolabDeviceSystemError:
  # The device has reported an error
from okolab import OkolabDevice

infos = OkolabDevice.list()

for info in infos:
  device = info.create()
  print(await device.get_serial_number())

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

okolab-0.2.0.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

okolab-0.2.0-py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 3

Supported by

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