From b0b1b79fbdc01fcea220c0ff1c5760624af4842f Mon Sep 17 00:00:00 2001 From: Luc Boudreau Date: Thu, 9 Dec 2021 17:35:29 -0500 Subject: [PATCH] Turns off the relay once when the thermostat is switched off to prevent it from being kept on forever, as a safety precaution. --- tasmota/xdrv_39_thermostat.ino | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tasmota/xdrv_39_thermostat.ino b/tasmota/xdrv_39_thermostat.ino index ae8d2d92f..414cb358b 100644 --- a/tasmota/xdrv_39_thermostat.ino +++ b/tasmota/xdrv_39_thermostat.ino @@ -1400,6 +1400,12 @@ void CmndThermostatModeSet(void) Thermostat[ctr_output].status.thermostat_mode = value; Thermostat[ctr_output].timestamp_input_on = 0; // Reset last manual switch timer if command set externally } + if ((value == THERMOSTAT_OFF) && (Thermostat[ctr_output].status.enable_output == IFACE_ON)) { + // Make sure the relay is switched to off once if the thermostat is being disabled, + // or it will get stuck on (danger!) + Thermostat[ctr_output].status.command_output = IFACE_OFF; + ThermostatOutputRelay(ctr_output, Thermostat[ctr_output].status.command_output); + } } ResponseCmndIdxNumber((int)Thermostat[ctr_output].status.thermostat_mode); }