fix(device_access): wake a MiniMate before every state read in a start/stop, so a start's read-back is answered
BE9441, 2026-10-26 23:41:48 (through the bridge): SFM's start (0x96, Blastware's own bytes) was acked 0x69 and the unit began monitoring -- Brian saw it -- but the read-back sent one bare 0x1C two seconds later and got nothing for 120 s, so the change reported 'sent and acknowledged, but reading the state back failed' (504, audit 0c1cf813). Nothing was retried. A monitoring MiniMate ignores a bare request until SESSION_RESET + POLL (measured 2026-04-08). The read-back had relied on the connect's wake; a stop's read-back (18:53, the unit idle by then) never needed it. Every state read in the change now goes through _woken_state: client.poll() (41 03, POLL, 41 03, POLL -- the connect's own sequence), then 0x1C. Test: after the send, every 0x1C read is preceded by a POLL. 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
6f2acc79e6
commit
9886422212
2 files changed
+26
-1
No files matched your search
+12
-1
@@ -43,6 +43,17 @@ def s3_run_state(status: Any) -> str:
|
||||
return S3_RUN_STATES.get(flag, f"unknown(0x{flag:02X})")
|
||||
|
||||
|
||||
def _woken_state(client: Any) -> str:
|
||||
"""The run state, read after waking the unit: SESSION_RESET + POLL first.
|
||||
|
||||
A monitoring MiniMate ignores a bare request until it is woken (measured
|
||||
2026-04-08). On 2026-10-26 BE9441 acked a start, then let a bare 0x1C go
|
||||
unanswered for 120 s -- the read-back had relied on the connect's wake,
|
||||
which a stop's read-back (the unit idle by then) never needed."""
|
||||
client.poll()
|
||||
return s3_run_state(client.get_monitor_status())
|
||||
|
||||
|
||||
def default_s3_client_factory(address: UnitAddress, timeout: Optional[float] = None) -> MiniMateClient:
|
||||
if address.host:
|
||||
return MiniMateClient(transport=TcpTransport(address.host, port=address.tcp_port),
|
||||
@@ -208,7 +219,7 @@ class Series3Adapter:
|
||||
even_if_already=even_if_already, audit=audit, address=address, caller=caller,
|
||||
sleep=sleep, verify_timeout_s=verify_timeout_s, verify_interval_s=verify_interval_s,
|
||||
read_serial=read_serial,
|
||||
read_state=lambda: s3_run_state(client.get_monitor_status()),
|
||||
read_state=lambda: _woken_state(client),
|
||||
describe_plan=describe_plan, send=send)
|
||||
return self._run(address, op, timeout=S3_EVENT_TIMEOUT, retry=False)
|
||||
|
||||
|
||||
@@ -771,3 +771,17 @@ def test_series3_a_cold_unit_during_a_change_is_not_retried():
|
||||
da.start_monitoring(TCP3, "BE18193")
|
||||
assert fake.writes == []
|
||||
assert len(da.factory_calls) == 1 # the change path never takes _run's retry
|
||||
|
||||
|
||||
# -- Series 3: a monitoring unit answers only after the wake ----------------------
|
||||
|
||||
def test_series3_wakes_the_unit_before_every_state_read():
|
||||
# BE9441, 2026-10-26 23:41: the start was acked, then one bare 0x1C read got
|
||||
# nothing for 120 s -- a monitoring unit ignores everything until SESSION_RESET
|
||||
# + POLL (measured 2026-04-08), which only the connect had sent.
|
||||
fake = FakeMiniMateClient(monitor_states=[False, True])
|
||||
r = access3(fake).start_monitoring(TCP3, "BE18193")
|
||||
assert r.outcome == "sent" and r.verified == "ok"
|
||||
after = fake.calls[fake.calls.index("start_monitoring") + 1:]
|
||||
reads = [i for i, c in enumerate(after) if c == "get_monitor_status"]
|
||||
assert reads and all(after[i - 1] == "poll" for i in reads)
|
||||
Reference in new issue
Block a user