Skip to main content

clickplc

Python driver and command-line tool for Koyo Ethernet ClickPLCs.

Installation

uv pip install clickplc

Usage

Command Line

$ clickplc the-plc-ip-address

This will print all the X, Y, DS, and DF registers to stdout as JSON. You can pipe this as needed. However, you'll likely want the python functionality below.

Python

This uses Python async/await syntax to asynchronously communicate with a ClickPLC. For example:

import asyncio
from clickplc import ClickPLC

async def get():
    async with ClickPLC('the-plc-ip-address') as plc:
        print(await plc.get('df1-df500'))

asyncio.run(get())

The entire API is get and set, and takes a range of inputs:

>>> await plc.get('df1')
0.0
>>> await plc.get('df1-df20')
{'df1': 0.0, 'df2': 0.0, ..., 'df20': 0.0}
>>> await plc.get('y101-y316')
{'y101': False, 'y102': False, ..., 'y316': False}

>>> await plc.set('df1', 0.0)  # Sets DF1 to 0.0
>>> await plc.set('df1', [0.0, 0.0, 0.0])  # Sets DF1-DF3 to 0.0.
>>> await plc.set('y101', True)  # Sets Y101 to true

Currently, the following datatypes are supported:

x bool Input point R
y bool Output point RW
c bool (C)ontrol relay RW
t bool (T)imer R
ct bool (C)oun(t)er R
ds int16 (D)ata register, (s)ingle signed int RW
dd int32 (D)ata register, (d)double signed int RW
dh uint16 (D) register, (h)ex RW
df float (D)ata register, (f)loating point RW
td int16 (T)ime (d)elay register RW
ctd int32 (C)oun(t)er Current Values, (d)ouble int RW
sd int16 (S)ystem (D)ata register R*
txt char (T)e(xt) RW

* Note: Only certain System Data registers are writeable.

Tags / Nicknames

Recent ClickPLC software provides the ability to export a "tags file", which contains all variables with user-assigned nicknames. The tags file can be used with this driver to improve code readability. (Who really wants to think about modbus addresses and register/coil types?)

To export a tags file, open the ClickPLC software, go to the Address Picker, select "Display MODBUS address", and export the file.

Once you have this file, simply pass the file path to the driver. You can now set variables by name and get all named variables by default.

async with ClickPLC('the-plc-ip-address', 'path-to-tags.csv') as plc:
    await plc.set('my-nickname', True)  # Set variable by nickname
    print(await plc.get())  # Get all named variables in tags file

Additionally, the tags file can be used with the commandline tool to provide more informative output:

$ clickplc the-plc-ip-address tags-filepath

Metadata

Release files for clickplc 0.14.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clickplc 0.14.2
File Size Uploaded
clickplc-0.14.2.tar.gz 22.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clickplc 0.14.2
File Interpreter ABI Platform
clickplc-0.14.2-py3-none-any.whl Python 3 none any Details

Total release size: 43.5 kB

Release files / clickplc-0.14.2.tar.gz

Download URL clickplc-0.14.2.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b4cba911b0b8f71a9e7a511b41ddbf72518cf67273fdbe744448f4762ced04cf
BLAKE2b-256 checksum
How to use checksums
6e850334b044e499be80d6a7f7b8497ea7501eca7f2c7599bd222b3076087c09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / clickplc-0.14.2-py3-none-any.whl

Download URL clickplc-0.14.2-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d655f35d56a5e393f5b61d42f5625795b78ba7b52b4278719b02ea4c11b030f6
BLAKE2b-256 checksum
How to use checksums
81aafb00f12495cd178a92f5d20122f8c512e50311a0428899ac2e8d71c1550e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.14.2 This release

2 release files

0.14.1

2 release files

0.13.0

2 release files

0.10.0

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

1 release file

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page