Skip to main content

Python driver for Watlow EZ-Zone temperature controllers.

Project description

watlow

Python driver and command-line tool for Watlow EZ-Zone temperature controllers.

Installation

pip install watlow

Usage

Command Line

$ watlow /dev/ttyUSB0

This returns a simple data structure.

{
  "actual": 21.66,
  "setpoint": 20.0,
  "output": 52.1
}

You can additionally use the --set-setpoint option to set a temperature setpoint.

If interacting with a Watlow RUI Gateway, the zone to get or set should be passed as a flag

$ watlow -z 1 192.168.1.101

See watlow --help for more.

Python

Single Controller

For a single temperature controller, the python interface is basic synchronous serial communication.

import watlow

tc = watlow.TemperatureController('/dev/ttyUSB0')

tc.set(30)
print(tc.get())

The driver is designed to be fault tolerant over long polling, and should appropriately reconnect if its IOErrors are managed. Here's an implementation with standard long-poll exception handling. This should run until interrupted and then exit cleanly.

from time import sleep
import watlow

tc = watlow.TemperatureController('/dev/ttyUSB0')
try:
    while True:
        try:
            print(tc.get())
        except IOError:
            print('disconnected')
        sleep(1)
except KeyboardInterrupt:
    pass
finally:
    tc.close()

Gateway

The Gateway driver uses Python ≥3.7's async/await syntax to asynchronously communicate with the gateway over ModBus-TCP.

import asyncio
import watlow

async def run():
    async with watlow.Gateway('192.168.1.101') as gateway:
        print(await gateway.get(1))

asyncio.run(run())

Additionally, there is a mock for the Gateway driver available at watlow.mock.Gateway for testing.

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

watlow-0.5.3.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

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

watlow-0.5.3-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file watlow-0.5.3.tar.gz.

File metadata

  • Download URL: watlow-0.5.3.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.16

File hashes

Hashes for watlow-0.5.3.tar.gz
Algorithm Hash digest
SHA256 de333f144e61afb28baaa6b41d2af009fde38cd44b427cc8c6311e719dfcd988
MD5 7d05c8d81746a3918d53fc5706afb508
BLAKE2b-256 d9b2d108f9cd6e7065a4c0af8daa6d24d44a5b9cb46615c57d025689698b3803

See more details on using hashes here.

File details

Details for the file watlow-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: watlow-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.16

File hashes

Hashes for watlow-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d86ac868d302ff7c36076b3fc32c27d89ed361df82a2d86baca67de3c3a0a138
MD5 bcbbb1b1bfbef499e178833f40a43e41
BLAKE2b-256 4eb91eff5e170d1a169f55b7427a16e4de80b51a677b9311317602e1548db272

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