ข้ามไปยังเนื้อหา

OBH-IoT Water Management System

No Location Shape Dimensions FULL value (calibration) Helper entity (adjustable)
01 บ่อเก็บน้ำใต้ดิน อ.หมอบริกส์ (Basement B) ถังกลม (cylindrical) Radius 11m 340 cm input_number.tank01_full_level_cm
02 บ่อเก็บน้ำใต้ดิน อ.หมอกัมพล (Basement K) สี่เหลี่ยม (rectangular) 10m x 10m 197.05 cm (2026-11-10) input_number.tank02_full_level_cm
03 บ่อเก็บน้ำดาดฟ้า อ.หมอกัมพล (Roof K) สี่เหลี่ยม (rectangular) 6m x 8m 140 cm input_number.tank03_full_level_cm
04 บ่อเก็บน้ำดาดฟ้า อ.หมอบริกส์ (Roof B) สี่เหลี่ยม (rectangular) 7.5m x 10m 180 cm input_number.tank04_full_level_cm

The % of every tank = round(cm ÷ FULL × 100) where FULL is no longer hardcoded in Node-RED — it lives in the four input_number.*_full_level_cm helpers above (shown on the Debug dashboard → WATER tab). Each helper feeds a Node-RED global (tankXX_full_cm) via a poll-state/change pair on the Global 🔵 tab; the tank XX : % function reads it with a hardcoded fallback.

To recalibrate any tank (no restart, no code edit):

  1. Measure the real full level on site (dipstick) — never guess from charts
  2. Move the slider (HA UI or Debug→WATER card) to the measured cm value
  3. Done — the % scale changes within ~1 min; HA Logbook records who/when/from-to
  4. Verify next day: % reaches 100 at full and never exceeds 100

Tank 02 FULL history: 233 (Oct 2023) → 218 (2026-06-30, #1) → 200.6 (2026-07-31, #17 mitigation) → 197.05 (2026-11-10, owner decision = 7-day observed max; dipstick validation still pending). Root cause of the sagging ceiling remains open — see issue 2026-11-09-tank02-calibration-round2.md.

⚠️ Do not add initial: to these helpers in includes/input_number.yaml — YAML helpers with initial: reset to it on every HA restart (incident 2026-11-10). Without it, slider values persist across restarts.

Component IP Description
Controller 194.1.1.121 Pump relay control
Temp & Door 194.1.1.122 Cabinet temperature & door sensor
Mode Light 194.1.1.131 Status indicator
Component IP Description
Controller 194.1.1.123 Pump relay control
Temp & Door 194.1.1.133 Cabinet temperature & door sensor
Mode Light 194.1.1.132 Status indicator
Parameter Pump 1 Pump 2
Pump ON threshold Water level < 90% Water level < 90%
Pump OFF threshold Water level = 100% Water level = 100%
Safety: WiFi disconnect Power OFF (Tasmota rule) Power OFF (Tasmota rule)
Safety: MQTT disconnect Restart device (Tasmota rule) Restart device (Tasmota rule)
  • Pump ON/OFF events
  • Cabinet temperature > 30°C
  • Cabinet door opened
  • Overload magnetic trigger
  • Timer safety valve WiFi disconnect
  • Status ON/OFF logged to Grafana

Scheduled 3x daily: 8:00 AM, 12:00 PM, 4:00 PM

  • Underground tanks: xxxx_basement_b, xxxx_basement_k
  • Rooftop tanks: xxxx_roof_b, xxxx_roof_k
# GPIO Pin Assignments
D3 = switch1 = manual mode
D1 = switch2 = timer mode
D2 = switch3 = iot mode
D5 = switch4 = overload
# Interlock (modes 1-3 mutually exclusive, overload independent)
interlock 1,2,3
poweronstate 3
switchmode1 2
# Auto-restart on MQTT disconnect
rule1 ON MQTT#Disconnected DO restart 1 ENDON
Rule1 1
# Power off on WiFi disconnect
rule2 ON WIFI#Disconnected DO power off ENDON
Rule2 1

The water tank monitoring system uses a Node-RED flow (136 nodes) to process sensor data:

  1. Home Assistant entity state change → Function nodes (calibration/conversion)
  2. Processed data published to MQTT topics

Each tank (wt-01 through wt-06) publishes 6 topics:

Topic Unit Description
water/tank/{01-06}/m meters Raw distance measurement
water/tank/{01-06}/cm cm Centimeters
water/tank/{01-06}/percent % Fill percentage
water/tank/{01-06}/capacity/L liters Volume in liters
water/tank/{01-06}/capacity/cubicM m³ Volume in cubic meters
water/tank/{01-06}/mm-lowpass mm Low-pass filtered millimeters
  • 55 function nodes (calibration/conversion logic)
  • 36 MQTT output nodes
  • 10 HA state-change listeners
  • 16 change nodes (global variable storage)
  • 4 poll-state nodes, 4 debug nodes, 4 inject nodes

Daily max stuck at 98 % for 45+ days; ceiling sagged 201→197 cm as a smooth drift since ~Sep 10 (noise signature unchanged — not sensor chaos; no discrete steps; plateaued late Oct). Fixed 2026-11-10 by the helper mechanism above (197.05, owner decision, chart-derived — dipstick still pending to validate). Details: issues/2026-11-09-tank02-calibration-round2.md.

Tank 01’s MQTT sensors are availability-gated on water/tank/01/LWT, relayed from tele/OBH-WATER-TANK-01_7422F8/LWT — the retired device topic (chip swapped to tank 6, Dec 2024). After each Node-RED restart the tank shows unavailable until the refresher + a value change bring it back (~1–9 min). Fix someday: repoint the relay to the live device topic or drop the gate. Same LWT-relay pattern exists for tanks 02–04 — their device topics should be verified current.

Two stacked causes: ① the summary chain dies at a missing subflow definition in Notify : Water (instance exists, definition gone since ≤ 2026-07-31 — messages vanish silently, all 3 daily times), ② HA 2026.5 notify schema rejects title in payloads (proven via On Test! 08:00 daily error and pump-start photo alerts). Revival needs all three parts together: rewire past the dead subflow + gate, guard the 1-second poll-state (telegram_notify), remove title. Also broken by ②: the other 7 legacy platform: telegram channels + telegram_bot.send_photo paths. Tracked in the round-2 issue doc §2b.

Around every Node-RED restart/deploy (±10 min), raw streams pick up brief zero frames and the filtered % dips (observed as low as 32 % for ~2 min) then slews back within ~5 min. Verified 3/3 restarts. Not a water event. Triage: dip inside a deploy window = ignore · dip outside with normal raw = recheck in 10 min · raw low/zero outside a deploy window = report (details: issues/2026-11-09-tank02-calibration-round2.md §15).

2026-11-04 ~11:00–14:00 +07: tank 03 raw read 0 continuously (~3 h) and tank 04 raw showed erratic dips in the same window (both roof tanks; basement tanks clean). Pre-dates all Nov-10+ work. Not a drain (filtered 45.78 cm minimum inherited from the outage). Cause unknown — if it recurs outside a deploy window, inspect the roof sensors/bridges on site.

Tank K water levels showed anomalies. Grafana data: Basement K at 76-100% (mean 91.5%, 177-232cm), Rooftop K at 32-100% (mean 90.8%, 21.6-67.2 m³).

Replaced Tank 1 ESP chip with Tank 6’s chip, firmware updated. Tank 6 pending new ESP32 and sensor replacement.

  • Digital flow meter (1.5 inch) for each pump
  • 3-phase current measurement for pump peak monitoring
  • Tap water emergency auto-fill system (already partially implemented)