From 3f76751eaf2bcc4a998c42655eee1e48bce4a11b Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 15 Dec 2024 16:49:32 +0000 Subject: [PATCH] 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. --- ufh.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) 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(); -- 2.49.0