POSA_LEAKSMS/raspberry_pi4/config_local.example.py
cw2007 a72ea18130 i18n(pi): Raspberry Pi 번들 소스 한글 → 영어 (콘솔 mojibake 해소)
헤드리스 Pi 콘솔/journalctl에서 한글이 깨져 보이는 문제로, Pi 번들(02/03/04)에 들어가는 모든 소스의 사람-대상 텍스트를 영어로 전환. 코드·식별자·설정키·경로·숫자·hex·서명 스킴·f-string 플레이스홀더는 불변.

- raspberry_pi4/, raspberry_pi4_sht30/: 로그·주석·문서·센서명·위치 영어화
- tools/make_deploy_bundles.py: 생성 템플릿(config_local.py/setup.sh/SETUP.md/PI_META 위치) 영어화
- tools/harden_pi.sh, tools/set_network.sh: echo/주석 영어화
- WIRING.html: 영어화 + SHT30 전압 경고 정정 반영
- 서버 번들(01, php/)은 한글 유지(브라우저 대시보드, Pi에서 안 깨짐)
- 전 파이썬/셸 문법검사 통과, JSON 본문 서명 무영향
2026-07-10 10:44:13 +09:00

49 lines
3.6 KiB
Python

# =============================================================================
# config_local.example.py - Operational/secret value template (Pi 4 leak detection module)
#
# Usage: cp config_local.example.py config_local.py
# → Fill in with real values, then save. Never commit config_local.py
# (excluded via .gitignore).
#
# ⚠️ Server compatibility
# This module (Module 1) reports to the "same" cafe24 server php/ as Module 2 (SHT30 temp/humidity) — integrated.
# For leak events (leak_alert / leak_recovery) and photo uploads, the server requires a raw-body signature:
# X-Signature = lowercase_hex(HMAC-SHA256(key=API_KEY, msg=request body bytes))
# photo upload canonical = device_id|sensor_id|log_id|timestamp (no spaces)
# → API_KEY must be "exactly identical" to the API_KEY in the server's config.local.php.
# The server DB is installed from the single sql/schema_sht30.sql (includes leak components),
# and leak status, photos, and temp/humidity are shown together on one dashboard (dashboard.php).
# (The legacy sha256(API_KEY + sorted JSON) body-field signature is deprecated — the server rejects it.)
# =============================================================================
# ─────────────────────────────────────────────
# Server API endpoints (integrated server = cafe24 php/, same server as Module 2)
# Web root per INSTALL_PI_SERVER.md: public_html/raspi_leck_detecter/
# ─────────────────────────────────────────────
API_URL = "https://YOUR_SERVER/raspi_leck_detecter/api/sensor_data.php"
PHOTO_UPLOAD_URL = "https://YOUR_SERVER/raspi_leck_detecter/api/photo_upload.php"
# ─────────────────────────────────────────────
# Shared secret key — must be exactly identical to the server-side API_KEY. Never commit.
# ─────────────────────────────────────────────
API_KEY = "CHANGE_ME"
# ─────────────────────────────────────────────
# Device identification (distinguishes multiple units)
# ─────────────────────────────────────────────
DEVICE_ID = "rpi4-leak-01"
DEVICE_LOCATION = "Server Room"
# ─────────────────────────────────────────────
# (Optional) Sensor list override — for new site nodes
# If undefined, uses the config.py default (SENSORS = [{"id": 1, ...}]).
# When deploying a new site (e.g. Pi-C, sensor_id 3), define it only in this file;
# the tracked file (config.py) does not need to be modified. For server dashboard card
# display, also update 'LEAK_SENSOR_IDS' => [1, 3] in the server's config.local.php.
# ⚠️ sensor_id must be unique per site — reusing 1/2 will silently overwrite the
# existing site's status (leak_sensor_status is keyed on sensor_id alone).
# ─────────────────────────────────────────────
# SENSORS = [
# {"id": 3, "gpio": 17, "name": "Sensor 3 (New Site)"},
# ]
# (When enabling the above, DEVICE_ID e.g. "rpi4-leak-02", and change DEVICE_LOCATION to the site name too)