From 992d0f4428954aa7590d454dd2c6c20e045b269b Mon Sep 17 00:00:00 2001 From: cw2007 Date: Wed, 15 Jul 2026 10:27:14 +0900 Subject: [PATCH] =?UTF-8?q?fix(sht30):=20=EC=98=A8=EC=8A=B5=EB=8F=84=20?= =?UTF-8?q?=EB=B3=B4=EA=B3=A0=20=EC=A3=BC=EA=B8=B0=EB=A5=BC=20=EB=85=B8?= =?UTF-8?q?=EB=93=9C=EB=B3=84=EB=A1=9C=20=E2=80=94=20=EB=88=84=EC=88=98?= =?UTF-8?q?=EC=AA=BD=2010=EB=B6=84,=20Pi-B=201=EC=8B=9C=EA=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) Claude-Session: https://claude.ai/code/session_01Nd7QvbgEWCjSQtUYnGNvvV --- raspberry_pi4_sht30/config.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/raspberry_pi4_sht30/config.py b/raspberry_pi4_sht30/config.py index d02a779..47d357f 100644 --- a/raspberry_pi4_sht30/config.py +++ b/raspberry_pi4_sht30/config.py @@ -99,9 +99,17 @@ try: from config_local import SENSOR_NAME # noqa: F811 — per-device display name override except ImportError: 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. 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}") if not (isinstance(SENSOR_NAME, str) and SENSOR_NAME): 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}")