Issue: Tank 02 (บ่อเก็บน้ำใต้ดิน-K) percentage recalibration — InfluxDB discontinuity
- Date: 2026-06-30T14:20+07:00
- GitHub issue: racksync/obh-iot#1
- Status: Done (change applied & verified) — follow-ups open
- Area: Water system / Node-RED / InfluxDB / Grafana
- Owner: RACKSYNC (Damrongwit)
Summary
หัวข้อที่มีชื่อว่า “Summary”The underground K tank (tank 02 / Basement K, friendly name บ่อเก็บน้ำใต้ดิน-K)
level gauge capped at ~93% and never reached 100%. Root cause: the % is computed in
Node-RED, not the sensor — the divisor was the Sep-2024 calibrated depth 233 cm, but
the tank physically tops off rock-steady at ~218 cm every week for 4+ months (per
InfluxDB), so full only ever = 93%.
Fix applied: Node-RED node tank 02 : % (id 046d1f81a181a25f), divisor + clamp
233 → 218 (3 occurrences). Single source → propagates to MQTT water/tank/02/percent
→ sensor.water_tank_02_percentage_basement_k → HA / Grafana / Google Sheets.
Verified live: 191.59 cm now reads 88% (= 191.59/218) vs 82% under old 233.
Does it affect InfluxDB? — YES
หัวข้อที่มีชื่อว่า “Does it affect InfluxDB? — YES”sensor.water_tank_02_percentage_basement_k is logged to InfluxDB
(includes/influxdb.yaml:467, bucket hass, measurement %).
- Going forward: new points are stored using the new 218-based scale.
- Historical data is NOT recomputed. InfluxDB keeps the old 233-based values as-written.
- Result: a step discontinuity of ~+7% in the
percentageseries at the change timestamp (2026-06-30 ~14:20 +07:00). The same physical level reads ~7% higher after the change (e.g. a true-full tank: 93% before → ~100% after). - Unaffected series (calc not changed, no discontinuity):
water_tank_02_raw(mm),_cm_,_m_,_capacity_(L),_capacity_cubicm_(m³). Capacity = actual volume, independent.
Note: just after the Node-RED reload the moving-average/low-pass buffers reset, so the
%(and cm/m) series is briefly more volatile for ~5–10 min, then self-heals.
Update 2026-07-31 — follow-up 1 did NOT pass. The gauge tops out at 92%, because the measured level stepped down 17.39 cm at 2026-06-26 18:39 +07:00 — four days before this recalibration. The
218divisor was therefore derived from behaviour that had already stopped. The divisor itself is intact and computes correctly; the deficit is upstream (sensor or physical). See2026-07-31-tank02-level-step-drop.md/ #17. The last follow-up below (single-source calibration constant) is now planned as option D in #17.
Follow-ups to track
หัวข้อที่มีชื่อว่า “Follow-ups to track”-
Confirm the gauge reaches ~100% at the next full-fill (~218 cm) on Grafana.Not met — ceiling is 200.6 cm / 92%. Cause tracked in #17. - Review any Grafana panel / alert / annotation spanning 2026-06-30 — expect a ~+7%
step in the tank-02
%series; add a Grafana annotation at the change time. - Re-check any percentage-based thresholds that now mean a slightly different
physical level (the % scale shifted up ~7%): tap-water valve setpoints
input_number.setpoint_tapwater_tank2_max/min(75/60%) were left unchanged on purpose — valve rarely fires (level usually >75%), low impact, but re-tune if desired. -
low passmm/cm caps still2330(harmless — above the new 100% point); only thewater/tank/02/mm-lowpassMQTT topic is cosmetically off-scale. - Optional future hardening: refactor all tank-02 calibration constants to read a
single source (Node-RED global or HA
input_number) so future recalibration is one edit.
Backup / rollback
หัวข้อที่มีชื่อว่า “Backup / rollback”- Pre-change flows backup on HA host:
/addon_configs/a0d7b954_nodered/flows.json.bak-20260630-141727 - Rollback:
sudo cp <bak> /addon_configs/a0d7b954_nodered/flows.jsonthen reload the Node-RED addon via the Supervisor API (NOTdocker restart— that hits a mount error and stops the addon):TOKEN=$(sudo sh -c 'for p in /proc/[0-9]*/environ; do tr "\0" "\n" < $p 2>/dev/null; done' \| grep -m1 '^SUPERVISOR_TOKEN=' | cut -d= -f2)curl -s -X POST -H "Authorization: Bearer $TOKEN" http://supervisor/addons/a0d7b954_nodered/restart