feat(sfm): opt-in raw SUB 0x49 code on a Series-4 status read

GET /device/monitor/status?serial=UM...&run_state=true adds
detail.run_state = {code, name}.  For the ring-path bench test: the code
during and after a call-home (0x01 for ~18 s after a stop, inferred to be
call-home attempts; 0x03 = calling home) is what the test watches.  Opt-in
because it is one more round trip (~0.65 s on cellular); a plain status read
is unchanged.  Series 3 has no 0x49 and ignores it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
This commit is contained in:
serversdownandClaude Opus 5.5 committed 2026-10-29 13:15:44 -04:00
1 parent 2560ef4586
commit ee02874cb0
5 files changed
+32 -5

No files matched your search

+4 -1
View File
@@ -1234,6 +1234,8 @@ def device_monitor_status(
tcp_port: int = Query(DEFAULT_TCP_PORT, description=f"TCP port (default {DEFAULT_TCP_PORT})"),
force: bool = Query(False, description="Bypass cache and re-read from device"),
serial: Optional[str] = Query(None, description=_SERIAL_DOC),
run_state: bool = Query(False, description="With a UM serial: also read SUB 0x49 "
"(one more round trip) and return its raw code in detail.run_state"),
) -> dict:
"""
Read monitoring status from the device.
@@ -1251,7 +1253,8 @@ def device_monitor_status(
"""
if serial:
return _via_device_access(
lambda: _device_access().status(_unit_address(port, baud, host, tcp_port), serial))
lambda: _device_access().status(_unit_address(port, baud, host, tcp_port), serial,
run_state=run_state))
baud = 38400 if baud is None else baud
cache = get_cache()
conn_key = SFMCache.make_conn_key(host, tcp_port, port, baud)