A project to facilitate easy read/write to the ControlByWeb line of Automation/SCADA IO products.
Project description
ControlPyWeb
A project to facilitate easy read/write to the ControlByWeb line of Automation/SCADA IO products.
Description
Xytronic Research makes a handy line of remote IO products useful for home and industrial automation. Interacting with these modules generally requires the use of a url library such as requests, and then requires dissecting the response to be dissected and processed. While not terribly difficult to do, it is repetitive.
This module seeks to abstract out some of that effort in a thought out and tested way.
Installation
pip install controlpyweb
Usage
The basis of functionality is the WebIOModule class. It both acts as a container for individual IO and handles interaction with the hardware.
from controlpyweb.webio_module import WebIOModule
from controlpyweb.single_io import DiscreteIn, DiscreteOut, AnalogIn, AnalogOut
class X404DigitalIn(WebIOModule): # Name the class whatever you like
StartButton = DiscreteIn("Start Button", "startButton")
StopButton = DiscreteIn("Stop Button", "stopButton")
DoorClosed = DiscreteIn("Door Closed", "doorClosed")
class X410DigitalOut(WebIOModule):
StartLamp = DiscreteOut("Start Lapm", "redLamp")
MaintLight = DiscreteOut("Maintenance Lamp", "lamp1")
digital_in = X404DigitalIn("192.168.1.1")
relay_out = X410DigitalOut("192.168.1.2")
digital_in.update_from_module()
relay_out.StartLamp = digital_in.StartButton
relay_out.MaintLight = not digital_in.DoorClosed
relay_out.send_changes_to_module()
Immediate reads/writes are supported
relay_out.StartLamp.write_immediate(True)
is_started = digital_in.read_immediate()
(However, immediate reads/writes are costly from a resource perspective and should be avoided.)
Overrides are common for typical operations
if discrete_in.StartButton and discrete_in.DoorClosed:
discrete_out.StartMachine = True
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 controlpyweb-0.1.0.tar.gz
.
File metadata
- Download URL: controlpyweb-0.1.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45b0956cc85d4dff31f616a8479b7ae4fff82167041086b6182d1b95363d83d2 |
|
MD5 | c65b1049ee291a4c175c8ed8dd655d47 |
|
BLAKE2b-256 | f98947bab5aa11c0892f819953eda705ec834b449dacc48bdf66fd664952218d |
File details
Details for the file controlpyweb-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: controlpyweb-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52f5b75b2dfa9e545a95f35d07348785c1e0bb3023b4edb021fc60451e52dbf5 |
|
MD5 | 9d14452b4aa59ea1010f1fc0fa79b779 |
|
BLAKE2b-256 | fb000f3bc25fdcafcfdaa1299831dbafe9e877a96315a4211e6cba22c3e73c57 |