From: David Woodhouse Date: Sun, 15 Dec 2024 16:49:32 +0000 (+0000) Subject: Fix thermostat restart for UFH X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3f76751eaf2bcc4a998c42655eee1e48bce4a11b;p=users%2Fdwmw2%2Fesp32-pool.git Fix thermostat restart for UFH 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. --- diff --git a/ufh.yaml b/ufh.yaml index 6c5b2b4..5e221cf 100644 --- 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();