Skip to content

Apator HCA: align field decode with wmbusmeters apatoreitn driver - #4

Merged
i12bp8 merged 1 commit into
i12bp8:mainfrom
mac22:drivers/apator-hca-apatoreitn
Jul 9, 2026
Merged

Apator HCA: align field decode with wmbusmeters apatoreitn driver#4
i12bp8 merged 1 commit into
i12bp8:mainfrom
mac22:drivers/apator-hca-apatoreitn

Conversation

@mac22

@mac22 mac22 commented Jul 8, 2026

Copy link
Copy Markdown

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

  • previous/current HCA were swapped (b3-4 is previous per DIF storagenr 1, b7-8 is current);
  • temperature is two 16-bit /256 °C fields (prev-season and current-season room averages), not a single whole-degree byte with flag bytes around it;
  • the packed date was rendered as a raw "Marker" — now decoded, year base 2000;
  • season start date and ESB (electronic seal break) date were not decoded at all: season raw is 0xA000 | b0; a non-zero b5-6 means the seal was broken on the decoded date (shown as "Seal BROKEN" + date, otherwise "Seal OK").

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

@i12bp8
i12bp8 merged commit f8a287a into i12bp8:main Jul 9, 2026
2 checks passed
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