Skip to content

Add extended S7CommPlus operations: browse, list DBs, TIA XML import#687

Merged
gijzelaerr merged 1 commit into
masterfrom
feature/s7commplus-extended-ops
Apr 15, 2026
Merged

Add extended S7CommPlus operations: browse, list DBs, TIA XML import#687
gijzelaerr merged 1 commit into
masterfrom
feature/s7commplus-extended-ops

Conversation

@gijzelaerr
Copy link
Copy Markdown
Owner

Summary

Implements features from #681, #682, #685, #686. All marked experimental.

S7CommPlus EXPLORE-based operations:

SymbolTable enhancements:

Example workflow:

from s7 import Client, SymbolTable

client = Client()
client.connect("192.168.1.10", 0, 1)

# Live symbol resolution (S7CommPlus)
symbols = SymbolTable.from_browse(client.browse())
value = symbols.read(client, "DB1.Motor1.Speed")

# Or from TIA Portal export
symbols = SymbolTable.from_tia_xml("DB1.xml")

PLC clock (#685): Already works via __getattr__ delegation — s7.Client delegates get_plc_datetime() / set_plc_datetime() to snap7.Client automatically.

Alarm/data subscriptions (#683, #684): Protocol IDs defined for subscriptions and alarms. Full implementation needs real PLC testing of the subscription CREATE_OBJECT flow — tracked in the issues.

Test plan

  • All 1433 existing tests pass
  • mypy and ruff clean
  • Test list_datablocks() against real PLC
  • Test browse() against real PLC
  • Test from_tia_xml() with real TIA Portal export

Closes #681, closes #682, closes #685, closes #686.

🤖 Generated with Claude Code

Implements features from issues #681, #682, #685, #686:

S7CommPlus EXPLORE-based operations (experimental):
- list_datablocks(): enumerate all DBs via EXPLORE, with legacy
  fallback to list_blocks_of_type (#686)
- browse(): walk PLC symbol table via EXPLORE to get variable names,
  DB numbers, and offsets — returns data for SymbolTable (#681)
- Structured EXPLORE request builder with attribute filters
- Response parsers for datablock info and field layout

SymbolTable enhancements (experimental):
- from_tia_xml(): parse TIA Portal DB source XML exports (#682)
- from_browse(): create SymbolTable from live PLC browse results (#681)

Protocol IDs added for EXPLORE, subscriptions, alarms:
- NATIVE_THE_PLC_PROGRAM_RID, OBJECT_VARIABLE_TYPE_NAME,
  BLOCK_BLOCK_NUMBER, CLASS_SUBSCRIPTION, alarm subscription IDs

s7.Client unified methods:
- list_datablocks() with S7CommPlus/legacy fallback
- browse() for live symbol resolution
- explore(explore_id) with specific object browsing

PLC clock (#685) already works via __getattr__ delegation to
snap7.Client.get_plc_datetime/set_plc_datetime.

Alarm subscriptions (#683) and data change subscriptions (#684) have
protocol IDs defined but full implementation requires real PLC testing
of the subscription CREATE_OBJECT flow.

All features marked experimental in docstrings.

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

Labels

None yet

Projects

None yet

1 participant