Skip to content

v0.3.0 - PLC data dump I/O

Choose a tag to compare

@ssweber ssweber released this 26 Mar 17:18
· 8 commits to main since this release
c2707e6

PLC data dump I/O

New read_plc_data and write_plc_data functions handle the CSV format used by the Click Programming Software's Data > Read Data from PLC and Data > Write Data into PLC commands.

Read a PLC snapshot

from pyclickplc import read_plc_data

data = read_plc_data("data.csv")
# {"X001": True, "X002": True, "C1": True, "DS3": 1, "DH1": 895, ...}

# Only non-default values
data = read_plc_data("data.csv", skip_default=True)

Write back (with modifications)

from pyclickplc import read_plc_data, write_plc_data

data = read_plc_data("from_plc.csv")
data["DS3"] = 42
write_plc_data("to_plc.csv", data)

write_plc_data infers which banks to include from the data keys. Pass banks=["DS", "DF"] to control which sections appear in the output file.

Upgrading from v0.2

No breaking changes.