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}")