From d53292d6f7fb863b4f54e585d0fb07e7457d63c3 Mon Sep 17 00:00:00 2001
From: Jan Grewe <jan@faked.org>
Date: Sat, 13 Jul 2024 22:36:13 +0200
Subject: [PATCH] allow EC calibration with extreme sensor readings

---
 packages/water_ec.yaml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/packages/water_ec.yaml b/packages/water_ec.yaml
index 0afe6a2..8c41b8d 100644
--- a/packages/water_ec.yaml
+++ b/packages/water_ec.yaml
@@ -45,10 +45,12 @@ button:
       - then:
         - lambda: |-
             float buffer_solution = -1;
-            if (id(ec).state > 0.9 && id(ec).state < 1.9) {         //  recognize 1.413us/cm buffer solution
+            // if (id(ec).state > 0.9 && id(ec).state < 1.9) {         //  recognize 1.413us/cm buffer solution
+            if (id(ec).state < 1.9) {         //  recognize 1.413us/cm buffer solution
               ESP_LOGI("ec", "Calibrating EC with 1.413 mS/cm solution");
               buffer_solution = 1.413 * (1.0 + 0.0185 * (id(water_temperature).state - 25.0));
-            } else if (id(ec).state > 9 && id(ec).state < 16.8) {  // recognize 12.88ms/cm buffer solution
+            // } else if (id(ec).state > 9 && id(ec).state < 16.8) {  // recognize 12.88ms/cm buffer solution
+            } else if (id(ec).state > 9) {  // recognize 12.88ms/cm buffer solution
               buffer_solution = 12.88 * (1.0 + 0.0185 * (id(water_temperature).state - 25.0));
               ESP_LOGI("ec", "Calibrating EC with 12.88 mS/cm solution");
             } else {
-- 
GitLab