]> www.infradead.org Git - users/dwmw2/esp32-pool.git/commitdiff
Fix thermostat restart for UFH
authorDavid Woodhouse <dwmw@amazon.co.uk>
Sun, 15 Dec 2024 16:49:32 +0000 (16:49 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Sun, 15 Dec 2024 16:49:34 +0000 (16:49 +0000)
The thermostat doesn't know whether the heater is actually on or not, when
it re-engages heating mode. Tell it, otherwise it might leave the heating
on (or off) for ever.

ufh.yaml

index 6c5b2b42136807cdb04eb80718426a02d03e16ad..5e221cf156e31cd0987a4b67ed02f1e639a9618d 100644 (file)
--- a/ufh.yaml
+++ b/ufh.yaml
@@ -218,6 +218,14 @@ climate:
       - switch.turn_on: ufh_relay
     idle_action:
       - switch.turn_off: ufh_relay
+    heat_mode:
+      - lambda: |-
+         // If the heater is already on, let the thermostat know. Otherwise it won't turn it off!
+         if (id(ufh_relay).state)
+           id(ntc_climate)->action = esphome::climate::CLIMATE_ACTION_HEATING;
+         else
+           id(ntc_climate)->action = esphome::climate::CLIMATE_ACTION_IDLE;
+         ESP_LOGD("ufh", "Start heating, current action %s", LOG_STR_ARG(climate_action_to_string(id(ntc_climate)->action)));
     on_control:
       - lambda: |-
            auto temp = x.get_target_temperature();