Skip to content

fix(z2m): revert raw target decoder to 9-byte stride / int8 id (v3.2.5)#49

Open
nickduvall921 wants to merge 1 commit into
mainfrom
fix/raw-target-stride-9-int8
Open

fix(z2m): revert raw target decoder to 9-byte stride / int8 id (v3.2.5)#49
nickduvall921 wants to merge 1 commit into
mainfrom
fix/raw-target-stride-9-int8

Conversation

@nickduvall921

Copy link
Copy Markdown
Owner

Summary

Reverts the legacy raw-bytes target decoder back to a 9-byte stride with a signed int8 id, mirroring upstream Z2M PR Koenkk/zigbee-herdsman-converters#12284 (merged 2026-05-23).

Background

  • The Inovelli 0xFC32 reportTargetInfo records are 9 bytes each: x, y, z, dop as little-endian int16 + id as a signed int8.
  • Inovelli's mmWave docs briefly described id as int16 (10-byte stride). Z2M implemented that in #11915 (2026-04-11), and we mirrored it in v3.2.4.
  • Inovelli corrected the docsid is int8 — and Z2M reverted via #12284. Math.floor(buf.length / 10) was 0 for 9-byte buffers, so the parsed mmwave_targets array was always [] under the broken 10-byte parse.
  • This PR realigns our raw fallback with real device traffic.

Changes

  • app.py_process_target_data: stride 10 → 9, byte-need check offset+9 → offset+8, id parsed via new parse_signed_8 instead of parse_signed_16.
  • utils.py — add parse_signed_8() helper (matches parse_signed_16 style + fault tolerance).
  • tests/test_parsing.py — +7 cases for parse_signed_8 (0, 1, 127, −1, −128, offset read, missing key).
  • config.yaml — version 3.2.4 → 3.2.5.
  • CHANGELOG.md[3.2.5] entry.

Impact

  • This path is dormant on Z2M ≥ 2.9 (gated off whenever parsed mmwave_targets is present, per 3.2.2), so it only affects pre-2.9 raw-fallback users, who now get correct coordinates again instead of garbage on target License? #2+.
  • The parsed-mmwave_targets path benefits directly from #12284: Z2M builds carrying that fix repopulate the array, so modern setups get live targets back.

Test plan

  • pytest tests/207 passed (200 + 7 new)
  • app.py parses / imports the new helper cleanly

🤖 Generated with Claude Code

Mirrors upstream herdsman-converters PR #12284 (merged 2026-05-23), which
reverted PR #11915. Inovelli's FC32 reportTargetInfo records are 9 bytes
(x, y, z, dop as int16 + id as signed int8), not 10 bytes with an int16 id.
v3.2.4 had mirrored the now-reverted #11915.

- app.py: stride 10 -> 9, byte-need check offset+9 -> offset+8,
  id parsed via new parse_signed_8 instead of parse_signed_16
- utils.py: add parse_signed_8 helper
- tests: +7 parse_signed_8 cases (207 passed)
- bump version 3.2.4 -> 3.2.5, CHANGELOG entry

Dormant on Z2M >= 2.9 (gated off when parsed mmwave_targets present);
fixes coordinates for pre-2.9 raw-fallback users.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant