Skip to content

Add missing S7CommPlus operations: area read/write, explore, invoke#679

Merged
gijzelaerr merged 1 commit intomasterfrom
feature/s7commplus-operations
Apr 15, 2026
Merged

Add missing S7CommPlus operations: area read/write, explore, invoke#679
gijzelaerr merged 1 commit intomasterfrom
feature/s7commplus-operations

Conversation

@gijzelaerr
Copy link
Copy Markdown
Owner

Summary

Adds S7CommPlus operations that S7CommPlusDriver (C#) implements but we were missing:

  • read_area / write_area for controller memory areas (M, I, Q, counters, timers) — previously only DB access was supported via S7CommPlus
  • explore(explore_id) — browse specific objects by RID, not just root
  • set_plc_operating_state(state) — start/stop PLC via INVOKE function code

Both sync (S7CommPlusClient) and async (S7CommPlusAsyncClient) clients updated. Request/response builders are shared module-level functions.

Feature comparison with S7CommPlusDriver after this PR

Feature python-snap7 S7CommPlusDriver
Protocol V1/V2/V3
DB read/write
Area read/write (M/I/Q) ✓ new
Multi-variable read/write
Explore (browse) ✓ enhanced
Set PLC operating state ✓ new
TLS 1.3
Authentication
Async client
Server emulation
Alarm subscriptions
Link operations
V4

Note: Link operations (ADD_LINK, REMOVE_LINK) and sequencing (BEGIN_SEQUENCE, END_SEQUENCE) are not implemented in S7CommPlusDriver either — function codes are defined but unused.

Test plan

  • All 1344 existing tests pass
  • mypy and ruff clean
  • Test area read/write against real PLC (needs M/I/Q access)
  • Test set_plc_operating_state against real PLC

🤖 Generated with Claude Code

Add operations that S7CommPlusDriver (C#) implements but we were missing:

- read_area/write_area for controller memory areas (M, I, Q, counters,
  timers) — previously only DB access was supported via S7CommPlus
- explore(explore_id) — browse specific objects, not just root
- set_plc_operating_state(state) — start/stop PLC via INVOKE function

Both sync and async clients updated. Request/response builders are
module-level functions shared between both clients.

Note: Link operations (ADD_LINK, REMOVE_LINK, GET_LINK) and sequencing
(BEGIN_SEQUENCE, END_SEQUENCE) are defined in protocol.py but not
implemented by S7CommPlusDriver either — these are rarely used features.

Reference: thomas-v2/S7CommPlusDriver (C#, LGPL-3.0)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gijzelaerr gijzelaerr merged commit 2593978 into master Apr 15, 2026
38 checks passed
@gijzelaerr gijzelaerr added this to the 4.0 milestone Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant