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:
serversdownandClaude Opus 5.5 committed 2026-10-29 23:21:27 -04:00
1 parent b320a534bc
commit ce441a0911
3 files changed
+81 -2

No files matched your search

+11 -1
View File
@@ -75,9 +75,13 @@ def default_s3_events():
class FakeMiniMateClient(_Base):
def __init__(self, serial="BE18193", *, monitoring=False, compliance="default", events=None,
monitor_states=None, write_error=None, **kw):
monitor_states=None, write_error=None, serial_reported=None, wake_errors=None, **kw):
super().__init__(**kw)
self.serial = serial
# read_serial()'s answer (connect() keeps answering `serial`), and errors
# raised by wake() once a write has gone out -- the read-back's wakes.
self.serial_reported = serial if serial_reported is None else serial_reported
self.wake_errors = list(wake_errors or [])
self.monitoring = monitoring
self.monitor_states = list(monitor_states) if monitor_states else [monitoring]
self.write_error = write_error
@@ -107,6 +111,12 @@ class FakeMiniMateClient(_Base):
def wake(self, **kw) -> None:
self._step("wake")
if self.writes and self.wake_errors:
raise self.wake_errors.pop(0)
def read_serial(self) -> str:
self._step("read_serial")
return self.serial_reported
def get_monitor_status(self) -> MonitorStatus:
self._step("get_monitor_status")