feat: v2 event_count for Light/Door/Move/Reed; unified naming

This commit is contained in:
2026-07-03 18:17:48 +02:00
parent d432d9607e
commit 035d4fed26
3 changed files with 7 additions and 13 deletions
+5 -9
View File
@@ -98,18 +98,14 @@ def _decode_v2(b0: int, b1: int, b2: int, b3: int) -> dict:
result["temperature_c"] = round((temp_raw - 200) / 8, 2)
result["reed_switch"] = bool((b2 >> 6) & 0x01)
# Byte 3 depends on mode
if mode == 0: # Button — software version
# Byte 3 depends on mode (per v2 spec)
if mode == 0: # Button — software version (fw major.minor)
result["fw_major"] = (b3 >> 4) & 0x0F
result["fw_minor"] = b3 & 0x0F
elif mode == 1: # Temperature — humidity
elif mode == 1: # Temperature — humidity percentage
result["humidity_pct"] = round(b3 * 0.5, 1)
elif mode == 4: # Move — event count / status
result["move_events"] = b3
elif mode == 5: # Reed Switch — event count
result["reed_events"] = b3
else:
result["byte3_raw"] = b3
else: # Light, Door, Move, Reed Switch — number of alerts / events
result["event_count"] = b3
return result