Python driver for AutomationDirect Productivity Series PLCs.
Project description
Productivity
NOTE: This is in very early stages of development.
Python ≥3.5 driver and command-line tool for AutomationDirect Productivity Series PLCs.
Installation
pip install productivity
Usage
PLC Configuration
This driver uses Modbus TCP/IP for communication. Unlike the ClickPLC, modbus addresses need to be manually configured in the Productivity PLC firmware (see manual).
To use this driver, go to Write Program → Tag Database
, scroll down to the values
you care about, and double click the Mod Start
cell of each value to assign an address.
Then, go to File → Export → Tags
to export a csv file. The file is used here so
you don't need to remember the addresses.
Command Line
$ productivity the-plc-ip-address path/to/tags.csv
See productivity --help
for more.
Python
This driver uses Python ≥3.5's async/await syntax to asynchronously communicate with a ClickPLC. For example:
import asyncio
from productivity import ProductivityPLC
async def get():
async with ProductivityPLC('the-plc-ip-address', 'path/to/tags.csv') as plc:
print(await plc.get())
asyncio.run(get())
It's possible to set coils and registers on the PLC as well using keyword arguments
async def set(**kwargs):
async with ProductivityPLC('the-plc-ip-address', 'path/to/tags.csv') as plc:
print(await plc.set(**kwargs))
asyncio.run(set(target=0, setpoint=1.1))
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
Hashes for productivity-0.3.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6673e24d282d1cb467d4b3cf9aac92a4afbd1e938ca16ae4fee2ef655f0f14fb |
|
MD5 | b3e36057946b68258db9e1cb8e4617e5 |
|
BLAKE2b-256 | fc36de5fbf07beead4a406340718a99062f580ab02d7f6f93db2b6d181c27556 |