]> www.infradead.org Git - users/dwmw2/esp32-pool.git/commitdiff
Ramp up flow temp slowly
authorDavid Woodhouse <dwmw@amazon.co.uk>
Thu, 17 Oct 2024 20:11:06 +0000 (21:11 +0100)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Thu, 17 Oct 2024 20:11:06 +0000 (21:11 +0100)
heishamon.yaml

index ac24a703e4ff3fc44ff52361f96a5f143098b16b..78a10fd63a942bcd5b984a41807ba0f5d6056512 100644 (file)
@@ -106,9 +106,9 @@ mqtt:
                   svalue1 = x["svalue1"].as<int>();
                   id(tell_domo_svalue)->execute(908, std::to_string(svalue1/2));
                   if (id(auto_flow_temp).state) {
-                    id(flow_temp) = 30.0 + (svalue1 / 8.0);
-                    ESP_LOGI("Evohome", "Boiler set to %d/%d, flow temp set to %f °C", nvalue, svalue1, id(flow_temp));
-                    id(ecodan_instance).set_flow_target_temperature(id(flow_temp), esphome::ecodan::SetZone::ZONE_1);
+                    id(target_flow_temp) = 30.0 + (svalue1 / 8.0);
+                    ESP_LOGI("Evohome", "Boiler set to %d/%d, target flow temp set to %f °C", nvalue, svalue1, id(target_flow_temp));
+                    id(adjust_flow_temp).execute();
                   }
                   break;
                }
@@ -432,10 +432,27 @@ text_sensor:
 #   miso_pin: GPIO13
 
 globals:
-  - id: flow_temp
+  - id: target_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
+# actual flow temp, to avoid firing up both heat pumps if the heat demand from the
+# house isn't smooth enough.
+script:
+  - id: adjust_flow_temp
+    mode: restart
+    then:
+      - lambda: |-
+         float set_next = id(target_flow_temp);
+         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);
+
 # relay
 switch:
   - platform: template
@@ -445,11 +462,7 @@ switch:
     optimistic: true
     on_turn_on:
       then:
-        - lambda: |-
-            if (id(flow_temp)) {
-              ESP_LOGI("Evohome", "Flow temp set to %f °C", id(flow_temp));
-              id(ecodan_instance).set_flow_target_temperature(id(flow_temp), esphome::ecodan::SetZone::ZONE_1);
-            }
+        - script.execute: adjust_flow_temp
 
   - platform: gpio
     pin: GPIO5
@@ -482,3 +495,10 @@ ecodan:
   id: ecodan_instance
   uart_id: uart_ecodan
   proxy_uart_id: uart_proxy
+
+interval:
+  - interval: 30s
+    then:
+    - lambda: |-
+        if (id(target_flow_temp) && id(auto_flow_temp).state)
+           id(adjust_flow_temp).execute();