Apator HCA: align field decode with wmbusmeters apatoreitn driver - #4
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the ad-hoc Apator heat cost allocator (E-ITN) decode with a 1:1 port of the authoritative wmbusmeters apatoreitn driver (drivers/src/apatoreitn.xmq, verified against wmbusmeters 3.0.0 analyze output and against the on-meter display).
Payload map (CI=0xA0 mfct-specific, 15 bytes)
b0 season_start_date_lo (packed date raw = 0xA000 | lo)
b1-2 pad
b3-4 previous_hca uint16 LE (DIF 0x42, storagenr 1)
b5-6 esb_date_raw uint16 LE, 0 = seal intact
b7-8 current_hca uint16 LE (DIF 0x02, storagenr 0)
b9-10 current_date packed date
b11-12 temp_room_prev_avg /256 °C (matches on-meter display)
b13-14 temp_room_avg /256 °C
Packed date (year base 2000, same for all three date fields): day = raw % 32, month = (raw >> 5) % 16, year = 2000 + (raw >> 9) % 32.
All three frame wrappings from the upstream grammar are accepted: bare 15 bytes, 0xA0-prefixed, and the CI=0xB6 form 0xA0<15 bytes>.
Fixes vs the previous decode
Field naming follows apatoreitn (current/previous HCA, season start, ESB, temp_room_prev_avg/temp_room_avg) so output stays comparable with upstream.
Tests
tests/test_apator_hca.c now covers the two telegrams from the upstream apatoreitn.xmq test suite (direct frame with broken seal, CI=0xB6 wrapped frame), the 0xA0-prefixed variant, a field-verified live capture (APDU only, no meter ID), and the bad-length fallback. make -C tests check passes.
🤖 Generated with Claude Code