diff --git a/src/OpenThermTask.h b/src/OpenThermTask.h index 18104bf..601ad71 100644 --- a/src/OpenThermTask.h +++ b/src/OpenThermTask.h @@ -57,6 +57,9 @@ protected: bool heatingCh2Enabled = settings.opentherm.heatingCh2Enabled; if (settings.opentherm.heatingCh1ToCh2) { heatingCh2Enabled = heatingEnabled; + + } else if (settings.opentherm.dhwToCh2) { + heatingCh2Enabled = settings.opentherm.dhwPresent && settings.dhw.enable; } localResponse = ot->setBoilerStatus( @@ -232,6 +235,12 @@ protected: } else { Log.swarningln("OT.DHW", "Failed set temp"); } + + if (settings.opentherm.dhwToCh2) { + if (!ot->setHeatingCh2Temp(newDHWTemp)) { + Log.swarningln("OT.DHW", "Failed set ch2 temp"); + } + } } // diff --git a/src/Settings.h b/src/Settings.h index af988e2..e8974b7 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -10,6 +10,7 @@ struct Settings { bool summerWinterMode = false; bool heatingCh2Enabled = true; bool heatingCh1ToCh2 = false; + bool dhwToCh2 = false; } opentherm; struct { diff --git a/src/WifiManagerTask.h b/src/WifiManagerTask.h index c3ee8e4..f3b17f9 100644 --- a/src/WifiManagerTask.h +++ b/src/WifiManagerTask.h @@ -19,6 +19,7 @@ CheckboxParameter* wmOtDHWPresent; CheckboxParameter* wmOtSummerWinterMode; CheckboxParameter* wmOtHeatingCh2Enabled; CheckboxParameter* wmOtHeatingCh1ToCh2; +CheckboxParameter* wmOtDHWToCh2; UnsignedIntParameter* wmOutdoorSensorPin; UnsignedIntParameter* wmIndoorSensorPin; @@ -105,6 +106,9 @@ protected: wmOtHeatingCh1ToCh2 = new CheckboxParameter("ot_heating_ch1_to_ch2", "Opentherm heating CH1 to CH2", settings.opentherm.heatingCh1ToCh2); wm.addParameter(wmOtHeatingCh1ToCh2); + wmOtDHWToCh2 = new CheckboxParameter("ot_dhw_to_ch2", "Opentherm DHW to CH2", settings.opentherm.dhwToCh2); + wm.addParameter(wmOtDHWToCh2); + wmSep2 = new SeparatorParameter(); wm.addParameter(wmSep2); @@ -249,11 +253,46 @@ protected: if (wmOtHeatingCh2Enabled->getCheckboxValue() != settings.opentherm.heatingCh2Enabled) { changed = true; settings.opentherm.heatingCh2Enabled = wmOtHeatingCh2Enabled->getCheckboxValue(); + + if (settings.opentherm.heatingCh1ToCh2) { + settings.opentherm.heatingCh1ToCh2 = false; + wmOtHeatingCh1ToCh2->setValue(false); + } + + if (settings.opentherm.dhwToCh2) { + settings.opentherm.dhwToCh2 = false; + wmOtDHWToCh2->setValue(false); + } } if (wmOtHeatingCh1ToCh2->getCheckboxValue() != settings.opentherm.heatingCh1ToCh2) { changed = true; settings.opentherm.heatingCh1ToCh2 = wmOtHeatingCh1ToCh2->getCheckboxValue(); + + if (settings.opentherm.heatingCh2Enabled) { + settings.opentherm.heatingCh2Enabled = false; + wmOtHeatingCh2Enabled->setValue(false); + } + + if (settings.opentherm.dhwToCh2) { + settings.opentherm.dhwToCh2 = false; + wmOtDHWToCh2->setValue(false); + } + } + + if (wmOtDHWToCh2->getCheckboxValue() != settings.opentherm.dhwToCh2) { + changed = true; + settings.opentherm.dhwToCh2 = wmOtDHWToCh2->getCheckboxValue(); + + if (settings.opentherm.heatingCh2Enabled) { + settings.opentherm.heatingCh2Enabled = false; + wmOtHeatingCh2Enabled->setValue(false); + } + + if (settings.opentherm.heatingCh1ToCh2) { + settings.opentherm.heatingCh1ToCh2 = false; + wmOtHeatingCh1ToCh2->setValue(false); + } } if (wmOutdoorSensorPin->getValue() != settings.sensors.outdoor.pin) { @@ -292,6 +331,7 @@ protected: " OT summer/winter mode: %d\r\n" " OT heating ch2 enabled: %d\r\n" " OT heating ch1 to ch2: %d\r\n" + " OT DHW to ch2: %d\r\n" " Outdoor sensor pin: %d\r\n" " Indoor sensor pin: %d\r\n", settings.hostname, @@ -308,6 +348,7 @@ protected: settings.opentherm.summerWinterMode, settings.opentherm.heatingCh2Enabled, settings.opentherm.heatingCh1ToCh2, + settings.opentherm.dhwToCh2, settings.sensors.outdoor.pin, settings.sensors.indoor.pin );