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 IOError
s 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file watlow-0.8.0.tar.gz
.
File metadata
- Download URL: watlow-0.8.0.tar.gz
- Upload date:
- Size: 17.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18ce3ea08b23f94ab4baa7a1353feb9ce2bc01845643faa983d638cc39a096d5 |
|
MD5 | a6a4ce280230ecad0d64d03c5dbb6301 |
|
BLAKE2b-256 | 344a421d5f1229b775993026a54117383690b3112893f101c52e6754441303c6 |
File details
Details for the file watlow-0.8.0-py3-none-any.whl
.
File metadata
- Download URL: watlow-0.8.0-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11d9521532952f09bc9fdbd0d8d2aaffb7566a429a1d7c3303af3103c70b1c72 |
|
MD5 | 6fabe40d1f5d7ec2466710f625ee25c4 |
|
BLAKE2b-256 | 8e221f67359b4a8036a84a037565e34ad342f5c92b709b12afb98bfc76b41c76 |