Skip to content

feat(s7commplus): add batched symbolic read - #871

Open
bvanelli wants to merge 3 commits into
gijzelaerr:masterfrom
bvanelli:feat/symbolic-multi-read
Open

feat(s7commplus): add batched symbolic read#871
bvanelli wants to merge 3 commits into
gijzelaerr:masterfrom
bvanelli:feat/symbolic-multi-read

Conversation

@bvanelli

@bvanelli bvanelli commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Introduces the read_symbolic_multi, which is a generalization of the read_symbolic. It is not only backwards compatible, but allows the user to read an entire range of variables with a single request. Tested against a real S7 1500, FW 2.9.8, using a batch of 20 variables.

The failure mode when you provide a rejected variable is to log the the hex error, handled by the _parse_read_response:

ERROR s7commplus.client: _parse_read_response: PLC returned error 0x20278000009A0013

Since the error is swallowed by the parser, there is a length check for the response, and if variables are missing, a Runtime is raised. This should only guard the occasion where the return is [], but the client expected variables.

bvanelli and others added 3 commits September 8, 2026 19:34
Reading several symbolically-addressed variables previously meant one
GetMultiVariables round-trip each. read_symbolic_multi packs every
address into a single request, which matters most for optimized blocks
on S7-1200/1500 where symbolic access is the only reliable path.

The existing single-variable builder now delegates to the batched one,
so both paths emit identical bytes for a one-item request. Export
SymbolicReadItem and DBWriteItem so callers can annotate against the
public package rather than reaching into s7commplus.client.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

2 participants