Skip to content

ssweber/pyclickplc

Repository files navigation

pyclickplc

Talk to AutomationDirect CLICK PLCs from Python. Async Modbus TCP client/server, address helpers, nickname CSV and DataView CDV file I/O.

Install

uv add pyclickplc
# or
pip install pyclickplc

Requires Python 3.11+.

Quick example

import asyncio
from pyclickplc import ClickClient

async def main():
    async with ClickClient("192.168.1.10", 502) as plc:
        # Read and write registers with native Python types
        await plc.ds.write(1, 100)
        ds1 = await plc.ds[1]          # int
        await plc.y.write(1, True)     # bool
        df1 = await plc.addr.read("DF1")  # float

asyncio.run(main())

No PLC on hand? The quickstart uses ClickServer to simulate one locally.

What's included

Modbus clientClickClient reads and writes PLC values as native Python types (bool, int, float, str). Access by bank (plc.ds), by address string (plc.addr), or by tag name (plc.tag).

Modbus serviceModbusService wraps the async client for sync and UI applications with background polling and auto-reconnect.

Modbus serverClickServer simulates a CLICK PLC over Modbus TCP. Use it for development and testing without hardware.

File I/O — Read and write CLICK nickname CSV and DataView CDV files. Compatible with CLICK programming software and ClickNick.

Learn more

Quickstart Connect, read/write, simulate a traffic light
Client guide Bank accessors, address strings, tags
Types & values Native Python types per bank family
Addressing Normalization, sparse X/Y, XD/YD display indexing
File I/O Nickname CSV and DataView CDV
Examples Runnable scripts

Development

uv sync --all-extras --dev    # Install dependencies
make test                     # Run tests (uv run pytest)
make lint                     # Lint (codespell, ruff, ty)
make docs-build               # Build docs (mkdocs + mkdocstrings)
make docs-serve               # Serve docs locally
make                          # All of the above

About

Utilities for AutomationDirect CLICK PLCs: Modbus TCP client/server, address helpers, nickname CSV I/O, and DataView CDV I/O.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors