Skip to content

v1.1.0: scanning, secondary addressing, fixed frames, wireless M-Bus, CLI - #4

Merged
ichnograph merged 4 commits into
mainfrom
v1.1.0
Aug 1, 2026
Merged

v1.1.0: scanning, secondary addressing, fixed frames, wireless M-Bus, CLI#4
ichnograph merged 4 commits into
mainfrom
v1.1.0

Conversation

@ichnograph

Copy link
Copy Markdown

This release turns the library from a decoder into a full toolkit for reading M-Bus meters.

Bus scanning and secondary addressing

  • Client.ScanPrimary walks an address range with SND_NKE + REQ_UD2 and reports responders.
  • Client.ScanSecondary runs the standard wildcard search over the 8 BCD id digits, narrowing on collisions, and returns full secondary addresses (id, manufacturer, version, medium).
  • Client.SelectSecondary / Client.ReadBySecondary select a meter by secondary address (CI 0x52 to 0xFD, nibble wildcards) and read it. Networks with more than a handful of meters run on secondary addressing, so this was the biggest gap.

Fixed data response (CI 0x73)

Older meters answer with the fixed data structure instead of variable records. LongFrame.Decode now handles both: the two counters come back as ordinary records (counter 2 as storage 1, matching its at-the-fixed-date semantics), so the query API works unchanged. Invalid BCD sets ValueErr per the existing contract.

Wireless M-Bus: new wmbus package

Decode-only support for EN 13757-4 / OMS telegrams as receiver dongles deliver them:

  • link layer formats A and B with CRC-16 (poly 0x3D65) verification, plus ParseWithoutCRC for dongles that strip CRCs
  • TPL headers: none (0x78), short (0x7A), long (0x72)
  • security mode 0, mode 5 (AES-CBC per OMS 7.2.2) and mode 7 (AES-CMAC key derivation per OMS 7.2.4, CMAC implemented locally, stdlib only)
  • application payload decoded with the same record engine as the wired path, so DataRecords look identical
  • fuzz target extending the no-panic contract to wireless input

VIF extension type namespace fix

An 0xFD-table record carried its raw VIFE code in Unit.Type, so error flags (FD 17) decoded with the same type as a volume record and MatchType(VIFVolume) matched it. Extension types now carry a 0x100/0x200 offset, with exported VIFExt* constants and a regression test against the WaterStar capture that exposed it.

mbusctl

Full CLI over TCP and serial: scan (primary range or secondary wildcard), read (primary or secondary address, -all for multi-telegram meters), set-address, all with -json output per record. Errors to stderr, data to stdout, distinct exit codes.

Docs

  • 13 godoc examples, 9 with enforced output
  • README repositioned: pure-Go libmbus alternative, feature comparison, tested-hardware note
  • CHANGELOG.md in Keep a Changelog format

No breaking changes to the v1.0.0 API.

An 0xFD-table record carried its raw VIFE code in Unit.Type, so error
flags (FD 17) decoded with the same type as a volume record and
MatchType(VIFVolume) matched it. Extension types now carry the same
0x100/0x200 offset as the unit table keys, with exported VIFExt
constants for the common 0xFD codes. Also fixes the duration-of-tariff
code that collided with currency credit inside the extension map.
Comment thread cmd/mbusctl/addr.go
minPrimaryAddr, maxPrimaryAddr, addrSecondarySelect, addrBroadcastReply,
)
}
return uint8(value), nil
@ichnograph
ichnograph merged commit bc13ce8 into main Aug 1, 2026
11 of 12 checks passed
@ichnograph
ichnograph deleted the v1.1.0 branch August 1, 2026 15:10
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