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
}

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.5'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.2.1.tar.gz (7.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.2.1-py2.py3-none-any.whl (24.7 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: watlow-0.2.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

File hashes

Hashes for watlow-0.2.1.tar.gz
Algorithm Hash digest
SHA256 46a1811107a1499d2350c3674a90d79b8fcb37ddbf8d7e3c9371034884ebd66d
MD5 c282076019dd6038a0fd7b948ea80042
BLAKE2b-256 ef4f1a9ade682f321f81efbc20eb01ddc2c8b1d5c0f8e358dc19fb95aacc3aab

See more details on using hashes here.

File details

Details for the file watlow-0.2.1-py2.py3-none-any.whl.

File metadata

  • Download URL: watlow-0.2.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0.post20200106 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6

File hashes

Hashes for watlow-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e2db426a6b73b245c8deb9fba82c5a141e1e0cc81ecb75d74fc61f4ac7449cf6
MD5 fe4fd3a7cb2b94760b7909ae58bf60a4
BLAKE2b-256 baf79b06183ff43e49b84414e1542efc793d56d4754af459eceee2f5954bfabf

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