From 7cd8fda5e8ada03af188a0e661a856fc71842f41 Mon Sep 17 00:00:00 2001 From: Brian Harrison Date: Fri, 3 Apr 2026 15:28:51 -0400 Subject: [PATCH] feat: add logging for raw event index bytes and decoded count in event count decoder --- minimateplus/client.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/minimateplus/client.py b/minimateplus/client.py index bcae5de..a6e3d22 100644 --- a/minimateplus/client.py +++ b/minimateplus/client.py @@ -475,6 +475,12 @@ def _decode_event_count(data: bytes) -> int: log.warning("event index payload too short (%d bytes), assuming 0 events", len(data)) return 0 + # Log the raw bytes so we can verify this decode against known event counts + log.warning( + "event_index raw (first 16 bytes): %s", + " ".join(f"{b:02x}" for b in data[:16]), + ) + # Try the uint32 at +3 first count = struct.unpack_from(">I", data, 3)[0] @@ -485,6 +491,7 @@ def _decode_event_count(data: bytes) -> int: ) return 0 + log.warning("event_index decoded count=%d (uint32 BE at offset +3)", count) return count