Skip to main content

s7commplus

Pure-Python S7CommPlus communication for Siemens S7-1200 and S7-1500 PLCs. It supports S7CommPlus V1, V2 (TLS), and V3; synchronous and asyncio clients; and a server emulator for testing. Both clients support legacy V1 SessionKey authentication, validated on a real S7-1200 (sync and async clients), an S7-1500 (sync client), and S7-PLCSIM Advanced (sync and async clients). The async runs used the connect frames the async client sent before #200; it now sends the sync client's CreateObject and SessionSetup frames, which have not yet been retested with AsyncClient on hardware.

Installation

Install the latest stable release from PyPI:

python -m pip install --upgrade s7commplus

See the s7commplus documentation for the complete user guide and API reference.

from s7commplus import Client

with Client() as client:
    client.connect("192.168.1.10", rack=0, slot=1)
    data = client.db_read(1, 0, 4)

Optimized blocks are read and written by tag name, as Python values; a struct, UDT or array name gives a dict or list:

with Client() as client:
    client.connect("192.168.1.10", use_tls=True, tls_ca="plc-ca.pem")  # verify the PLC certificate
    temperature = client.read_value("Data_block_1.temperature")
    client.write_value("Data_block_1.recipe", {"speed": 120, "name": "batch 7"})

S7CommPlus is used by newer S7-1200/1500 PLCs when classic PUT/GET access is disabled. This is an unofficial implementation and is not affiliated with, endorsed by, or supported by Siemens AG. Test against an isolated controller before using it in production or safety-relevant environments.

Some older PLCs advertise only their SessionKey family instead of a complete public-key fingerprint. Client and AsyncClient try the bounded set of bundled keys from that family on fresh sessions and cache the confirmed key for the PLC. Set allow_legacy_key_fallback=False on connect() when key probing must be disabled.

The order number a PLC reports during connect can be turned into a readable module name and family:

from s7commplus import device_family, device_name

device_name("6ES7 512-1DK01-0AB0")   # 'CPU 1512SP-1 PN'
device_family("6ES7 512-1DK01-0AB0")  # 's7-1500-sp'

DEVICE_NAMES holds the full table (S7-1200/1500 controllers, SIPLUS variants, software controllers and PLCSIM; classic S7-300/400 is out of scope). python tools/check_devices_table.py validates its shape.

Installing the package also installs a s7commplus command-line tool:

s7commplus browse --host 192.168.1.10
s7commplus read --host 192.168.1.10 DB1.Motor.Speed

See the command-line interface guide in the documentation.

Errors derive from S7Error, importable from the package root together with its subclasses. A request the PLC refuses, or a reply that does not answer every item, raises S7RequestError, which is also a RuntimeError:

from s7commplus import Client, S7RequestError

with Client() as client:
    client.connect("192.168.1.10", port=102)
    try:
        data = client.db_read(1, 0, 4)
    except S7RequestError as exc:
        print(f"The PLC refused the read: {exc}")

Development

Cloning the repository is only necessary for developing or testing s7commplus. To use the stable library in an application, install it from PyPI as shown above.

git clone https://github.com/gijzelaerr/s7commplus.git
cd s7commplus
python -m pip install -e '.[test,docs]'
pytest
mypy s7commplus
ruff check s7commplus tests
ruff format --check s7commplus tests

The published documentation is hosted on Read the Docs and validated in CI. To build it locally from a development checkout:

sphinx-build -W --keep-going -b html docs docs/_build/html

The V1 SessionKey implementation derives from HarpoS7; its MIT license is included at s7commplus/v1_session_key/LICENSE-HarpoS7. The zlib preset dictionaries in s7commplus/zlib_dicts/ come from S7CommPlusDriver (LGPL-3.0); see s7commplus/zlib_dicts/NOTICE-S7CommPlusDriver.

Metadata

Release files for s7commplus 0.7.0

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

Source distribution (sdist)

Source distribution for s7commplus 0.7.0
File Size Uploaded Provenance Actions
s7commplus-0.7.0.tar.gz 543.5 kB With provenance Details for s7commplus-0.7.0.tar.gz

Built distribution (wheel)

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

Total release size: 862.2 kB

Release files / s7commplus-0.7.0.tar.gz

Download URL s7commplus-0.7.0.tar.gz
Size 543.5 kB
Tags Source
SHA-256 checksum
How to use checksums
448b6fe98577b1ed115c0ee8b2933b927c012a026f06f5719147cf728a907b56
BLAKE2b-256 checksum
How to use checksums
24620e56af1a9d92b8fd263f72f076539a0c667e2455750243a0d697ef2b3261
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / s7commplus-0.7.0-py3-none-any.whl

Download URL s7commplus-0.7.0-py3-none-any.whl
Size 318.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1221af7afbc2e3d7fd868dc5f4dc329c1cfb72e26f79f341d5c46673a27a824
BLAKE2b-256 checksum
How to use checksums
4bf600a0f3b002ba4ff1167528a8c5b9383d947df32df4b03d0f3035729d2459
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for s7commplus 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for s7commplus-0.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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