fix(sfm): a MiniMate start's read-back reconnects once when the modem dropped the line (#9)
BE9441 over a modem, 2026-10-29: the start was acked, but the modem closed the line during the ~30 s sensor check, so the read-back's first wake hit '[Errno 32] Broken pipe' and the change was reported 503 'not checked' although the unit was monitoring. On an OSError in the read-back, a TCP unit is now reconnected once, its serial checked against the named unit, and its state read. Nothing is re-sent: the start still goes out exactly once. A serial cable is never reconnected (opening a MiniMate's port reboots it), a second failure or a silence (a cleanly closed line) ends 'not checked' as before, and a different unit after the reconnect is refused (409, change unconfirmed). Store consequence: none. 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
b320a534bc
commit
ce441a0911
3 files changed
+81
-2
No files matched your search
+21
-1
@@ -227,10 +227,30 @@ class Series3Adapter:
|
||||
settle.append(S3_SENSOR_CHECK_S) # the first read waits out the check
|
||||
return {"subs": [f"0x{ack_sub:02X}"]}
|
||||
|
||||
reconnected: list = []
|
||||
|
||||
def read_state() -> str:
|
||||
if settle:
|
||||
sleep(settle.pop())
|
||||
return _woken_state(client)
|
||||
try:
|
||||
return _woken_state(client)
|
||||
except OSError as exc:
|
||||
# The modem can drop the line while the unit sensor-checks
|
||||
# after a start: BE9441's first wake hit "[Errno 32] Broken
|
||||
# pipe" (2026-10-29), and a fresh connection read it as
|
||||
# monitoring. Reconnect once, TCP only (opening a MiniMate's
|
||||
# serial port reboots it), check it is still the same unit,
|
||||
# and read. A read -- nothing is re-sent.
|
||||
if reconnected or not address.host:
|
||||
raise
|
||||
reconnected.append(True)
|
||||
log.warning("Series 3 at %s: the line dropped during the read-back (%s) -- "
|
||||
"reconnecting to read the state; nothing is re-sent",
|
||||
address.key, exc)
|
||||
client.close()
|
||||
client.open()
|
||||
self._check(client.read_serial(), serial, address)
|
||||
return _woken_state(client)
|
||||
|
||||
return run_change(
|
||||
serial=serial, series=3, start=start, dry_run=dry_run,
|
||||
|
||||
Reference in new issue
Block a user