fix(sfm): a ring or a refusal is never mistaken for a send; fresh serial pinned; unmeasured states refused

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-23 16:39:55 -04:00
1 parent eada7ba767
commit 14ea80f5a4
6 files changed
+166 -21

No files matched your search

+6 -1
View File
@@ -9,7 +9,7 @@ import threading
import time
from typing import Any, Callable, Dict, Optional
from .errors import ConnectFailed, DeviceError, NoAnswer, WrongUnit
from .errors import ConnectFailed, DeviceError, NoAnswer, NotSupported, WrongUnit
from .events import parse_event_id
from .locks import UnitLocks
from .models import ChangeResult, DownloadedEvent, EventList, UnitAddress, UnitInfo, UnitSettings, UnitStatus
@@ -39,6 +39,8 @@ class DeviceAccess:
verify_timeout_s: float = 60.0,
verify_interval_s: float = 2.0,
) -> None:
if verify_interval_s <= 0 or verify_timeout_s < verify_interval_s:
raise ValueError("verify_interval_s must be > 0 and verify_timeout_s >= verify_interval_s")
self._audit = audit
self._sleep = sleep
self._verify_timeout_s = verify_timeout_s
@@ -89,6 +91,9 @@ class DeviceAccess:
even_if_already=even_if_already, caller=caller)
def _change_monitoring(self, address, serial, *, start, dry_run, even_if_already, caller):
if not dry_run and self._audit is None:
raise NotSupported("no audit log is configured -- SFM refuses to change a unit "
"without one (nothing sent)")
kw = dict(start=start, dry_run=dry_run, even_if_already=even_if_already,
audit=self._audit, caller=caller, sleep=self._sleep,
verify_timeout_s=self._verify_timeout_s,