Repository navigation
v2.3.0
Date: 2026-07-06
Previous release: v2.2.4
Summary
Adds typed codec decoding to the client: a new client decode command reads holding/input registers and decodes them into typed values (integers, floats, strings, BCD, time, IP, MAC, …) using the github.com/otfabric/go-modbus/codec registry, plus a client codecs command to discover available codecs. As part of this, the ad-hoc --ascii and --byteswap flags are removed from client read, which now focuses on raw capture and MCAP output. This is a breaking change for anyone using those two read flags.
Highlights
client decode(new): Reads holding (FC3) or input (FC4) registers and decodes them with a single--codec(e.g.float32/layout:1234,ascii/registers:8,uint32/layout:4321,ip_addr,datetime_iec870_utc). The codec sets the per-value register width; omit--countto decode one value, or pass a multiple of the codec width to decode an array of values. Output honors--format text|json|table; JSON emits a typedvaluesarray. No MCAP side effect—decode is a read-and-interpret command.client codecs(new): Lists every registered codec (id, name, family, value kind, registers, bytes), with optional--family,--value-kind, and--registersfilters and--format text|json|table. Mirrors the codec catalog exposed by the Modbus simulator server.- Codecs source: The codec registry ships inside the already-depended-on
github.com/otfabric/go-modbus(v1.1.0) under thecodecsubpackage—no new dependency and no version bump were required. - Completion: New
--codecflag supports tab completion (registered codec IDs);--functioncompletion is reused ondecode. - Config / env: New
MODBUSCTL_CODECenvironment variable maps to--codec;MODBUSCTL_COUNTgains decode semantics (a multiple of the codec width;0= one value). client read(breaking): Removed--ascii/MODBUSCTL_ASCIIand--byteswap/MODBUSCTL_BYTESWAP. ThereadJSON DTO dropspre_swap_hex,bytes_swapped, andascii_decoded;readstill captures raw bytes (raw_data_hex) and writes MCAP.
Upgrading
- Replace
read --ascii: Useclient decode --codec ascii/registers:N(orascii_fixed/ascii_reverse/utf16be/utf16levariants) for text decoding. - Replace
read --byteswap: Use a layout-aware numeric codec viaclient decode(e.g.--codec uint32/layout:2143) instead of swapping bytes on a raw read. - Scripts parsing
read --format json: Stop relying onpre_swap_hex,bytes_swapped, andascii_decoded; move typed interpretation toclient decodeand read itsvaluesarray. - Completion users: Regenerate and re-source your shell completion script so the new
decode/codecscommands and--codeccandidates are available.
Release workflow
- Unchanged from v2.2.4: reusable
go-binary-releaseworkflow and link-time version metadata.