watlow


Namewatlow JSON
Version 0.6.2 PyPI version JSON
download
home_pagehttps://github.com/numat/watlow/
SummaryPython driver for Watlow EZ-Zone temperature controllers.
upload_time2023-12-08 18:23:03
maintainerAlex Ruddick
docs_urlNone
authorPatrick Fuller
requires_python
licenseGPLv2
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # watlow
Python driver and command-line tool for [Watlow EZ-Zone temperature controllers](https://www.watlow.com/en/products/controllers/temperature-and-process-controllers/ez-zone-pm-controller).

<p align="center">
  <img src="https://www.watlow.com/-/media/images/products/new--controllers/integrated-multi-function/tp_pm_480.ashx" />
</p>

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.

```python
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.

```python
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.

```python
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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/numat/watlow/",
    "name": "watlow",
    "maintainer": "Alex Ruddick",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "alex@numat-tech.com",
    "keywords": "",
    "author": "Patrick Fuller",
    "author_email": "pat@numat-tech.com",
    "download_url": "https://files.pythonhosted.org/packages/b9/6e/f51936103556f32be45065e7de400b230701bd9dcfb1ecabb60c23564910/watlow-0.6.2.tar.gz",
    "platform": null,
    "description": "# watlow\nPython driver and command-line tool for [Watlow EZ-Zone temperature controllers](https://www.watlow.com/en/products/controllers/temperature-and-process-controllers/ez-zone-pm-controller).\n\n<p align=\"center\">\n  <img src=\"https://www.watlow.com/-/media/images/products/new--controllers/integrated-multi-function/tp_pm_480.ashx\" />\n</p>\n\nInstallation\n============\n\n```\npip install watlow\n```\n\nUsage\n=====\n\n### Command Line\n\n```\n$ watlow /dev/ttyUSB0\n```\n\nThis returns a simple data structure.\n\n```\n{\n  \"actual\": 21.66,\n  \"setpoint\": 20.0,\n  \"output\": 52.1\n}\n```\n\nYou can additionally use the `--set-setpoint` option to set a temperature setpoint.\n\nIf interacting with a Watlow RUI Gateway, the zone to get or set should be passed as a flag\n```\n$ watlow -z 1 192.168.1.101\n```\n\nSee `watlow --help` for more.\n\n### Python\n\n#### Single Controller\n\nFor a single temperature controller, the python interface is basic synchronous serial communication.\n\n```python\nimport watlow\n\ntc = watlow.TemperatureController('/dev/ttyUSB0')\n\ntc.set(30)\nprint(tc.get())\n```\n\nThe driver is designed to be fault tolerant over long polling, and should\nappropriately reconnect if its `IOError`s are managed. Here's an implementation\nwith standard long-poll exception handling. This should run until interrupted and\nthen exit cleanly.\n\n```python\nfrom time import sleep\nimport watlow\n\ntc = watlow.TemperatureController('/dev/ttyUSB0')\ntry:\n    while True:\n        try:\n            print(tc.get())\n        except IOError:\n            print('disconnected')\n        sleep(1)\nexcept KeyboardInterrupt:\n    pass\nfinally:\n    tc.close()\n```\n\n#### Gateway\n\nThe Gateway driver uses Python \u22653.7's async/await syntax to asynchronously communicate with\nthe gateway over ModBus-TCP.\n\n```python\nimport asyncio\nimport watlow\n\nasync def run():\n    async with watlow.Gateway('192.168.1.101') as gateway:\n        print(await gateway.get(1))\n\nasyncio.run(run())\n```\n\nAdditionally, there is a mock for the Gateway driver available at `watlow.mock.Gateway` for testing.\n",
    "bugtrack_url": null,
    "license": "GPLv2",
    "summary": "Python driver for Watlow EZ-Zone temperature controllers.",
    "version": "0.6.2",
    "project_urls": {
        "Homepage": "https://github.com/numat/watlow/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dfbd61c64dc995b34b9a260e6fa4bffffe5d0e648e5e4b6650b01973d888bcb8",
                "md5": "3b4fe3f0bd09290a0cbf3586c8e70785",
                "sha256": "0b12a3c114820fed392f6210338e839839208bd3e0a85b42d4a1c4322d2a79f6"
            },
            "downloads": -1,
            "filename": "watlow-0.6.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3b4fe3f0bd09290a0cbf3586c8e70785",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 16528,
            "upload_time": "2023-12-08T18:23:01",
            "upload_time_iso_8601": "2023-12-08T18:23:01.779566Z",
            "url": "https://files.pythonhosted.org/packages/df/bd/61c64dc995b34b9a260e6fa4bffffe5d0e648e5e4b6650b01973d888bcb8/watlow-0.6.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b96ef51936103556f32be45065e7de400b230701bd9dcfb1ecabb60c23564910",
                "md5": "a4868aae02edcb1f992966592afeb4cd",
                "sha256": "3230472cd0fdb872a5c30b826f1690fc158d1f69701c10cb3989adee68a7d2ab"
            },
            "downloads": -1,
            "filename": "watlow-0.6.2.tar.gz",
            "has_sig": false,
            "md5_digest": "a4868aae02edcb1f992966592afeb4cd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 17260,
            "upload_time": "2023-12-08T18:23:03",
            "upload_time_iso_8601": "2023-12-08T18:23:03.079039Z",
            "url": "https://files.pythonhosted.org/packages/b9/6e/f51936103556f32be45065e7de400b230701bd9dcfb1ecabb60c23564910/watlow-0.6.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-08 18:23:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "numat",
    "github_project": "watlow",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "watlow"
}
        
Elapsed time: 0.14840s