snap7-cli-0.1.1 is not a library.
snap7-cli
Command-line tool for communicating with Siemens S7 PLCs. Pure Rust — no FFI, no native C dependency. Read/write data blocks, watch tags, upload blocks, query SZL, and run an OPC-UA gateway — all from the terminal.
Part of the rs-snap7 workspace.
Install
# Main CLI
# Simulated PLC (for local testing)
# Sensor simulator (live-updating REAL values)
# OPC-UA tools (requires opcua feature)
Global flags
snap7 [FLAGS] <SUBCOMMAND>
-H, --host <HOST> PLC IP address
-p, --port <PORT> TCP port [default: 102]
-r, --rack <RACK> Rack number [default: 0]
-s, --slot <SLOT> Slot number [default: 1]
-f, --format <FORMAT> Output format: text|json|csv [default: text]
-t, --timeout-secs <SECS> Connect timeout [default: 5]
--tls Use TLS (S7CommPlus encrypted mode)
--tls-ca <PATH> PEM CA cert for TLS verification
--udp Use UDP transport
Subcommands
read — raw DB read
write — raw DB write (hex bytes)
tag — typed read/write
watch — poll a DB region
block — upload or list blocks
szl — query system status list
diag — connection diagnostics
serve — OPC-UA gateway (requires opcua feature)
See snap7-opcua-gateway for config format.
Output formats
All subcommands honour -f:
Local testing with the simulator
# Terminal 1 — simulated PLC on port 10200
# Terminal 2
# → DE AD BE EF
Tag address syntax
DB<n>,<type><byte-offset>
DB<n>,<byte-offset>.<bit>
| Type | Width | Example |
|---|---|---|
REAL |
4 B | DB1,REAL0 |
DINT |
4 B | DB1,DINT4 |
DWORD |
4 B | DB1,DWORD4 |
INT |
2 B | DB1,INT8 |
WORD |
2 B | DB1,WORD8 |
BYTE |
1 B | DB1,BYTE10 |
| bit | 1 bit | DB1,332.0 |
License
MIT — see LICENSE.