diff --git a/src/MainTask.h b/src/MainTask.h index e80bc0f..a0cc9c7 100644 --- a/src/MainTask.h +++ b/src/MainTask.h @@ -229,7 +229,7 @@ protected: emergencyFlags |= 0b00000010; } - if (settings.opentherm.nativeHeatingControl) { + if (settings.opentherm.options.nativeHeatingControl) { emergencyFlags |= 0b00000100; } } diff --git a/src/MqttTask.h b/src/MqttTask.h index fe29a9c..1574cab 100644 --- a/src/MqttTask.h +++ b/src/MqttTask.h @@ -532,13 +532,13 @@ protected: bool publishNonStaticHaEntities(bool force = false) { static byte _heatingMinTemp, _heatingMaxTemp, _dhwMinTemp, _dhwMaxTemp = 0; - static bool _indoorTempControl, _dhwPresent = false; + static bool _indoorTempControl, _dhwSupport = false; bool published = false; - if (force || _dhwPresent != settings.opentherm.dhwPresent) { - _dhwPresent = settings.opentherm.dhwPresent; + if (force || _dhwSupport != settings.opentherm.options.dhwSupport) { + _dhwSupport = settings.opentherm.options.dhwSupport; - if (_dhwPresent) { + if (_dhwSupport) { this->haHelper->publishInputDhwMinTemp(settings.system.unitSystem); this->haHelper->publishInputDhwMaxTemp(settings.system.unitSystem); this->haHelper->publishDhwState(); @@ -569,7 +569,7 @@ protected: published = true; } - if (_dhwPresent && (force || _dhwMinTemp != settings.dhw.minTemp || _dhwMaxTemp != settings.dhw.maxTemp)) { + if (_dhwSupport && (force || _dhwMinTemp != settings.dhw.minTemp || _dhwMaxTemp != settings.dhw.maxTemp)) { _dhwMinTemp = settings.dhw.minTemp; _dhwMaxTemp = settings.dhw.maxTemp; diff --git a/src/OpenThermTask.h b/src/OpenThermTask.h index 7d3d583..1e5cf5c 100644 --- a/src/OpenThermTask.h +++ b/src/OpenThermTask.h @@ -153,18 +153,18 @@ protected: && !vars.master.heating.blocking; // DHW settings - vars.master.dhw.enabled = settings.opentherm.dhwPresent && settings.dhw.enabled; + vars.master.dhw.enabled = settings.opentherm.options.dhwSupport && settings.dhw.enabled; vars.master.dhw.targetTemp = settings.dhw.target; // CH2 settings - vars.master.ch2.enabled = settings.opentherm.heatingCh2Enabled - || (settings.opentherm.heatingCh1ToCh2 && vars.master.heating.enabled) - || (settings.opentherm.dhwToCh2 && settings.opentherm.dhwPresent && settings.dhw.enabled); + vars.master.ch2.enabled = settings.opentherm.options.heatingCh2Enabled + || (settings.opentherm.options.heatingToCh2 && vars.master.heating.enabled) + || (settings.opentherm.options.dhwToCh2 && settings.opentherm.options.dhwSupport && settings.dhw.enabled); - if (settings.opentherm.heatingCh1ToCh2) { + if (settings.opentherm.options.heatingToCh2) { vars.master.ch2.targetTemp = vars.master.heating.setpointTemp; - } else if (settings.opentherm.dhwToCh2) { + } else if (settings.opentherm.options.dhwToCh2) { vars.master.ch2.targetTemp = vars.master.dhw.targetTemp; } @@ -174,18 +174,18 @@ protected: // Immergas fix // https://arduino.ru/forum/programmirovanie/termostat-opentherm-na-esp8266?page=15#comment-649392 - if (settings.opentherm.immergasFix) { + if (settings.opentherm.options.immergasFix) { statusLb = 0xCA; } unsigned long response = this->instance->setBoilerStatus( vars.master.heating.enabled, vars.master.dhw.enabled, - false, - settings.opentherm.nativeHeatingControl, + settings.opentherm.options.coolingSupport, + settings.opentherm.options.nativeHeatingControl, vars.master.ch2.enabled, - settings.opentherm.summerWinterMode, - settings.opentherm.dhwBlocking, + settings.opentherm.options.summerWinterMode, + settings.opentherm.options.dhwBlocking, statusLb ); @@ -265,15 +265,16 @@ protected: } vars.slave.heating.active = CustomOpenTherm::isCentralHeatingActive(response); - vars.slave.dhw.active = settings.opentherm.dhwPresent ? CustomOpenTherm::isHotWaterActive(response) : false; + vars.slave.dhw.active = settings.opentherm.options.dhwSupport ? CustomOpenTherm::isHotWaterActive(response) : false; vars.slave.flame = CustomOpenTherm::isFlameOn(response); + vars.slave.cooling = CustomOpenTherm::isCoolingActive(response); vars.slave.fault.active = CustomOpenTherm::isFault(response); vars.slave.diag.active = CustomOpenTherm::isDiagnostic(response); Log.snoticeln( - FPSTR(L_OT), F("Received boiler status. Heating: %hhu; DHW: %hhu; flame: %hhu; fault: %hhu; diag: %hhu"), + FPSTR(L_OT), F("Received boiler status. Heating: %hhu; DHW: %hhu; flame: %hhu; cooling: %hhu; fault: %hhu; diag: %hhu"), vars.slave.heating.active, vars.slave.dhw.active, - vars.slave.flame, vars.slave.fault.active, vars.slave.diag.active + vars.slave.flame, vars.slave.cooling, vars.slave.fault.active, vars.slave.diag.active ); // These parameters will be updated every minute @@ -309,7 +310,7 @@ protected: Log.swarningln(FPSTR(L_OT), F("Failed receive min modulation and max power")); } - if (!vars.master.heating.enabled && settings.opentherm.modulationSyncWithHeating) { + if (!vars.master.heating.enabled && settings.opentherm.options.modulationSyncWithHeating) { if (this->setMaxModulationLevel(0)) { Log.snoticeln(FPSTR(L_OT), F("Set max modulation: 0% (response: %hhu%%)"), vars.slave.modulation.max); @@ -334,7 +335,7 @@ protected: // Get DHW min/max temp (if necessary) - if (settings.opentherm.dhwPresent && settings.opentherm.getMinMaxTemp) { + if (settings.opentherm.options.dhwSupport && settings.opentherm.options.getMinMaxTemp) { if (this->updateMinMaxDhwTemp()) { uint8_t convertedMinTemp = convertTemp( vars.slave.dhw.minTemp, @@ -380,7 +381,7 @@ protected: // Get heating min/max temp - if (settings.opentherm.getMinMaxTemp) { + if (settings.opentherm.options.getMinMaxTemp) { if (this->updateMinMaxHeatingTemp()) { uint8_t convertedMinTemp = convertTemp( vars.slave.heating.minTemp, @@ -520,7 +521,7 @@ protected: } // Update DHW temp - if (settings.opentherm.dhwPresent && Sensors::getAmountByType(Sensors::Type::OT_DHW_TEMP, true)) { + if (settings.opentherm.options.dhwSupport && Sensors::getAmountByType(Sensors::Type::OT_DHW_TEMP, true)) { bool result = this->updateDhwTemp(); if (result) { @@ -546,7 +547,7 @@ protected: } // Update DHW temp 2 - if (settings.opentherm.dhwPresent && Sensors::getAmountByType(Sensors::Type::OT_DHW_TEMP2, true)) { + if (settings.opentherm.options.dhwSupport && Sensors::getAmountByType(Sensors::Type::OT_DHW_TEMP2, true)) { if (this->updateDhwTemp2()) { float convertedDhwTemp2 = convertTemp( vars.slave.dhw.currentTemp2, @@ -570,7 +571,7 @@ protected: } // Update DHW flow rate - if (settings.opentherm.dhwPresent && Sensors::getAmountByType(Sensors::Type::OT_DHW_FLOW_RATE, true)) { + if (settings.opentherm.options.dhwSupport && Sensors::getAmountByType(Sensors::Type::OT_DHW_FLOW_RATE, true)) { if (this->updateDhwFlowRate()) { float convertedDhwFlowRate = convertVolume( vars.slave.dhw.flowRate, @@ -643,7 +644,7 @@ protected: // Update CH2 temp if (Sensors::getAmountByType(Sensors::Type::OT_CH2_TEMP, true)) { - if (vars.master.ch2.enabled && !settings.opentherm.nativeHeatingControl) { + if (vars.master.ch2.enabled && !settings.opentherm.options.nativeHeatingControl) { if (this->updateCh2Temp()) { float convertedCh2Temp = convertTemp( vars.slave.ch2.currentTemp, @@ -942,7 +943,7 @@ protected: } // Native heating control - if (settings.opentherm.nativeHeatingControl) { + if (settings.opentherm.options.nativeHeatingControl) { // Converted current indoor temp float convertedTemp = convertTemp(vars.master.heating.indoorTemp, settings.system.unitSystem, settings.opentherm.unitSystem); @@ -958,7 +959,7 @@ protected: } // Set current CH2 indoor temp - if (settings.opentherm.heatingCh1ToCh2) { + if (settings.opentherm.options.heatingToCh2) { if (this->setRoomTempCh2(convertedTemp)) { Log.sinfoln( FPSTR(L_OT_HEATING), F("Set current CH2 indoor temp: %.2f (converted: %.2f, response: %.2f)"), @@ -990,7 +991,7 @@ protected: } // Set target CH2 temp - if (settings.opentherm.heatingCh1ToCh2 && this->needSetCh2Temp(convertedTemp)) { + if (settings.opentherm.options.heatingToCh2 && this->needSetCh2Temp(convertedTemp)) { if (this->setRoomSetpointCh2(convertedTemp)) { this->ch2SetTempTime = millis(); @@ -1006,7 +1007,7 @@ protected: } // Normal heating control - if (!settings.opentherm.nativeHeatingControl && vars.master.heating.enabled) { + if (!settings.opentherm.options.nativeHeatingControl && vars.master.heating.enabled) { // Converted target heating temp float convertedTemp = convertTemp(vars.master.heating.setpointTemp, settings.system.unitSystem, settings.opentherm.unitSystem); @@ -1038,8 +1039,8 @@ protected: } // Set CH2 temp - if (!settings.opentherm.nativeHeatingControl && vars.master.ch2.enabled) { - if (settings.opentherm.heatingCh1ToCh2 || settings.opentherm.dhwToCh2) { + if (!settings.opentherm.options.nativeHeatingControl && vars.master.ch2.enabled) { + if (settings.opentherm.options.heatingToCh2 || settings.opentherm.options.dhwToCh2) { // Converted target CH2 temp float convertedTemp = convertTemp( vars.master.ch2.targetTemp, diff --git a/src/RegulatorTask.h b/src/RegulatorTask.h index e749adf..7f63f08 100644 --- a/src/RegulatorTask.h +++ b/src/RegulatorTask.h @@ -39,7 +39,7 @@ protected: this->indoorSensorsConnected = Sensors::existsConnectedSensorsByPurpose(Sensors::Purpose::INDOOR_TEMP); //this->outdoorSensorsConnected = Sensors::existsConnectedSensorsByPurpose(Sensors::Purpose::OUTDOOR_TEMP); - if (settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.nativeHeatingControl) { + if (settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeHeatingControl) { vars.master.heating.indoorTempControl = true; vars.master.heating.minTemp = THERMOSTAT_INDOOR_MIN_TEMP; vars.master.heating.maxTemp = THERMOSTAT_INDOOR_MAX_TEMP; @@ -93,7 +93,7 @@ protected: void hysteresis() { bool useHyst = false; if (settings.heating.hysteresis > 0.01f && this->indoorSensorsConnected) { - useHyst = settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.nativeHeatingControl; + useHyst = settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeHeatingControl; } if (useHyst) { @@ -110,13 +110,13 @@ protected: } inline float getHeatingMinSetpointTemp() { - return settings.opentherm.nativeHeatingControl + return settings.opentherm.options.nativeHeatingControl ? vars.master.heating.minTemp : settings.heating.minTemp; } inline float getHeatingMaxSetpointTemp() { - return settings.opentherm.nativeHeatingControl + return settings.opentherm.options.nativeHeatingControl ? vars.master.heating.maxTemp : settings.heating.maxTemp; } @@ -137,7 +137,7 @@ protected: if (vars.emergency.state) { return settings.emergency.target; - } else if (settings.opentherm.nativeHeatingControl) { + } else if (settings.opentherm.options.nativeHeatingControl) { return settings.heating.target; } else if (!settings.equitherm.enabled && !settings.pid.enabled) { diff --git a/src/Settings.h b/src/Settings.h index 3830942..05f4ef7 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -57,16 +57,19 @@ struct Settings { float minPower = 0.0f; float maxPower = 0.0f; - bool dhwPresent = true; - bool summerWinterMode = false; - bool heatingCh2Enabled = true; - bool heatingCh1ToCh2 = false; - bool dhwToCh2 = false; - bool dhwBlocking = false; - bool modulationSyncWithHeating = false; - bool getMinMaxTemp = true; - bool nativeHeatingControl = false; - bool immergasFix = false; + struct { + bool dhwSupport = true; + bool coolingSupport = false; + bool summerWinterMode = false; + bool heatingCh2Enabled = true; + bool heatingToCh2 = false; + bool dhwToCh2 = false; + bool dhwBlocking = false; + bool modulationSyncWithHeating = false; + bool getMinMaxTemp = true; + bool nativeHeatingControl = false; + bool immergasFix = false; + } options; } opentherm; struct { @@ -287,6 +290,7 @@ struct Variables { bool connected = false; bool flame = false; + bool cooling = false; float pressure = 0.0f; float heatExchangerTemp = 0.0f; diff --git a/src/strings.h b/src/strings.h index 89cee3f..9f3de05 100644 --- a/src/strings.h +++ b/src/strings.h @@ -54,6 +54,8 @@ const char S_CHIP[] PROGMEM = "chip"; const char S_CODE[] PROGMEM = "code"; const char S_CONNECTED[] PROGMEM = "connected"; const char S_CONTINUES[] PROGMEM = "continues"; +const char S_COOLING[] PROGMEM = "cooling"; +const char S_COOLING_SUPPORT[] PROGMEM = "coolingSupport"; const char S_CORE[] PROGMEM = "core"; const char S_CORES[] PROGMEM = "cores"; const char S_CRASH[] PROGMEM = "crash"; @@ -62,7 +64,7 @@ const char S_DATA[] PROGMEM = "data"; const char S_DATE[] PROGMEM = "date"; const char S_DHW[] PROGMEM = "dhw"; const char S_DHW_BLOCKING[] PROGMEM = "dhwBlocking"; -const char S_DHW_PRESENT[] PROGMEM = "dhwPresent"; +const char S_DHW_SUPPORT[] PROGMEM = "dhwSupport"; const char S_DHW_TO_CH2[] PROGMEM = "dhwToCh2"; const char S_DIAG[] PROGMEM = "diag"; const char S_DNS[] PROGMEM = "dns"; @@ -88,7 +90,7 @@ const char S_GET_MIN_MAX_TEMP[] PROGMEM = "getMinMaxTemp"; const char S_GPIO[] PROGMEM = "gpio"; const char S_HEAP[] PROGMEM = "heap"; const char S_HEATING[] PROGMEM = "heating"; -const char S_HEATING_CH1_TO_CH2[] PROGMEM = "heatingCh1ToCh2"; +const char S_HEATING_TO_CH2[] PROGMEM = "heatingToCh2"; const char S_HEATING_CH2_ENABLED[] PROGMEM = "heatingCh2Enabled"; const char S_HIDDEN[] PROGMEM = "hidden"; const char S_HOME_ASSISTANT_DISCOVERY[] PROGMEM = "homeAssistantDiscovery"; @@ -134,6 +136,7 @@ const char S_ON_ENABLED_HEATING[] PROGMEM = "onEnabledHeating"; const char S_ON_FAULT[] PROGMEM = "onFault"; const char S_ON_LOSS_CONNECTION[] PROGMEM = "onLossConnection"; const char S_OPENTHERM[] PROGMEM = "opentherm"; +const char S_OPTIONS[] PROGMEM = "options"; const char S_OUTDOOR_TEMP[] PROGMEM = "outdoorTemp"; const char S_OUT_GPIO[] PROGMEM = "outGpio"; const char S_OUTPUT[] PROGMEM = "output"; diff --git a/src/utils.h b/src/utils.h index a95929d..9034381 100644 --- a/src/utils.h +++ b/src/utils.h @@ -377,16 +377,19 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) { opentherm[FPSTR(S_MAX_MODULATION)] = src.opentherm.maxModulation; opentherm[FPSTR(S_MIN_POWER)] = roundf(src.opentherm.minPower, 2); opentherm[FPSTR(S_MAX_POWER)] = roundf(src.opentherm.maxPower, 2); - opentherm[FPSTR(S_DHW_PRESENT)] = src.opentherm.dhwPresent; - opentherm[FPSTR(S_SUMMER_WINTER_MODE)] = src.opentherm.summerWinterMode; - opentherm[FPSTR(S_HEATING_CH2_ENABLED)] = src.opentherm.heatingCh2Enabled; - opentherm[FPSTR(S_HEATING_CH1_TO_CH2)] = src.opentherm.heatingCh1ToCh2; - opentherm[FPSTR(S_DHW_TO_CH2)] = src.opentherm.dhwToCh2; - opentherm[FPSTR(S_DHW_BLOCKING)] = src.opentherm.dhwBlocking; - opentherm[FPSTR(S_MODULATION_SYNC_WITH_HEATING)] = src.opentherm.modulationSyncWithHeating; - opentherm[FPSTR(S_GET_MIN_MAX_TEMP)] = src.opentherm.getMinMaxTemp; - opentherm[FPSTR(S_NATIVE_HEATING_CONTROL)] = src.opentherm.nativeHeatingControl; - opentherm[FPSTR(S_IMMERGAS_FIX)] = src.opentherm.immergasFix; + + auto otOptions = opentherm[FPSTR(S_OPTIONS)].to(); + otOptions[FPSTR(S_DHW_SUPPORT)] = src.opentherm.options.dhwSupport; + otOptions[FPSTR(S_COOLING_SUPPORT)] = src.opentherm.options.coolingSupport; + otOptions[FPSTR(S_SUMMER_WINTER_MODE)] = src.opentherm.options.summerWinterMode; + otOptions[FPSTR(S_HEATING_CH2_ENABLED)] = src.opentherm.options.heatingCh2Enabled; + otOptions[FPSTR(S_HEATING_TO_CH2)] = src.opentherm.options.heatingToCh2; + otOptions[FPSTR(S_DHW_TO_CH2)] = src.opentherm.options.dhwToCh2; + otOptions[FPSTR(S_DHW_BLOCKING)] = src.opentherm.options.dhwBlocking; + otOptions[FPSTR(S_MODULATION_SYNC_WITH_HEATING)] = src.opentherm.options.modulationSyncWithHeating; + otOptions[FPSTR(S_GET_MIN_MAX_TEMP)] = src.opentherm.options.getMinMaxTemp; + otOptions[FPSTR(S_NATIVE_HEATING_CONTROL)] = src.opentherm.options.nativeHeatingControl; + otOptions[FPSTR(S_IMMERGAS_FIX)] = src.opentherm.options.immergasFix; auto mqtt = dst[FPSTR(S_MQTT)].to(); mqtt[FPSTR(S_ENABLED)] = src.mqtt.enabled; @@ -718,101 +721,110 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false } } - if (src[FPSTR(S_OPENTHERM)][FPSTR(S_DHW_PRESENT)].is()) { - bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_DHW_PRESENT)].as(); + if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_DHW_SUPPORT)].is()) { + bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_DHW_SUPPORT)].as(); - if (value != dst.opentherm.dhwPresent) { - dst.opentherm.dhwPresent = value; + if (value != dst.opentherm.options.dhwSupport) { + dst.opentherm.options.dhwSupport = value; changed = true; } } - if (src[FPSTR(S_OPENTHERM)][FPSTR(S_SUMMER_WINTER_MODE)].is()) { - bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_SUMMER_WINTER_MODE)].as(); + if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_COOLING_SUPPORT)].is()) { + bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_COOLING_SUPPORT)].as(); - if (value != dst.opentherm.summerWinterMode) { - dst.opentherm.summerWinterMode = value; + if (value != dst.opentherm.options.coolingSupport) { + dst.opentherm.options.coolingSupport = value; changed = true; } } - if (src[FPSTR(S_OPENTHERM)][FPSTR(S_HEATING_CH2_ENABLED)].is()) { - bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_HEATING_CH2_ENABLED)].as(); + if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_SUMMER_WINTER_MODE)].is()) { + bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_SUMMER_WINTER_MODE)].as(); - if (value != dst.opentherm.heatingCh2Enabled) { - dst.opentherm.heatingCh2Enabled = value; + if (value != dst.opentherm.options.summerWinterMode) { + dst.opentherm.options.summerWinterMode = value; + changed = true; + } + } - if (dst.opentherm.heatingCh2Enabled) { - dst.opentherm.heatingCh1ToCh2 = false; - dst.opentherm.dhwToCh2 = false; + if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_HEATING_CH2_ENABLED)].is()) { + bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_HEATING_CH2_ENABLED)].as(); + + if (value != dst.opentherm.options.heatingCh2Enabled) { + dst.opentherm.options.heatingCh2Enabled = value; + + if (dst.opentherm.options.heatingCh2Enabled) { + dst.opentherm.options.heatingToCh2 = false; + dst.opentherm.options.dhwToCh2 = false; } changed = true; } } - if (src[FPSTR(S_OPENTHERM)][FPSTR(S_HEATING_CH1_TO_CH2)].is()) { - bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_HEATING_CH1_TO_CH2)].as(); + if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_HEATING_TO_CH2)].is()) { + bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_HEATING_TO_CH2)].as(); - if (value != dst.opentherm.heatingCh1ToCh2) { - dst.opentherm.heatingCh1ToCh2 = value; + if (value != dst.opentherm.options.heatingToCh2) { + dst.opentherm.options.heatingToCh2 = value; - if (dst.opentherm.heatingCh1ToCh2) { - dst.opentherm.heatingCh2Enabled = false; - dst.opentherm.dhwToCh2 = false; + if (dst.opentherm.options.heatingToCh2) { + dst.opentherm.options.heatingCh2Enabled = false; + dst.opentherm.options.dhwToCh2 = false; } changed = true; } } - if (src[FPSTR(S_OPENTHERM)][FPSTR(S_DHW_TO_CH2)].is()) { - bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_DHW_TO_CH2)].as(); + if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_DHW_TO_CH2)].is()) { + bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_DHW_TO_CH2)].as(); - if (value != dst.opentherm.dhwToCh2) { - dst.opentherm.dhwToCh2 = value; + if (value != dst.opentherm.options.dhwToCh2) { + dst.opentherm.options.dhwToCh2 = value; - if (dst.opentherm.dhwToCh2) { - dst.opentherm.heatingCh2Enabled = false; - dst.opentherm.heatingCh1ToCh2 = false; + if (dst.opentherm.options.dhwToCh2) { + dst.opentherm.options.heatingCh2Enabled = false; + dst.opentherm.options.heatingToCh2 = false; } changed = true; } } - if (src[FPSTR(S_OPENTHERM)][FPSTR(S_DHW_BLOCKING)].is()) { - bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_DHW_BLOCKING)].as(); + if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_DHW_BLOCKING)].is()) { + bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_DHW_BLOCKING)].as(); - if (value != dst.opentherm.dhwBlocking) { - dst.opentherm.dhwBlocking = value; + if (value != dst.opentherm.options.dhwBlocking) { + dst.opentherm.options.dhwBlocking = value; changed = true; } } - if (src[FPSTR(S_OPENTHERM)][FPSTR(S_MODULATION_SYNC_WITH_HEATING)].is()) { - bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_MODULATION_SYNC_WITH_HEATING)].as(); + if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_MODULATION_SYNC_WITH_HEATING)].is()) { + bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_MODULATION_SYNC_WITH_HEATING)].as(); - if (value != dst.opentherm.modulationSyncWithHeating) { - dst.opentherm.modulationSyncWithHeating = value; + if (value != dst.opentherm.options.modulationSyncWithHeating) { + dst.opentherm.options.modulationSyncWithHeating = value; changed = true; } } - if (src[FPSTR(S_OPENTHERM)][FPSTR(S_GET_MIN_MAX_TEMP)].is()) { - bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_GET_MIN_MAX_TEMP)].as(); + if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_GET_MIN_MAX_TEMP)].is()) { + bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_GET_MIN_MAX_TEMP)].as(); - if (value != dst.opentherm.getMinMaxTemp) { - dst.opentherm.getMinMaxTemp = value; + if (value != dst.opentherm.options.getMinMaxTemp) { + dst.opentherm.options.getMinMaxTemp = value; changed = true; } } - if (src[FPSTR(S_OPENTHERM)][FPSTR(S_NATIVE_HEATING_CONTROL)].is()) { - bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_NATIVE_HEATING_CONTROL)].as(); + if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_NATIVE_HEATING_CONTROL)].is()) { + bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_NATIVE_HEATING_CONTROL)].as(); - if (value != dst.opentherm.nativeHeatingControl) { - dst.opentherm.nativeHeatingControl = value; + if (value != dst.opentherm.options.nativeHeatingControl) { + dst.opentherm.options.nativeHeatingControl = value; if (value) { dst.equitherm.enabled = false; @@ -823,11 +835,11 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false } } - if (src[FPSTR(S_OPENTHERM)][FPSTR(S_IMMERGAS_FIX)].is()) { - bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_IMMERGAS_FIX)].as(); + if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_IMMERGAS_FIX)].is()) { + bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_IMMERGAS_FIX)].as(); - if (value != dst.opentherm.immergasFix) { - dst.opentherm.immergasFix = value; + if (value != dst.opentherm.options.immergasFix) { + dst.opentherm.options.immergasFix = value; changed = true; } } @@ -923,7 +935,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false if (src[FPSTR(S_EQUITHERM)][FPSTR(S_ENABLED)].is()) { bool value = src[FPSTR(S_EQUITHERM)][FPSTR(S_ENABLED)].as(); - if (!dst.opentherm.nativeHeatingControl) { + if (!dst.opentherm.options.nativeHeatingControl) { if (value != dst.equitherm.enabled) { dst.equitherm.enabled = value; changed = true; @@ -967,7 +979,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false if (src[FPSTR(S_PID)][FPSTR(S_ENABLED)].is()) { bool value = src[FPSTR(S_PID)][FPSTR(S_ENABLED)].as(); - if (!dst.opentherm.nativeHeatingControl) { + if (!dst.opentherm.options.nativeHeatingControl) { if (value != dst.pid.enabled) { dst.pid.enabled = value; changed = true; @@ -1326,7 +1338,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false // force check emergency target { float value = !src[FPSTR(S_EMERGENCY)][FPSTR(S_TARGET)].isNull() ? src[FPSTR(S_EMERGENCY)][FPSTR(S_TARGET)].as() : dst.emergency.target; - bool noRegulators = !dst.opentherm.nativeHeatingControl; + bool noRegulators = !dst.opentherm.options.nativeHeatingControl; bool valid = isValidTemp( value, dst.system.unitSystem, @@ -1351,7 +1363,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false // force check heating target { - bool indoorTempControl = dst.equitherm.enabled || dst.pid.enabled || dst.opentherm.nativeHeatingControl; + bool indoorTempControl = dst.equitherm.enabled || dst.pid.enabled || dst.opentherm.options.nativeHeatingControl; float minTemp = indoorTempControl ? THERMOSTAT_INDOOR_MIN_TEMP : dst.heating.minTemp; float maxTemp = indoorTempControl ? THERMOSTAT_INDOOR_MAX_TEMP : dst.heating.maxTemp; @@ -1720,6 +1732,7 @@ void varsToJson(const Variables& src, JsonVariant dst) { slave[FPSTR(S_PROTOCOL_VERSION)] = src.slave.appVersion; slave[FPSTR(S_CONNECTED)] = src.slave.connected; slave[FPSTR(S_FLAME)] = src.slave.flame; + slave[FPSTR(S_COOLING)] = src.slave.cooling; auto sModulation = slave[FPSTR(S_MODULATION)].to(); sModulation[FPSTR(S_MIN)] = src.slave.modulation.min; diff --git a/src_data/locales/en.json b/src_data/locales/en.json index 876b156..9695609 100644 --- a/src_data/locales/en.json +++ b/src_data/locales/en.json @@ -97,6 +97,7 @@ "sConnected": "OpenTherm connection", "sFlame": "Flame", + "sCooling": "Cooling", "sFaultActive": "Fault", "sFaultCode": "Faul code", "sDiagActive": "Diagnostic", @@ -356,10 +357,11 @@ "options": { "desc": "Options", - "dhwPresent": "DHW present", + "dhwSupport": "DHW support", + "coolingSupport": "Cooling support", "summerWinterMode": "Summer/winter mode", "heatingCh2Enabled": "Heating CH2 always enabled", - "heatingCh1ToCh2": "Duplicate heating CH1 to CH2", + "heatingToCh2": "Duplicate heating to CH2", "dhwToCh2": "Duplicate DHW to CH2", "dhwBlocking": "DHW blocking", "modulationSyncWithHeating": "Sync modulation with heating", diff --git a/src_data/locales/ru.json b/src_data/locales/ru.json index 64c1ec8..89a590e 100644 --- a/src_data/locales/ru.json +++ b/src_data/locales/ru.json @@ -97,6 +97,7 @@ "sConnected": "Подключение к OpenTherm", "sFlame": "Пламя", + "sCooling": "Охлаждение", "sFaultActive": "Ошибка", "sFaultCode": "Код ошибки", "sDiagActive": "Диагностика", @@ -356,10 +357,11 @@ "options": { "desc": "Опции", - "dhwPresent": "Контур ГВС", + "dhwSupport": "Поддержка ГВС", + "coolingSupport": "Поддержка охлаждения", "summerWinterMode": "Летний/зимний режим", "heatingCh2Enabled": "Канал 2 отопления всегда вкл.", - "heatingCh1ToCh2": "Дублировать параметры отопления канала 1 в канал 2", + "heatingToCh2": "Дублировать параметры отопления в канал 2", "dhwToCh2": "Дублировать параметры ГВС в канал 2", "dhwBlocking": "DHW blocking", "modulationSyncWithHeating": "Синхронизировать модуляцию с отоплением", diff --git a/src_data/pages/dashboard.html b/src_data/pages/dashboard.html index d8e9faf..4e1587a 100644 --- a/src_data/pages/dashboard.html +++ b/src_data/pages/dashboard.html @@ -113,6 +113,10 @@ dashboard.states.sFlame + + dashboard.states.sCooling + + @@ -372,8 +376,8 @@ (prevSettings.heating.enabled != newSettings.heating.enabled) || (prevSettings.heating.turbo != newSettings.heating.turbo) || (prevSettings.heating.target != newSettings.heating.target) - || (prevSettings.opentherm.dhwPresent && prevSettings.dhw.enabled != newSettings.dhw.enabled) - || (prevSettings.opentherm.dhwPresent && prevSettings.dhw.target != newSettings.dhw.target) + || (prevSettings.opentherm.options.dhwSupport && prevSettings.dhw.enabled != newSettings.dhw.enabled) + || (prevSettings.opentherm.options.dhwSupport && prevSettings.dhw.target != newSettings.dhw.target) ); if (modified) { @@ -397,7 +401,7 @@ } const result = await response.json(); - noRegulators = !result.opentherm.nativeHeatingControl && !result.equitherm.enabled && !result.pid.enabled; + noRegulators = !result.opentherm.options.nativeHeatingControl && !result.equitherm.enabled && !result.pid.enabled; prevSettings = result; unitSystem = result.system.unitSystem; newSettings.heating.enabled = result.heating.enabled; @@ -406,7 +410,7 @@ newSettings.dhw.enabled = result.dhw.enabled; newSettings.dhw.target = result.dhw.target; - if (result.opentherm.dhwPresent) { + if (result.opentherm.options.dhwSupport) { show('#thermostat-dhw'); } else { hide('#thermostat-dhw'); @@ -462,6 +466,7 @@ result.slave.connected ? "green" : "red" ); setState('.sFlame', result.slave.flame); + setState('.sCooling', result.slave.cooling); setValue('.sModMin', result.slave.modulation.min); setValue('.sModMax', result.slave.modulation.max); diff --git a/src_data/pages/settings.html b/src_data/pages/settings.html index 1b22b6e..2530b57 100644 --- a/src_data/pages/settings.html +++ b/src_data/pages/settings.html @@ -336,67 +336,67 @@
settings.section.ot
-
-