fix(sht30): 온습도 보고 주기를 노드별로 — 누수쪽 10분, Pi-B 1시간

REPORT_INTERVAL 을 config_local 로 오버라이드 가능하게 확장(양의 정수 검증).
누수 노드 co-센서(id 1/3)는 config_local 에서 600s(10분, 누수 노드 주기와 정합),
독립 Pi-B(sensor2)는 config.py 기본 3600s(1시간) 유지. 하드코딩 대신 config_local
로 노드별 지정 → config.py 드리프트 방지.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nd7QvbgEWCjSQtUYnGNvvV
This commit is contained in:
cw2007 2026-07-15 10:27:14 +09:00
parent 0b1e86c84a
commit 992d0f4428

View file

@ -99,9 +99,17 @@ try:
from config_local import SENSOR_NAME # noqa: F811 — per-device display name override from config_local import SENSOR_NAME # noqa: F811 — per-device display name override
except ImportError: except ImportError:
pass pass
try:
# Per-device report cadence. Leak-node co-sensor (id 1/3) reports every 600s (10 min)
# to match the leak node's cadence; the standalone Pi-B (sensor2) keeps the 3600s (1 h) default.
from config_local import REPORT_INTERVAL # noqa: F811 — per-device report interval override
except ImportError:
pass
# Validate (fail closed) — a typo must not silently start with a wrong/plausible id. # Validate (fail closed) — a typo must not silently start with a wrong/plausible id.
if not (isinstance(SENSOR_ID, int) and 1 <= SENSOR_ID <= 255): if not (isinstance(SENSOR_ID, int) and 1 <= SENSOR_ID <= 255):
raise RuntimeError(f"SENSOR_ID must be int 1..255 (check config_local.py): {SENSOR_ID!r}") raise RuntimeError(f"SENSOR_ID must be int 1..255 (check config_local.py): {SENSOR_ID!r}")
if not (isinstance(SENSOR_NAME, str) and SENSOR_NAME): if not (isinstance(SENSOR_NAME, str) and SENSOR_NAME):
raise RuntimeError("SENSOR_NAME must be a non-empty string (check config_local.py).") raise RuntimeError("SENSOR_NAME must be a non-empty string (check config_local.py).")
if not (isinstance(REPORT_INTERVAL, int) and REPORT_INTERVAL > 0):
raise RuntimeError(f"REPORT_INTERVAL must be a positive int (seconds) (check config_local.py): {REPORT_INTERVAL!r}")