feat: added setting to enable/disable polling of min and max temperatures via opentherm

This commit is contained in:
Yurii
2024-04-06 15:51:49 +03:00
parent 53eaa1d7f1
commit b0e0f6fd7d
5 changed files with 32 additions and 18 deletions

View File

@@ -107,6 +107,10 @@
<input type="checkbox" class="opentherm-sync-modulation-with-heating" name="opentherm[modulationSyncWithHeating]" value="true">
Sync modulation with heating
</label>
<label for="opentherm-get-min-max-temp">
<input type="checkbox" class="opentherm-get-min-max-temp" name="opentherm[getMinMaxTemp]" value="true">
Get min/max temp from boiler
</label>
</fieldset>
<button type="submit">Save</button>

View File

@@ -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)

View File

@@ -46,6 +46,7 @@ struct Settings {
bool dhwToCh2 = false;
bool dhwBlocking = false;
bool modulationSyncWithHeating = false;
bool getMinMaxTemp = true;
} opentherm;
struct {

View File

@@ -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<bool>()) {
dst.opentherm.getMinMaxTemp = src["opentherm"]["getMinMaxTemp"].as<bool>();
changed = true;
}
// mqtt
if (!src["mqtt"]["server"].isNull()) {

View File

@@ -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);