From: David Woodhouse <dwmw@amazon.co.uk>
Date: Fri, 10 Nov 2023 12:24:21 +0000 (+0000)
Subject: Filter out zero temperatures too
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=31a0b23e1a2161b79f3ca2aca53182756e7f3c0e;p=users%2Fdwmw2%2Fesp32-pool.git

Filter out zero temperatures too
---

diff --git a/pool.yaml b/pool.yaml
index ebb8779..cc0b41b 100644
--- a/pool.yaml
+++ b/pool.yaml
@@ -68,7 +68,7 @@ script:
         auto outtemp = id(solar_out).state;
         auto intemp = id(solar_in).state;
 
-        if (isnan(outtemp) || isnan(intemp))
+        if (isnan(outtemp) || isnan(intemp) || outtemp == 0.0 || intemp == 0.0)
           return;
 
         // We consumed this reading pair.
@@ -410,23 +410,36 @@ sensor: #### Template sensor as their values are publish from a lambda or the BL
     address: 0xd4030497940a0e28
     name: "Solar in"
     id: solar_in
+    filters:
+      filter_out: 0.0
     on_value:
       then:
         lambda: |-
-           id(solar_in_fails) = 0;
-           id(tell_domo_svalue)->execute(507, std::to_string(x));
-           id(control_valve)->execute();
+           if (x != 0.0) {
+             id(solar_in_fails) = 0;
+             id(tell_domo_svalue)->execute(507, std::to_string(x));
+             id(control_valve)->execute();
+           }
 
   - platform: dallasng
     address: 0xa0031397941af528
     name: "Solar out"
     id: solar_out
+    filters:
+      filter_out: 0.0
     on_value:
       then:
        - lambda: |-
-           id(solar_out_fails) = 0;
-           id(tell_domo_svalue)->execute(508, std::to_string(x));
-           id(control_valve)->execute();
+           if (x != 0.0) {
+             id(solar_out_fails) = 0;
+             id(tell_domo_svalue)->execute(508, std::to_string(x));
+             id(control_valve)->execute();
+           }
+
+  - platform: dallasng
+    address: 0x39666b9c1e64ff28
+    name: "Shed temperature"
+    id: shed_temp
 
 #  - platform: dallasng
 #    address: 0xc603156332b8ff28