]> www.infradead.org Git - users/dwmw2/esp32-pool.git/commitdiff
Avoid rewriting flow temp
authorDavid Woodhouse <dwmw@amazon.co.uk>
Fri, 18 Oct 2024 20:41:58 +0000 (21:41 +0100)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Fri, 18 Oct 2024 20:41:58 +0000 (21:41 +0100)
heishamon.yaml

index 78a10fd63a942bcd5b984a41807ba0f5d6056512..306aca8dce741bcf3673d95576d084f03788f8c0 100644 (file)
@@ -435,8 +435,11 @@ globals:
   - id: target_flow_temp
     type: float
     restore_value: no
+  - id: last_set_flow_temp
+    type: float
+    restore_value: no
 
-# Don't make the flow temp jump up too quickly. Only let it get 2°C higher than the
+# Don't make the flow temp jump up too quickly. Only let it get 3°C higher than the
 # actual flow temp, to avoid firing up both heat pumps if the heat demand from the
 # house isn't smooth enough.
 script:
@@ -448,10 +451,22 @@ script:
          if (!set_next || !id(auto_flow_temp).state)
            return;
          float cur_flow_temp = id(hp_feed_temp).state;
-         if (set_next > cur_flow_temp + 2.0)
-           set_next = cur_flow_temp + 2.0;
-         ESP_LOGI("Evohome", "Flow temp set to %f °C (want %f °C)", set_next, id(target_flow_temp));
-         id(ecodan_instance).set_flow_target_temperature(set_next, esphome::ecodan::SetZone::ZONE_1);
+         if (set_next > cur_flow_temp + 3.0) {
+           set_next = cur_flow_temp + 3.0;
+           // Always ratchet it up, don't let it go down if the actual flow temp does.
+           if (set_next < id(last_set_flow_temp))
+             set_next = id(last_set_flow_temp);
+           // But not above the target.
+           if (set_next > id(target_flow_temp))
+             set_next = id(target_flow_temp);
+         }
+         if (set_next == id(last_set_flow_temp)) {
+           ESP_LOGI("Evohome", "Flow temp already set to %f °C (cur %f °C, want %f °C)", set_next, cur_flow_temp, id(target_flow_temp));
+         } else {
+           ESP_LOGI("Evohome", "Flow temp set to %f °C (cur %f °C, want %f °C)", set_next, cur_flow_temp, id(target_flow_temp));
+           id(ecodan_instance).set_flow_target_temperature(set_next, esphome::ecodan::SetZone::ZONE_1);
+           id(last_set_flow_temp) = set_next;
+         }
 
 # relay
 switch:
@@ -500,5 +515,5 @@ interval:
   - interval: 30s
     then:
     - lambda: |-
-        if (id(target_flow_temp) && id(auto_flow_temp).state)
+        if (id(auto_flow_temp).state && id(target_flow_temp) && id(target_flow_temp) != id(last_set_flow_temp))
            id(adjust_flow_temp).execute();