diff --git a/data/settings.html b/data/settings.html index ddcdf82..e73e609 100644 --- a/data/settings.html +++ b/data/settings.html @@ -107,6 +107,10 @@ Sync modulation with heating + diff --git a/src/OpenThermTask.h b/src/OpenThermTask.h index 2fddafa..46f5ecb 100644 --- a/src/OpenThermTask.h +++ b/src/OpenThermTask.h @@ -203,7 +203,7 @@ protected: // Get DHW min/max temp (if necessary) - if (settings.opentherm.dhwPresent) { + if (settings.opentherm.dhwPresent && settings.opentherm.getMinMaxTemp) { if (updateMinMaxDhwTemp()) { if (settings.dhw.minTemp < vars.parameters.dhwMinTemp) { settings.dhw.minTemp = vars.parameters.dhwMinTemp; @@ -230,27 +230,29 @@ protected: // Get heating min/max temp - if (updateMinMaxHeatingTemp()) { - if (settings.heating.minTemp < vars.parameters.heatingMinTemp) { - settings.heating.minTemp = vars.parameters.heatingMinTemp; - fsSettings.update(); - Log.snoticeln(FPSTR(L_OT_HEATING), F("Updated min temp: %hhu"), settings.heating.minTemp); + if (settings.opentherm.getMinMaxTemp) { + if (updateMinMaxHeatingTemp()) { + if (settings.heating.minTemp < vars.parameters.heatingMinTemp) { + settings.heating.minTemp = vars.parameters.heatingMinTemp; + fsSettings.update(); + Log.snoticeln(FPSTR(L_OT_HEATING), F("Updated min temp: %hhu"), settings.heating.minTemp); + } + + if (settings.heating.maxTemp > vars.parameters.heatingMaxTemp) { + settings.heating.maxTemp = vars.parameters.heatingMaxTemp; + fsSettings.update(); + Log.snoticeln(FPSTR(L_OT_HEATING), F("Updated max temp: %hhu"), settings.heating.maxTemp); + } + + } else { + Log.swarningln(FPSTR(L_OT_HEATING), F("Failed get min/max temp")); } - if (settings.heating.maxTemp > vars.parameters.heatingMaxTemp) { - settings.heating.maxTemp = vars.parameters.heatingMaxTemp; + if (settings.heating.minTemp >= settings.heating.maxTemp) { + settings.heating.minTemp = 20; + settings.heating.maxTemp = 90; fsSettings.update(); - Log.snoticeln(FPSTR(L_OT_HEATING), F("Updated max temp: %hhu"), settings.heating.maxTemp); } - - } else { - Log.swarningln(FPSTR(L_OT_HEATING), F("Failed get min/max temp")); - } - - if (settings.heating.minTemp >= settings.heating.maxTemp) { - settings.heating.minTemp = 20; - settings.heating.maxTemp = 90; - fsSettings.update(); } // Get outdoor temp (if necessary) diff --git a/src/Settings.h b/src/Settings.h index e24b1db..c80e510 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -46,6 +46,7 @@ struct Settings { bool dhwToCh2 = false; bool dhwBlocking = false; bool modulationSyncWithHeating = false; + bool getMinMaxTemp = true; } opentherm; struct { diff --git a/src/utils.h b/src/utils.h index c72c90b..9a88813 100644 --- a/src/utils.h +++ b/src/utils.h @@ -283,6 +283,7 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) { dst["opentherm"]["dhwToCh2"] = src.opentherm.dhwToCh2; dst["opentherm"]["dhwBlocking"] = src.opentherm.dhwBlocking; dst["opentherm"]["modulationSyncWithHeating"] = src.opentherm.modulationSyncWithHeating; + dst["opentherm"]["getMinMaxTemp"] = src.opentherm.getMinMaxTemp; dst["mqtt"]["server"] = src.mqtt.server; dst["mqtt"]["port"] = src.mqtt.port; @@ -500,6 +501,11 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false changed = true; } + if (src["opentherm"]["getMinMaxTemp"].is()) { + dst.opentherm.getMinMaxTemp = src["opentherm"]["getMinMaxTemp"].as(); + changed = true; + } + // mqtt if (!src["mqtt"]["server"].isNull()) { diff --git a/src_data/static/app.js b/src_data/static/app.js index 97b8807..bbf5891 100644 --- a/src_data/static/app.js +++ b/src_data/static/app.js @@ -501,6 +501,7 @@ async function loadSettings() { setCheckboxValue('.opentherm-dhw-to-ch2', result.opentherm.dhwToCh2); setCheckboxValue('.opentherm-dhw-blocking', result.opentherm.dhwBlocking); setCheckboxValue('.opentherm-sync-modulation-with-heating', result.opentherm.modulationSyncWithHeating); + setCheckboxValue('.opentherm-get-min-max-temp', result.opentherm.getMinMaxTemp); setBusy('#opentherm-settings-busy', '#opentherm-settings', false); setInputValue('.mqtt-server', result.mqtt.server);