fix(minimateplus): the 0x1C status reads a histogram run as monitoring, and unescapes before counting from the end
Measured on BE9441 tonight, through the recording bridge: - Monitoring flag 0x0B while recording a histogram (confirmed at the unit), 0x00 idle. Only 0x10 had been measured as monitoring (BE11529, 2026-04-08), so the status showed 'not monitoring' and the change path refused the state as unknown(0x0B) -- refused, not skipped, which is the design working. 0x0B joins S3_RUN_STATES and S3_MONITORING_FLAGS as measured. The shared status's 'monitoring' now follows the change path's reading: None for an unmeasured flag, never a guessed False. - Free memory 0x000D0E04 arrived as 0d 0e 10 04. The parser keeps the 10 of a 10 02/03/04 escape, so every field counted from the end read one byte off: 419.84 V and 251,655,168 bytes for 6.76 V and 983,028. New framing.unescape_reply() (also used by parse_strt_end_key) runs first. Tests: the two recorded replies (idle 16:24, monitoring 18:47) decode to the unit's own values; each escaped value in the last ten bytes decodes; the status mapping for 00 / 10 / 0B / unmeasured. No codec, store or DB change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
This commit is contained in:
1 parent
8acb9512a9
commit
d990466407
5 files changed
+114
-16
No files matched your search
@@ -686,10 +686,17 @@ def test_series3_state_names_come_from_the_raw_flag(flag, state):
|
||||
assert r.state_before == state
|
||||
|
||||
|
||||
@pytest.mark.parametrize("flag,monitoring", [(0x00, False), (0x10, True), (0x0B, True), (0x07, None)])
|
||||
def test_series3_status_shows_the_change_paths_reading(flag, monitoring):
|
||||
# 0x0B: BE9441 recording a histogram (2026-10-26) once showed "not monitoring"
|
||||
st = access3(FakeMiniMateClient(monitor_states=[flag])).status(TCP3, "BE18193")
|
||||
assert st.monitoring is monitoring
|
||||
|
||||
|
||||
def test_series3_monitor_status_decode_keeps_the_raw_flag():
|
||||
from minimateplus.client import _decode_monitor_status
|
||||
tail = bytes.fromhex("02a8000effc0000e9e52") # battery + memory: the last 10 bytes
|
||||
for flag, monitoring in ((0x00, False), (0x10, True), (0x07, False)):
|
||||
for flag, monitoring in ((0x00, False), (0x10, True), (0x0B, True), (0x07, False)):
|
||||
st = _decode_monitor_status(bytes(11) + bytes([0x00, flag]) + bytes(34) + tail)
|
||||
assert (st.state_flag, st.is_monitoring) == (flag, monitoring)
|
||||
assert _decode_monitor_status(bytes(12)).state_flag is None # no section[1]
|
||||
|
||||
Reference in new issue
Block a user