Skip to content

Fix substrate calibration and add cube, slab and coco setup tools - #1

Merged
JakeTheRabbit merged 3 commits into
mainfrom
fix/substrate-calibration-workflow
Sep 9, 2026
Merged

Fix substrate calibration and add cube, slab and coco setup tools#1
JakeTheRabbit merged 3 commits into
mainfrom
fix/substrate-calibration-workflow

Conversation

@JakeTheRabbit

@JakeTheRabbit JakeTheRabbit commented Sep 9, 2026

Copy link
Copy Markdown
Owner

The existing configuration exposed generic VWC and an unsupported pore-EC blend as reliable measurements. This change separates a quick wet-reference index from weighed VWC, requires two reference points plus an independent third-point check, and withholds VWC during calibration, stale data and extrapolation. It also fixes flat-plateau detection, resets trends when measurement continuity changes, and prevents the CSV logger from presenting stale readings as new observations.

Adds an offline setup desk for cubes, shared slabs and coco containers, real metric block sizes, per-plant/zone volumes, weighed calibration records, placement drawings and actual-size print templates. Documentation, dashboards and migration notes now describe those measurements consistently. The irrigation blueprint requests a separately bounded controller shot with explicit enable/freshness gates.

Validation: 14 calculator tests, five repository checks, five logger tests and host assertions executing the actual firmware lambdas passed; all 11 device/factory/private+MQTT configurations validated; the Atom Lite factory firmware compiled with ESPHome 2026.8.2. Browser flows, CSV download, phone layout and A4 print geometry passed. All five factory board builds passed in CI, including artifact packaging. Physical probe calibration and controller commissioning remain installation checks; no device or live irrigation system was changed.

@JakeTheRabbit
JakeTheRabbit marked this pull request as ready for review September 9, 2026 04:47
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-09T04:58:20.821056Z ce8ed07 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce8ed0716c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/setup/calculator.js
positive(wet, "Wet assembly mass");
positive(volumeL, "Sample volume");
positive(density, "Water density");
if (wet < dry) throw new Error("Wet mass cannot be below dry mass.");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject zero-VWC calibration records

When the wet and dry assembly masses are equal, this check accepts the inputs, returns a 0% VWC result, and enables saving the calibration record. The corresponding firmware capture rejects v <= 0 in tdr_sdi12_core.yaml, so a record produced by the setup desk cannot be entered as A, B, or C; reject equal masses here to keep the setup workflow consistent with the device.

Useful? React with 👍 / 👎.

Comment thread lovelace/dashboard.yaml

- binary_sensor.tdr_sensor_vwc_ready
- binary_sensor.tdr_sensor_sensor_data_fresh
- sensor.tdr_sensor_calibration_status

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use text_sensor domains for textual entities

When this dashboard is pasted into Home Assistant, Calibration status is created by the core package as a text_sensor, so sensor.tdr_sensor_calibration_status does not exist. The same domain mismatch affects sensor.tdr_sensor_water_trend on line 22 and sensor.tdr_sensor_last_calibration_action on line 62, leaving all three dashboard rows unavailable; reference them with the text_sensor. domain.

Useful? React with 👍 / 👎.

sorting_group_id: sg_analytics
lambda: |-
if (!id(g_has_irrigated)) return NAN;
return (uint32_t)(millis()-id(g_last_irr_ms))/60000.0f;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use a nonwrapping clock for irrigation age

If the device remains up for more than one 32-bit millis() period (about 49.7 days) without another detected wetting, this subtraction wraps modulo 2^32 and Time Since Irrigation drops back to a small value instead of continuing to increase. Unlike the short freshness and plateau timers, this duration is unbounded, so it needs a 64-bit monotonic timestamp or explicit saturation across repeated rollovers.

Useful? React with 👍 / 👎.

@JakeTheRabbit
JakeTheRabbit merged commit 2eff9df into main Sep 9, 2026
7 checks passed
@JakeTheRabbit
JakeTheRabbit deleted the fix/substrate-calibration-workflow branch September 9, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant