5 Commits

17 changed files with 433 additions and 176 deletions

View File

@@ -37,7 +37,7 @@ build_flags =
-D BUILD_ENV='"$PIOENV"' -D BUILD_ENV='"$PIOENV"'
-D USE_SERIAL=${secrets.use_serial} -D USE_SERIAL=${secrets.use_serial}
-D USE_TELNET=${secrets.use_telnet} -D USE_TELNET=${secrets.use_telnet}
-D DEBUG_BY_DEFAULT=${secrets.debug} -D DEFAULT_LOG_LEVEL=${secrets.log_level}
-D DEFAULT_HOSTNAME='"${secrets.hostname}"' -D DEFAULT_HOSTNAME='"${secrets.hostname}"'
-D DEFAULT_AP_SSID='"${secrets.ap_ssid}"' -D DEFAULT_AP_SSID='"${secrets.ap_ssid}"'
-D DEFAULT_AP_PASSWORD='"${secrets.ap_password}"' -D DEFAULT_AP_PASSWORD='"${secrets.ap_password}"'

View File

@@ -1,7 +1,7 @@
[secrets] [secrets]
use_serial = true use_serial = true
use_telnet = true use_telnet = true
debug = true log_level = 5
hostname = opentherm hostname = opentherm
ap_ssid = OpenTherm Gateway ap_ssid = OpenTherm Gateway

View File

@@ -266,30 +266,6 @@ public:
return this->publish(this->getTopic(FPSTR(HA_ENTITY_NUMBER), F("heating_max_temp")).c_str(), doc); return this->publish(this->getTopic(FPSTR(HA_ENTITY_NUMBER), F("heating_max_temp")).c_str(), doc);
} }
bool publishNumberHeatingMaxModulation(bool enabledByDefault = true) {
JsonDocument doc;
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectId(F("heating_max_modulation"));
doc[FPSTR(HA_OBJECT_ID)] = this->getObjectId(F("heating_max_modulation"));
doc[FPSTR(HA_ENTITY_CATEGORY)] = F("config");
doc[FPSTR(HA_DEVICE_CLASS)] = F("power_factor");
doc[FPSTR(HA_UNIT_OF_MEASUREMENT)] = F("%");
doc[FPSTR(HA_NAME)] = F("Max modulation");
doc[FPSTR(HA_ICON)] = F("mdi:speedometer");
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(F("settings"));
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.heating.maxModulation|int(1) }}");
doc[FPSTR(HA_COMMAND_TOPIC)] = this->getDeviceTopic(F("settings/set"));
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"heating\": {\"maxModulation\" : {{ value }}}}");
doc[FPSTR(HA_MIN)] = 1;
doc[FPSTR(HA_MAX)] = 100;
doc[FPSTR(HA_STEP)] = 1;
doc[FPSTR(HA_MODE)] = "box";
doc[FPSTR(HA_EXPIRE_AFTER)] = 120;
doc.shrinkToFit();
return this->publish(this->getTopic(FPSTR(HA_ENTITY_NUMBER), F("heating_max_modulation")).c_str(), doc);
}
bool publishSwitchDhw(bool enabledByDefault = true) { bool publishSwitchDhw(bool enabledByDefault = true) {
JsonDocument doc; JsonDocument doc;
@@ -872,6 +848,29 @@ public:
return this->publish(this->getTopic(FPSTR(HA_ENTITY_BINARY_SENSOR), F("diagnostic")).c_str(), doc); return this->publish(this->getTopic(FPSTR(HA_ENTITY_BINARY_SENSOR), F("diagnostic")).c_str(), doc);
} }
bool publishSensorPower(bool enabledByDefault = true) {
JsonDocument doc;
doc[FPSTR(HA_AVAILABILITY)][0][FPSTR(HA_TOPIC)] = this->getDeviceTopic(F("status"));
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_TOPIC)] = this->getDeviceTopic(F("state"));
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.states.otStatus, 'online', 'offline') }}");
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectId(F("power"));
doc[FPSTR(HA_OBJECT_ID)] = this->getObjectId(F("power"));
doc[FPSTR(HA_ENTITY_CATEGORY)] = F("diagnostic");
doc[FPSTR(HA_DEVICE_CLASS)] = F("power");
doc[FPSTR(HA_STATE_CLASS)] = F("measurement");
doc[FPSTR(HA_UNIT_OF_MEASUREMENT)] = F("kW");
doc[FPSTR(HA_NAME)] = F("Current power");
doc[FPSTR(HA_ICON)] = F("mdi:chart-bar");
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(F("state"));
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.sensors.power|float(0)|round(2) }}");
doc[FPSTR(HA_EXPIRE_AFTER)] = 120;
doc.shrinkToFit();
return this->publish(this->getTopic(FPSTR(HA_ENTITY_SENSOR), F("power")).c_str(), doc);
}
bool publishSensorFaultCode(bool enabledByDefault = true) { bool publishSensorFaultCode(bool enabledByDefault = true) {
JsonDocument doc; JsonDocument doc;
doc[FPSTR(HA_AVAILABILITY)][0][FPSTR(HA_TOPIC)] = this->getDeviceTopic(F("status")); doc[FPSTR(HA_AVAILABILITY)][0][FPSTR(HA_TOPIC)] = this->getDeviceTopic(F("status"));

View File

@@ -99,11 +99,10 @@ protected:
tMqtt->disable(); tMqtt->disable();
} }
if ( Log.getLevel() != TinyLogger::Level::INFO && !settings.system.debug ) { if (settings.system.logLevel >= TinyLogger::Level::SILENT && settings.system.logLevel <= TinyLogger::Level::VERBOSE) {
Log.setLevel(TinyLogger::Level::INFO); if (Log.getLevel() != settings.system.logLevel) {
Log.setLevel(static_cast<TinyLogger::Level>(settings.system.logLevel));
} else if ( Log.getLevel() != TinyLogger::Level::VERBOSE && settings.system.debug ) { }
Log.setLevel(TinyLogger::Level::VERBOSE);
} }
} else { } else {
@@ -160,7 +159,7 @@ protected:
this->restartSignalTime = millis(); this->restartSignalTime = millis();
} }
if (!settings.system.debug) { if (settings.system.logLevel < TinyLogger::Level::VERBOSE) {
return; return;
} }

View File

@@ -270,7 +270,7 @@ protected:
return; return;
} }
if (settings.system.debug) { if (settings.system.logLevel >= TinyLogger::Level::TRACE) {
Log.strace(FPSTR(L_MQTT_MSG), F("Topic: %s\r\n> "), topic); Log.strace(FPSTR(L_MQTT_MSG), F("Topic: %s\r\n> "), topic);
if (Log.lock()) { if (Log.lock()) {
for (size_t i = 0; i < length; i++) { for (size_t i = 0; i < length; i++) {
@@ -329,7 +329,6 @@ protected:
this->haHelper->publishSensorBoilerHeatingMaxTemp(settings.system.unitSystem, false); this->haHelper->publishSensorBoilerHeatingMaxTemp(settings.system.unitSystem, false);
this->haHelper->publishNumberHeatingMinTemp(settings.system.unitSystem, false); this->haHelper->publishNumberHeatingMinTemp(settings.system.unitSystem, false);
this->haHelper->publishNumberHeatingMaxTemp(settings.system.unitSystem, false); this->haHelper->publishNumberHeatingMaxTemp(settings.system.unitSystem, false);
this->haHelper->publishNumberHeatingMaxModulation(false);
// pid // pid
this->haHelper->publishSwitchPid(); this->haHelper->publishSwitchPid();
@@ -357,6 +356,7 @@ protected:
// sensors // sensors
this->haHelper->publishSensorModulation(false); this->haHelper->publishSensorModulation(false);
this->haHelper->publishSensorPressure(settings.system.unitSystem, false); this->haHelper->publishSensorPressure(settings.system.unitSystem, false);
this->haHelper->publishSensorPower();
this->haHelper->publishSensorFaultCode(); this->haHelper->publishSensorFaultCode();
this->haHelper->publishSensorDiagnosticCode(); this->haHelper->publishSensorDiagnosticCode();
this->haHelper->publishSensorRssi(false); this->haHelper->publishSensorRssi(false);

View File

@@ -185,7 +185,11 @@ protected:
); );
if (!CustomOpenTherm::isValidResponse(response)) { if (!CustomOpenTherm::isValidResponse(response)) {
Log.swarningln(FPSTR(L_OT), F("Invalid response after setBoilerStatus: %s"), CustomOpenTherm::statusToString(this->instance->getLastResponseStatus())); Log.swarningln(
FPSTR(L_OT),
F("Failed receive boiler status: %s"),
CustomOpenTherm::statusToString(this->instance->getLastResponseStatus())
);
} }
if (!vars.states.otStatus && millis() - this->lastSuccessResponse < 1150) { if (!vars.states.otStatus && millis() - this->lastSuccessResponse < 1150) {
@@ -241,6 +245,12 @@ protected:
vars.states.fault = CustomOpenTherm::isFault(response); vars.states.fault = CustomOpenTherm::isFault(response);
vars.states.diagnostic = CustomOpenTherm::isDiagnostic(response); vars.states.diagnostic = CustomOpenTherm::isDiagnostic(response);
Log.snoticeln(
FPSTR(L_OT),
F("Received boiler status. Heating: %hhu; DHW: %hhu; flame: %hhu; fault: %hhu; diag: %hhu"),
vars.states.heating, vars.states.dhw, vars.states.flame, vars.states.fault, vars.states.diagnostic
);
// Fault state // Fault state
if (this->configuredFaultStateGpio != GPIO_IS_NOT_CONFIGURED) { if (this->configuredFaultStateGpio != GPIO_IS_NOT_CONFIGURED) {
bool fState = vars.states.fault ^ settings.opentherm.invertFaultState ? HIGH : LOW; bool fState = vars.states.fault ^ settings.opentherm.invertFaultState ? HIGH : LOW;
@@ -253,20 +263,44 @@ protected:
// These parameters will be updated every minute // These parameters will be updated every minute
if (millis() - this->prevUpdateNonEssentialVars > 60000) { if (millis() - this->prevUpdateNonEssentialVars > 60000) {
if (!heatingEnabled && settings.opentherm.modulationSyncWithHeating) { if (this->updateMinModulationLevel()) {
if (this->setMaxModulationLevel(0)) { Log.snoticeln(
Log.snoticeln(FPSTR(L_OT_HEATING), F("Set max modulation 0% (off)")); FPSTR(L_OT),
F("Received min modulation: %hhu%%, max power: %hhu kW"),
vars.parameters.minModulation,
vars.parameters.maxPower
);
} else { if (settings.opentherm.maxModulation < vars.parameters.minModulation) {
Log.swarningln(FPSTR(L_OT_HEATING), F("Failed set max modulation 0% (off)")); settings.opentherm.maxModulation = vars.parameters.minModulation;
fsSettings.update();
Log.swarningln(FPSTR(L_SETTINGS_OT), F("Updated min modulation: %hhu%%"), settings.opentherm.maxModulation);
}
if (fabsf(settings.opentherm.maxPower) < 0.1f && vars.parameters.maxPower > 0) {
settings.opentherm.maxPower = vars.parameters.maxPower;
fsSettings.update();
Log.swarningln(FPSTR(L_SETTINGS_OT), F("Updated max power: %.2f kW"), settings.opentherm.maxPower);
} }
} else { } else {
if (this->setMaxModulationLevel(settings.heating.maxModulation)) { Log.swarningln(FPSTR(L_OT), F("Failed receive min modulation and max power"));
Log.snoticeln(FPSTR(L_OT_HEATING), F("Set max modulation %hhu%%"), settings.heating.maxModulation); }
if (!heatingEnabled && settings.opentherm.modulationSyncWithHeating) {
if (this->setMaxModulationLevel(0)) {
Log.snoticeln(FPSTR(L_OT), F("Set max modulation: 0% (off)"));
} else { } else {
Log.swarningln(FPSTR(L_OT_HEATING), F("Failed set max modulation %hhu%%"), settings.heating.maxModulation); Log.swarningln(FPSTR(L_OT), F("Failed set max modulation: 0% (off)"));
}
} else {
if (this->setMaxModulationLevel(settings.opentherm.maxModulation)) {
Log.snoticeln(FPSTR(L_OT), F("Set max modulation: %hhu%%"), settings.opentherm.maxModulation);
} else {
Log.swarningln(FPSTR(L_OT), F("Failed set max modulation: %hhu%%"), settings.opentherm.maxModulation);
} }
} }
@@ -274,23 +308,30 @@ protected:
// Get DHW min/max temp (if necessary) // Get DHW min/max temp (if necessary)
if (settings.opentherm.dhwPresent && settings.opentherm.getMinMaxTemp) { if (settings.opentherm.dhwPresent && settings.opentherm.getMinMaxTemp) {
if (this->updateMinMaxDhwTemp()) { if (this->updateMinMaxDhwTemp()) {
Log.snoticeln(
FPSTR(L_OT_DHW),
F("Received min temp: %hhu, max temp: %hhu"),
vars.parameters.dhwMinTemp,
vars.parameters.dhwMaxTemp
);
if (settings.dhw.minTemp < vars.parameters.dhwMinTemp) { if (settings.dhw.minTemp < vars.parameters.dhwMinTemp) {
settings.dhw.minTemp = vars.parameters.dhwMinTemp; settings.dhw.minTemp = vars.parameters.dhwMinTemp;
fsSettings.update(); fsSettings.update();
Log.snoticeln(FPSTR(L_OT_DHW), F("Updated min temp: %hhu"), settings.dhw.minTemp); Log.swarningln(FPSTR(L_SETTINGS_DHW), F("Updated min temp: %hhu"), settings.dhw.minTemp);
} }
if (settings.dhw.maxTemp > vars.parameters.dhwMaxTemp) { if (settings.dhw.maxTemp > vars.parameters.dhwMaxTemp) {
settings.dhw.maxTemp = vars.parameters.dhwMaxTemp; settings.dhw.maxTemp = vars.parameters.dhwMaxTemp;
fsSettings.update(); fsSettings.update();
Log.snoticeln(FPSTR(L_OT_DHW), F("Updated max temp: %hhu"), settings.dhw.maxTemp); Log.swarningln(FPSTR(L_SETTINGS_DHW), F("Updated max temp: %hhu"), settings.dhw.maxTemp);
} }
} else { } else {
vars.parameters.dhwMinTemp = convertTemp(DEFAULT_DHW_MIN_TEMP, UnitSystem::METRIC, settings.system.unitSystem); vars.parameters.dhwMinTemp = convertTemp(DEFAULT_DHW_MIN_TEMP, UnitSystem::METRIC, settings.system.unitSystem);
vars.parameters.dhwMaxTemp = convertTemp(DEFAULT_DHW_MAX_TEMP, UnitSystem::METRIC, settings.system.unitSystem); vars.parameters.dhwMaxTemp = convertTemp(DEFAULT_DHW_MAX_TEMP, UnitSystem::METRIC, settings.system.unitSystem);
Log.swarningln(FPSTR(L_OT_DHW), F("Failed get min/max temp")); Log.swarningln(FPSTR(L_OT_DHW), F("Failed receive min/max temp"));
} }
if (settings.dhw.minTemp >= settings.dhw.maxTemp) { if (settings.dhw.minTemp >= settings.dhw.maxTemp) {
@@ -304,23 +345,30 @@ protected:
// Get heating min/max temp // Get heating min/max temp
if (settings.opentherm.getMinMaxTemp) { if (settings.opentherm.getMinMaxTemp) {
if (this->updateMinMaxHeatingTemp()) { if (this->updateMinMaxHeatingTemp()) {
Log.snoticeln(
FPSTR(L_OT_HEATING),
F("Received min temp: %hhu, max temp: %hhu"),
vars.parameters.heatingMinTemp,
vars.parameters.heatingMaxTemp
);
if (settings.heating.minTemp < vars.parameters.heatingMinTemp) { if (settings.heating.minTemp < vars.parameters.heatingMinTemp) {
settings.heating.minTemp = vars.parameters.heatingMinTemp; settings.heating.minTemp = vars.parameters.heatingMinTemp;
fsSettings.update(); fsSettings.update();
Log.snoticeln(FPSTR(L_OT_HEATING), F("Updated min temp: %hhu"), settings.heating.minTemp); Log.swarningln(FPSTR(L_SETTINGS_HEATING), F("Updated min temp: %hhu"), settings.heating.minTemp);
} }
if (settings.heating.maxTemp > vars.parameters.heatingMaxTemp) { if (settings.heating.maxTemp > vars.parameters.heatingMaxTemp) {
settings.heating.maxTemp = vars.parameters.heatingMaxTemp; settings.heating.maxTemp = vars.parameters.heatingMaxTemp;
fsSettings.update(); fsSettings.update();
Log.snoticeln(FPSTR(L_OT_HEATING), F("Updated max temp: %hhu"), settings.heating.maxTemp); Log.swarningln(FPSTR(L_SETTINGS_HEATING), F("Updated max temp: %hhu"), settings.heating.maxTemp);
} }
} else { } else {
vars.parameters.heatingMinTemp = convertTemp(DEFAULT_HEATING_MIN_TEMP, UnitSystem::METRIC, settings.system.unitSystem); vars.parameters.heatingMinTemp = convertTemp(DEFAULT_HEATING_MIN_TEMP, UnitSystem::METRIC, settings.system.unitSystem);
vars.parameters.heatingMaxTemp = convertTemp(DEFAULT_HEATING_MAX_TEMP, UnitSystem::METRIC, settings.system.unitSystem); vars.parameters.heatingMaxTemp = convertTemp(DEFAULT_HEATING_MAX_TEMP, UnitSystem::METRIC, settings.system.unitSystem);
Log.swarningln(FPSTR(L_OT_HEATING), F("Failed get min/max temp")); Log.swarningln(FPSTR(L_OT_HEATING), F("Failed receive min/max temp"));
} }
} }
@@ -332,7 +380,19 @@ protected:
// Get fault code (if necessary) // Get fault code (if necessary)
if (vars.states.fault) { if (vars.states.fault) {
this->updateFaultCode(); if (this->updateFaultCode()) {
Log.snoticeln(
FPSTR(L_OT),
F("Received fault code: %hhu%% (0x%02X)"),
vars.sensors.faultCode,
vars.sensors.faultCode
);
} else {
vars.sensors.faultCode = 0;
Log.swarningln(FPSTR(L_OT), F("Failed receive fault code"));
}
} else if (vars.sensors.faultCode != 0) { } else if (vars.sensors.faultCode != 0) {
vars.sensors.faultCode = 0; vars.sensors.faultCode = 0;
@@ -340,7 +400,19 @@ protected:
// Get diagnostic code (if necessary) // Get diagnostic code (if necessary)
if (vars.states.fault || vars.states.diagnostic) { if (vars.states.fault || vars.states.diagnostic) {
this->updateDiagCode(); if (this->updateDiagCode()) {
Log.snoticeln(
FPSTR(L_OT),
F("Received diag code: %hhu%% (0x%02X)"),
vars.sensors.diagnosticCode,
vars.sensors.diagnosticCode
);
} else {
vars.sensors.diagnosticCode = 0;
Log.swarningln(FPSTR(L_OT), F("Failed receive diag code"));
}
} else if (vars.sensors.diagnosticCode != 0) { } else if (vars.sensors.diagnosticCode != 0) {
vars.sensors.diagnosticCode = 0; vars.sensors.diagnosticCode = 0;
@@ -351,11 +423,21 @@ protected:
if (!settings.opentherm.filterNumValues.enable) { if (!settings.opentherm.filterNumValues.enable) {
// Get outdoor temp (if necessary) // Get outdoor temp (if necessary)
if (settings.sensors.outdoor.type == SensorType::BOILER) { if (settings.sensors.outdoor.type == SensorType::BOILER) {
this->updateOutdoorTemp(); if (this->updateOutdoorTemp()) {
Log.snoticeln(FPSTR(L_OT), F("Received outdoor temp: %.2f"), vars.temperatures.outdoor);
} else {
Log.swarningln(FPSTR(L_OT), F("Failed receive outdoor temp"));
}
} }
// Get pressure // Get pressure
this->updatePressure(); if (this->updatePressure()) {
Log.snoticeln(FPSTR(L_OT), F("Received pressure: %.2f"), vars.sensors.pressure);
} else {
Log.swarningln(FPSTR(L_OT), F("Failed receive pressure"));
}
} }
this->prevUpdateNonEssentialVars = millis(); this->prevUpdateNonEssentialVars = millis();
@@ -364,16 +446,51 @@ protected:
// Get current modulation level (if necessary) // Get current modulation level (if necessary)
if (vars.states.flame) { if (vars.states.flame) {
this->updateModulationLevel(); if (this->updateModulationLevel()) {
if (settings.opentherm.maxPower > 0.1f) {
float modulatedPower = settings.opentherm.maxPower - settings.opentherm.minPower;
vars.sensors.power = settings.opentherm.minPower + (modulatedPower / 100.0f * vars.sensors.modulation);
} else {
vars.sensors.power = 0.0f;
}
Log.snoticeln(
FPSTR(L_OT),
F("Received modulation level: %.2f%%, power: %.2f of %.2f kW (min: %.2f kW)"),
vars.sensors.modulation,
vars.sensors.power,
settings.opentherm.maxPower,
settings.opentherm.minPower
);
} else {
vars.sensors.modulation = 0;
vars.sensors.power = 0;
Log.swarningln(FPSTR(L_OT), F("Failed receive modulation level"));
}
} else { } else {
vars.sensors.modulation = 0; vars.sensors.modulation = 0;
vars.sensors.power = 0;
} }
// Update DHW sensors (if necessary) // Update DHW sensors (if necessary)
if (settings.opentherm.dhwPresent) { if (settings.opentherm.dhwPresent) {
this->updateDhwTemp(); if (this->updateDhwTemp()) {
this->updateDhwFlowRate(); Log.snoticeln(FPSTR(L_OT_DHW), F("Received temp: %.2f"), vars.temperatures.dhw);
} else {
Log.swarningln(FPSTR(L_OT_DHW), F("Failed receive temp"));
}
if (this->updateDhwFlowRate()) {
Log.snoticeln(FPSTR(L_OT_DHW), F("Received flow rate: %.2f"), vars.sensors.dhwFlowRate);
} else {
Log.swarningln(FPSTR(L_OT_DHW), F("Failed receive flow rate"));
}
} else { } else {
vars.temperatures.dhw = 0.0f; vars.temperatures.dhw = 0.0f;
@@ -381,24 +498,49 @@ protected:
} }
// Get current heating temp // Get current heating temp
this->updateHeatingTemp(); if (this->updateHeatingTemp()) {
Log.snoticeln(FPSTR(L_OT_HEATING), F("Received temp: %.2f"), vars.temperatures.heating);
} else {
Log.swarningln(FPSTR(L_OT_HEATING), F("Failed receive temp"));
}
// Get heating return temp // Get heating return temp
this->updateHeatingReturnTemp(); if (this->updateHeatingReturnTemp()) {
Log.snoticeln(FPSTR(L_OT_HEATING), F("Received return temp: %.2f"), vars.temperatures.heatingReturn);
} else {
Log.swarningln(FPSTR(L_OT_HEATING), F("Failed receive return temp"));
}
// Get exhaust temp // Get exhaust temp
this->updateExhaustTemp(); if (this->updateExhaustTemp()) {
Log.snoticeln(FPSTR(L_OT), F("Received exhaust temp: %.2f"), vars.temperatures.exhaust);
} else {
Log.swarningln(FPSTR(L_OT), F("Failed receive exhaust temp"));
}
// If filtering is enabled, these parameters // If filtering is enabled, these parameters
// must be updated every time. // must be updated every time.
if (settings.opentherm.filterNumValues.enable) { if (settings.opentherm.filterNumValues.enable) {
// Get outdoor temp (if necessary) // Get outdoor temp (if necessary)
if (settings.sensors.outdoor.type == SensorType::BOILER) { if (settings.sensors.outdoor.type == SensorType::BOILER) {
this->updateOutdoorTemp(); if (this->updateOutdoorTemp()) {
Log.snoticeln(FPSTR(L_OT), F("Received outdoor temp: %.2f"), vars.temperatures.outdoor);
} else {
Log.swarningln(FPSTR(L_OT), F("Failed receive outdoor temp"));
}
} }
// Get pressure // Get pressure
this->updatePressure(); if (this->updatePressure()) {
Log.snoticeln(FPSTR(L_OT), F("Received pressure: %.2f"), vars.sensors.pressure);
} else {
Log.swarningln(FPSTR(L_OT), F("Failed receive pressure"));
}
} }
@@ -549,46 +691,46 @@ protected:
void initialize() { void initialize() {
// Not all boilers support these, only try once when the boiler becomes connected // Not all boilers support these, only try once when the boiler becomes connected
if (this->updateSlaveVersion()) { if (this->updateSlaveVersion()) {
Log.straceln(FPSTR(L_OT), F("Slave version: %u, type: %u"), vars.parameters.slaveVersion, vars.parameters.slaveType); Log.snoticeln(FPSTR(L_OT), F("Received slave version: %u, type: %u"), vars.parameters.slaveVersion, vars.parameters.slaveType);
} else { } else {
Log.swarningln(FPSTR(L_OT), F("Get slave version failed")); Log.swarningln(FPSTR(L_OT), F("Failed receive slave version"));
} }
// 0x013F // 0x013F
if (this->setMasterVersion(0x3F, 0x01)) { if (this->setMasterVersion(0x3F, 0x01)) {
Log.straceln(FPSTR(L_OT), F("Master version: %u, type: %u"), vars.parameters.masterVersion, vars.parameters.masterType); Log.snoticeln(FPSTR(L_OT), F("Set master version: %u, type: %u"), vars.parameters.masterVersion, vars.parameters.masterType);
} else { } else {
Log.swarningln(FPSTR(L_OT), F("Set master version failed")); Log.swarningln(FPSTR(L_OT), F("Failed set master version"));
} }
if (this->updateSlaveOtVersion()) { if (this->updateSlaveOtVersion()) {
Log.straceln(FPSTR(L_OT), F("Slave OT version: %f"), vars.parameters.slaveOtVersion); Log.snoticeln(FPSTR(L_OT), F("Received slave OT version: %f"), vars.parameters.slaveOtVersion);
} else { } else {
Log.swarningln(FPSTR(L_OT), F("Get slave OT version failed")); Log.swarningln(FPSTR(L_OT), F("Failed receive slave OT version"));
} }
if (this->setMasterOtVersion(2.2f)) { if (this->setMasterOtVersion(2.2f)) {
Log.straceln(FPSTR(L_OT), F("Master OT version: %f"), vars.parameters.masterOtVersion); Log.snoticeln(FPSTR(L_OT), F("Set master OT version: %f"), vars.parameters.masterOtVersion);
} else { } else {
Log.swarningln(FPSTR(L_OT), F("Set master OT version failed")); Log.swarningln(FPSTR(L_OT), F("Failed set master OT version"));
} }
if (this->updateSlaveConfig()) { if (this->updateSlaveConfig()) {
Log.straceln(FPSTR(L_OT), F("Slave member id: %u, flags: %u"), vars.parameters.slaveMemberId, vars.parameters.slaveFlags); Log.snoticeln(FPSTR(L_OT), F("Received slave member id: %u, flags: %u"), vars.parameters.slaveMemberId, vars.parameters.slaveFlags);
} else { } else {
Log.swarningln(FPSTR(L_OT), F("Get slave config failed")); Log.swarningln(FPSTR(L_OT), F("Failed receive slave config"));
} }
if (this->setMasterConfig(settings.opentherm.memberIdCode & 0xFF, (settings.opentherm.memberIdCode & 0xFFFF) >> 8)) { if (this->setMasterConfig(settings.opentherm.memberIdCode & 0xFF, (settings.opentherm.memberIdCode & 0xFFFF) >> 8)) {
Log.straceln(FPSTR(L_OT), F("Master member id: %u, flags: %u"), vars.parameters.masterMemberId, vars.parameters.masterFlags); Log.snoticeln(FPSTR(L_OT), F("Set master member id: %u, flags: %u"), vars.parameters.masterMemberId, vars.parameters.masterFlags);
} else { } else {
Log.swarningln(FPSTR(L_OT), F("Set master config failed")); Log.swarningln(FPSTR(L_OT), F("Failed set master config"));
} }
} }
@@ -999,7 +1141,6 @@ protected:
)); ));
if (!CustomOpenTherm::isValidResponse(response)) { if (!CustomOpenTherm::isValidResponse(response)) {
vars.sensors.faultCode = 0;
return false; return false;
} }
@@ -1015,7 +1156,6 @@ protected:
)); ));
if (!CustomOpenTherm::isValidResponse(response)) { if (!CustomOpenTherm::isValidResponse(response)) {
vars.sensors.diagnosticCode = 0;
return false; return false;
} }
@@ -1035,6 +1175,10 @@ protected:
} }
float value = CustomOpenTherm::getFloat(response); float value = CustomOpenTherm::getFloat(response);
if (value < 0) {
return false;
}
if (settings.opentherm.filterNumValues.enable && fabs(vars.sensors.modulation) >= 0.1f) { if (settings.opentherm.filterNumValues.enable && fabs(vars.sensors.modulation) >= 0.1f) {
vars.sensors.modulation += (value - vars.sensors.modulation) * settings.opentherm.filterNumValues.factor; vars.sensors.modulation += (value - vars.sensors.modulation) * settings.opentherm.filterNumValues.factor;
@@ -1045,6 +1189,23 @@ protected:
return true; return true;
} }
bool updateMinModulationLevel() {
unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
OpenThermRequestType::READ_DATA,
OpenThermMessageID::MaxCapacityMinModLevel,
0
));
if (!CustomOpenTherm::isValidResponse(response)) {
return false;
}
vars.parameters.minModulation = response & 0xFF;
vars.parameters.maxPower = (response & 0xFFFF) >> 8;
return true;
}
bool updatePressure() { bool updatePressure() {
unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest( unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
OpenThermRequestType::READ_DATA, OpenThermRequestType::READ_DATA,

View File

@@ -1,5 +1,5 @@
#define PORTAL_CACHE_TIME "max-age=86400" #define PORTAL_CACHE_TIME "max-age=86400"
#define PORTAL_CACHE settings.system.debug ? nullptr : PORTAL_CACHE_TIME #define PORTAL_CACHE (settings.system.logLevel >= TinyLogger::Level::TRACE ? nullptr : PORTAL_CACHE_TIME)
#ifdef ARDUINO_ARCH_ESP8266 #ifdef ARDUINO_ARCH_ESP8266
#include <ESP8266WebServer.h> #include <ESP8266WebServer.h>
#include <Updater.h> #include <Updater.h>

View File

@@ -24,7 +24,7 @@ struct NetworkSettings {
struct Settings { struct Settings {
struct { struct {
bool debug = DEBUG_BY_DEFAULT; uint8_t logLevel = DEFAULT_LOG_LEVEL;
struct { struct {
bool enable = USE_SERIAL; bool enable = USE_SERIAL;
@@ -54,8 +54,11 @@ struct Settings {
byte faultStateGpio = DEFAULT_OT_FAULT_STATE_GPIO; byte faultStateGpio = DEFAULT_OT_FAULT_STATE_GPIO;
byte invertFaultState = false; byte invertFaultState = false;
unsigned int memberIdCode = 0; unsigned int memberIdCode = 0;
uint8_t maxModulation = 100;
float pressureFactor = 1.0f; float pressureFactor = 1.0f;
float dhwFlowRateFactor = 1.0f; float dhwFlowRateFactor = 1.0f;
float minPower = 0.0f;
float maxPower = 0.0f;
bool dhwPresent = true; bool dhwPresent = true;
bool summerWinterMode = false; bool summerWinterMode = false;
bool heatingCh2Enabled = true; bool heatingCh2Enabled = true;
@@ -103,7 +106,6 @@ struct Settings {
float hysteresis = 0.5f; float hysteresis = 0.5f;
byte minTemp = DEFAULT_HEATING_MIN_TEMP; byte minTemp = DEFAULT_HEATING_MIN_TEMP;
byte maxTemp = DEFAULT_HEATING_MAX_TEMP; byte maxTemp = DEFAULT_HEATING_MAX_TEMP;
byte maxModulation = 100;
} heating; } heating;
struct { struct {
@@ -174,6 +176,7 @@ struct Variables {
float modulation = 0.0f; float modulation = 0.0f;
float pressure = 0.0f; float pressure = 0.0f;
float dhwFlowRate = 0.0f; float dhwFlowRate = 0.0f;
float power = 0.0f;
byte faultCode = 0; byte faultCode = 0;
unsigned short diagnosticCode = 0; unsigned short diagnosticCode = 0;
int8_t rssi = 0; int8_t rssi = 0;
@@ -210,7 +213,9 @@ struct Variables {
unsigned long extPumpLastEnableTime = 0; unsigned long extPumpLastEnableTime = 0;
byte dhwMinTemp = DEFAULT_DHW_MIN_TEMP; byte dhwMinTemp = DEFAULT_DHW_MIN_TEMP;
byte dhwMaxTemp = DEFAULT_DHW_MAX_TEMP; byte dhwMaxTemp = DEFAULT_DHW_MAX_TEMP;
byte minModulation = 0;
byte maxModulation = 0; byte maxModulation = 0;
uint8_t maxPower = 0;
uint8_t slaveMemberId = 0; uint8_t slaveMemberId = 0;
uint8_t slaveFlags = 0; uint8_t slaveFlags = 0;
uint8_t slaveType = 0; uint8_t slaveType = 0;

View File

@@ -62,8 +62,8 @@
#define DEFAULT_STA_PASSWORD "" #define DEFAULT_STA_PASSWORD ""
#endif #endif
#ifndef DEBUG_BY_DEFAULT #ifndef DEFAULT_LOG_LEVEL
#define DEBUG_BY_DEFAULT false #define DEFAULT_LOG_LEVEL TinyLogger::Level::VERBOSE
#endif #endif
#ifndef DEFAULT_STATUS_LED_GPIO #ifndef DEFAULT_STATUS_LED_GPIO

View File

@@ -129,7 +129,9 @@ void setup() {
Log.addStream(telnetStream); Log.addStream(telnetStream);
} }
Log.setLevel(settings.system.debug ? TinyLogger::Level::VERBOSE : TinyLogger::Level::INFO); if (settings.system.logLevel >= TinyLogger::Level::SILENT && settings.system.logLevel <= TinyLogger::Level::VERBOSE) {
Log.setLevel(static_cast<TinyLogger::Level>(settings.system.logLevel));
}
// network // network
network = (new NetworkMgr) network = (new NetworkMgr)

View File

@@ -4,6 +4,9 @@
#endif #endif
const char L_SETTINGS[] PROGMEM = "SETTINGS"; const char L_SETTINGS[] PROGMEM = "SETTINGS";
const char L_SETTINGS_OT[] PROGMEM = "SETTINGS.OT";
const char L_SETTINGS_DHW[] PROGMEM = "SETTINGS.DHW";
const char L_SETTINGS_HEATING[] PROGMEM = "SETTINGS.HEATING";
const char L_NETWORK[] PROGMEM = "NETWORK"; const char L_NETWORK[] PROGMEM = "NETWORK";
const char L_NETWORK_SETTINGS[] PROGMEM = "NETWORK.SETTINGS"; const char L_NETWORK_SETTINGS[] PROGMEM = "NETWORK.SETTINGS";
const char L_PORTAL_WEBSERVER[] PROGMEM = "PORTAL.WEBSERVER"; const char L_PORTAL_WEBSERVER[] PROGMEM = "PORTAL.WEBSERVER";

View File

@@ -326,7 +326,7 @@ bool jsonToNetworkSettings(const JsonVariantConst src, NetworkSettings& dst) {
void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) { void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
if (!safe) { if (!safe) {
dst["system"]["debug"] = src.system.debug; dst["system"]["logLevel"] = static_cast<uint8_t>(src.system.logLevel);
dst["system"]["serial"]["enable"] = src.system.serial.enable; dst["system"]["serial"]["enable"] = src.system.serial.enable;
dst["system"]["serial"]["baudrate"] = src.system.serial.baudrate; dst["system"]["serial"]["baudrate"] = src.system.serial.baudrate;
dst["system"]["telnet"]["enable"] = src.system.telnet.enable; dst["system"]["telnet"]["enable"] = src.system.telnet.enable;
@@ -345,8 +345,11 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
dst["opentherm"]["faultStateGpio"] = src.opentherm.faultStateGpio; dst["opentherm"]["faultStateGpio"] = src.opentherm.faultStateGpio;
dst["opentherm"]["invertFaultState"] = src.opentherm.invertFaultState; dst["opentherm"]["invertFaultState"] = src.opentherm.invertFaultState;
dst["opentherm"]["memberIdCode"] = src.opentherm.memberIdCode; dst["opentherm"]["memberIdCode"] = src.opentherm.memberIdCode;
dst["opentherm"]["maxModulation"] = src.opentherm.maxModulation;
dst["opentherm"]["pressureFactor"] = roundd(src.opentherm.pressureFactor, 2); dst["opentherm"]["pressureFactor"] = roundd(src.opentherm.pressureFactor, 2);
dst["opentherm"]["dhwFlowRateFactor"] = roundd(src.opentherm.dhwFlowRateFactor, 2); dst["opentherm"]["dhwFlowRateFactor"] = roundd(src.opentherm.dhwFlowRateFactor, 2);
dst["opentherm"]["minPower"] = roundd(src.opentherm.minPower, 2);
dst["opentherm"]["maxPower"] = roundd(src.opentherm.maxPower, 2);
dst["opentherm"]["dhwPresent"] = src.opentherm.dhwPresent; dst["opentherm"]["dhwPresent"] = src.opentherm.dhwPresent;
dst["opentherm"]["summerWinterMode"] = src.opentherm.summerWinterMode; dst["opentherm"]["summerWinterMode"] = src.opentherm.summerWinterMode;
dst["opentherm"]["heatingCh2Enabled"] = src.opentherm.heatingCh2Enabled; dst["opentherm"]["heatingCh2Enabled"] = src.opentherm.heatingCh2Enabled;
@@ -386,7 +389,6 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
dst["heating"]["hysteresis"] = roundd(src.heating.hysteresis, 2); dst["heating"]["hysteresis"] = roundd(src.heating.hysteresis, 2);
dst["heating"]["minTemp"] = src.heating.minTemp; dst["heating"]["minTemp"] = src.heating.minTemp;
dst["heating"]["maxTemp"] = src.heating.maxTemp; dst["heating"]["maxTemp"] = src.heating.maxTemp;
dst["heating"]["maxModulation"] = src.heating.maxModulation;
dst["dhw"]["enable"] = src.dhw.enable; dst["dhw"]["enable"] = src.dhw.enable;
dst["dhw"]["target"] = roundd(src.dhw.target, 1); dst["dhw"]["target"] = roundd(src.dhw.target, 1);
@@ -457,11 +459,11 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
if (!safe) { if (!safe) {
// system // system
if (src["system"]["debug"].is<bool>()) { if (!src["system"]["logLevel"].isNull()) {
bool value = src["system"]["debug"].as<bool>(); uint8_t value = src["system"]["logLevel"].as<uint8_t>();
if (value != dst.system.debug) { if (value != dst.system.logLevel && value >= TinyLogger::Level::SILENT && value <= TinyLogger::Level::VERBOSE) {
dst.system.debug = value; dst.system.logLevel = value;
changed = true; changed = true;
} }
} }
@@ -698,6 +700,15 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
} }
} }
if (!src["opentherm"]["maxModulation"].isNull()) {
unsigned char value = src["opentherm"]["maxModulation"].as<unsigned char>();
if (value > 0 && value <= 100 && value != dst.opentherm.maxModulation) {
dst.opentherm.maxModulation = value;
changed = true;
}
}
if (!src["opentherm"]["pressureFactor"].isNull()) { if (!src["opentherm"]["pressureFactor"].isNull()) {
float value = src["opentherm"]["pressureFactor"].as<float>(); float value = src["opentherm"]["pressureFactor"].as<float>();
@@ -716,6 +727,24 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
} }
} }
if (!src["opentherm"]["minPower"].isNull()) {
float value = src["opentherm"]["minPower"].as<float>();
if (value >= 0 && value <= 1000 && fabs(value - dst.opentherm.minPower) > 0.0001f) {
dst.opentherm.minPower = roundd(value, 2);
changed = true;
}
}
if (!src["opentherm"]["maxPower"].isNull()) {
float value = src["opentherm"]["maxPower"].as<float>();
if (value >= 0 && value <= 1000 && fabs(value - dst.opentherm.maxPower) > 0.0001f) {
dst.opentherm.maxPower = roundd(value, 2);
changed = true;
}
}
if (src["opentherm"]["filterNumValues"]["enable"].is<bool>()) { if (src["opentherm"]["filterNumValues"]["enable"].is<bool>()) {
bool value = src["opentherm"]["filterNumValues"]["enable"].as<bool>(); bool value = src["opentherm"]["filterNumValues"]["enable"].as<bool>();
@@ -1185,15 +1214,6 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
} }
} }
if (!src["heating"]["maxModulation"].isNull()) {
unsigned char value = src["heating"]["maxModulation"].as<unsigned char>();
if (value > 0 && value <= 100 && value != dst.heating.maxModulation) {
dst.heating.maxModulation = value;
changed = true;
}
}
// dhw // dhw
if (src["dhw"]["enable"].is<bool>()) { if (src["dhw"]["enable"].is<bool>()) {
@@ -1546,6 +1566,7 @@ void varsToJson(const Variables& src, JsonVariant dst) {
dst["sensors"]["modulation"] = roundd(src.sensors.modulation, 2); dst["sensors"]["modulation"] = roundd(src.sensors.modulation, 2);
dst["sensors"]["pressure"] = roundd(src.sensors.pressure, 2); dst["sensors"]["pressure"] = roundd(src.sensors.pressure, 2);
dst["sensors"]["dhwFlowRate"] = roundd(src.sensors.dhwFlowRate, 2); dst["sensors"]["dhwFlowRate"] = roundd(src.sensors.dhwFlowRate, 2);
dst["sensors"]["power"] = roundd(src.sensors.power, 2);
dst["sensors"]["faultCode"] = src.sensors.faultCode; dst["sensors"]["faultCode"] = src.sensors.faultCode;
dst["sensors"]["diagnosticCode"] = src.sensors.diagnosticCode; dst["sensors"]["diagnosticCode"] = src.sensors.diagnosticCode;
dst["sensors"]["rssi"] = src.sensors.rssi; dst["sensors"]["rssi"] = src.sensors.rssi;

View File

@@ -9,6 +9,7 @@
"releases": "Releases" "releases": "Releases"
}, },
"dbm": "dBm", "dbm": "dBm",
"kw": "kW",
"button": { "button": {
"upgrade": "Upgrade", "upgrade": "Upgrade",
@@ -99,6 +100,7 @@
"modulation": "Modulation", "modulation": "Modulation",
"pressure": "Pressure", "pressure": "Pressure",
"dhwFlowRate": "DHW flow rate", "dhwFlowRate": "DHW flow rate",
"power": "Current power",
"faultCode": "Fault code", "faultCode": "Fault code",
"diagCode": "Diagnostic code", "diagCode": "Diagnostic code",
"indoorTemp": "Indoor temp", "indoorTemp": "Indoor temp",
@@ -196,13 +198,10 @@
"metric": "Metric <small>(celsius, liters, bar)</small>", "metric": "Metric <small>(celsius, liters, bar)</small>",
"imperial": "Imperial <small>(fahrenheit, gallons, psi)</small>", "imperial": "Imperial <small>(fahrenheit, gallons, psi)</small>",
"statusLedGpio": "Status LED GPIO", "statusLedGpio": "Status LED GPIO",
"debug": "Debug mode", "logLevel": "Log level",
"serial": { "serial": {
"enable": "Enable Serial port", "enable": "Enable Serial port",
"baud": { "baud": "Serial port baud rate"
"title": "Serial port baud rate",
"note": "Available: 9600, 19200, 38400, 57600, 74880, 115200"
}
}, },
"telnet": { "telnet": {
"enable": "Enable Telnet", "enable": "Enable Telnet",
@@ -214,8 +213,7 @@
}, },
"heating": { "heating": {
"hyst": "Hysteresis <small>(in degrees)</small>", "hyst": "Hysteresis <small>(in degrees)</small>"
"maxMod": "Max modulation level"
}, },
"emergency": { "emergency": {
@@ -257,10 +255,12 @@
}, },
"ot": { "ot": {
"advanced": "Advanced Settings",
"inGpio": "In GPIO", "inGpio": "In GPIO",
"outGpio": "Out GPIO", "outGpio": "Out GPIO",
"ledGpio": "RX LED GPIO", "ledGpio": "RX LED GPIO",
"memberIdCode": "Master MemberID code", "memberIdCode": "Master MemberID code",
"maxMod": "Max modulation level",
"pressureFactor": { "pressureFactor": {
"title": "Coeff. pressure correction", "title": "Coeff. pressure correction",
"note": "If the pressure displayed is <b>X10</b> from the real one, set the <b>0.1</b>." "note": "If the pressure displayed is <b>X10</b> from the real one, set the <b>0.1</b>."
@@ -269,6 +269,14 @@
"title": "Coeff. DHW flow rate correction", "title": "Coeff. DHW flow rate correction",
"note": "If the DHW flow rate displayed is <b>X10</b> from the real one, set the <b>0.1</b>." "note": "If the DHW flow rate displayed is <b>X10</b> from the real one, set the <b>0.1</b>."
}, },
"minPower": {
"title": "Min boiler power <small>(kW)</small>",
"note": "This value is at 0-1% boiler modulation level. Typically found in the boiler specification as \"minimum useful heat output\"."
},
"maxPower": {
"title": "Max boiler power <small>(kW)</small>",
"note": "<b>0</b> - try detect automatically. Typically found in the boiler specification as \"maximum useful heat output\"."
},
"fnv": { "fnv": {
"title": "Filtering numeric values", "title": "Filtering numeric values",
"enable": { "enable": {

View File

@@ -9,6 +9,7 @@
"releases": "Релизы" "releases": "Релизы"
}, },
"dbm": "дБм", "dbm": "дБм",
"kw": "кВт",
"button": { "button": {
"upgrade": "Обновить", "upgrade": "Обновить",
@@ -99,6 +100,7 @@
"modulation": "Уровень модуляции", "modulation": "Уровень модуляции",
"pressure": "Давление", "pressure": "Давление",
"dhwFlowRate": "Расход ГВС", "dhwFlowRate": "Расход ГВС",
"power": "Текущая мощность",
"faultCode": "Код ошибки", "faultCode": "Код ошибки",
"diagCode": "Диагностический код", "diagCode": "Диагностический код",
"indoorTemp": "Внутренняя темп.", "indoorTemp": "Внутренняя темп.",
@@ -196,13 +198,10 @@
"metric": "Метрическая <small>(цильсии, литры, бары)</small>", "metric": "Метрическая <small>(цильсии, литры, бары)</small>",
"imperial": "Imperial <small>(фаренгейты, галлоны, psi)</small>", "imperial": "Imperial <small>(фаренгейты, галлоны, psi)</small>",
"statusLedGpio": "Статус LED GPIO", "statusLedGpio": "Статус LED GPIO",
"debug": "Отладка", "logLevel": "Уровень логирования",
"serial": { "serial": {
"enable": "Вкл. Serial порт", "enable": "Вкл. Serial порт",
"baud": { "baud": "Скорость Serial порта"
"title": "Скорость Serial порта",
"note": "Доступно: 9600, 19200, 38400, 57600, 74880, 115200"
}
}, },
"telnet": { "telnet": {
"enable": "Вкл. Telnet", "enable": "Вкл. Telnet",
@@ -214,8 +213,7 @@
}, },
"heating": { "heating": {
"hyst": "Гистерезис <small>(в градусах)</small>", "hyst": "Гистерезис <small>(в градусах)</small>"
"maxMod": "Макс. уровень модуляции"
}, },
"emergency": { "emergency": {
@@ -257,10 +255,12 @@
}, },
"ot": { "ot": {
"advanced": "Дополнительные настройки",
"inGpio": "Вход GPIO", "inGpio": "Вход GPIO",
"outGpio": "Выход GPIO", "outGpio": "Выход GPIO",
"ledGpio": "RX LED GPIO", "ledGpio": "RX LED GPIO",
"memberIdCode": "Master MemberID код", "memberIdCode": "Master MemberID код",
"maxMod": "Макс. уровень модуляции",
"pressureFactor": { "pressureFactor": {
"title": "Коэфф. коррекции давления", "title": "Коэфф. коррекции давления",
"note": "Если давление отображается <b>Х10</b> от реального, установите значение <b>0.1</b>." "note": "Если давление отображается <b>Х10</b> от реального, установите значение <b>0.1</b>."
@@ -269,6 +269,14 @@
"title": "Коэфф. коррекции потока ГВС", "title": "Коэфф. коррекции потока ГВС",
"note": "Если поток ГВС отображается <b>Х10</b> от реального, установите значение <b>0.1</b>." "note": "Если поток ГВС отображается <b>Х10</b> от реального, установите значение <b>0.1</b>."
}, },
"minPower": {
"title": "Мин. мощность котла <small>(кВт)</small>",
"note": "Это значение соответствует уровню модуляции котла 01%. Обычно можно найти в спецификации котла как \"минимальная полезная тепловая мощность\"."
},
"maxPower": {
"title": "Макс. мощность котла <small>(кВт)</small>",
"note": "<b>0</b> - попробовать определить автоматически. Обычно можно найти в спецификации котла как \"максимальная полезная тепловая мощность\"."
},
"fnv": { "fnv": {
"title": "Фильтрация числовых значений", "title": "Фильтрация числовых значений",
"enable": { "enable": {

View File

@@ -158,6 +158,10 @@
<th scope="row" data-i18n>dashboard.state.dhwFlowRate</th> <th scope="row" data-i18n>dashboard.state.dhwFlowRate</th>
<td><b id="ot-dhw-flow-rate"></b> <span class="volume-unit"></span>/min</td> <td><b id="ot-dhw-flow-rate"></b> <span class="volume-unit"></span>/min</td>
</tr> </tr>
<tr>
<th scope="row" data-i18n>dashboard.state.power</th>
<td><b id="ot-power"></b> <span data-i18n>kw</span></td>
</tr>
<tr> <tr>
<th scope="row" data-i18n>dashboard.state.faultCode</th> <th scope="row" data-i18n>dashboard.state.faultCode</th>
<td><b id="ot-fault-code"></b></td> <td><b id="ot-fault-code"></b></td>
@@ -434,6 +438,7 @@
setValue('#ot-modulation', result.sensors.modulation); setValue('#ot-modulation', result.sensors.modulation);
setValue('#ot-pressure', result.sensors.pressure); setValue('#ot-pressure', result.sensors.pressure);
setValue('#ot-dhw-flow-rate', result.sensors.dhwFlowRate); setValue('#ot-dhw-flow-rate', result.sensors.dhwFlowRate);
setValue('#ot-power', result.sensors.power);
setValue( setValue(
'#ot-fault-code', '#ot-fault-code',
result.sensors.faultCode result.sensors.faultCode

View File

@@ -94,11 +94,6 @@
<fieldset> <fieldset>
<legend data-i18n>settings.section.diag</legend> <legend data-i18n>settings.section.diag</legend>
<label for="system-debug">
<input type="checkbox" id="system-debug" name="system[debug]" value="true">
<span data-i18n>settings.system.debug</span>
</label>
<label for="system-serial-enable"> <label for="system-serial-enable">
<input type="checkbox" id="system-serial-enable" name="system[serial][enable]" value="true"> <input type="checkbox" id="system-serial-enable" name="system[serial][enable]" value="true">
<span data-i18n>settings.system.serial.enable</span> <span data-i18n>settings.system.serial.enable</span>
@@ -109,11 +104,31 @@
<span data-i18n>settings.system.telnet.enable</span> <span data-i18n>settings.system.telnet.enable</span>
</label> </label>
<label for="system-log-level">
<span data-i18n>settings.system.logLevel</span>
<select id="system-log-level" name="system[logLevel]">
<option value="0">SILENT</option>
<option value="1">FATAL</option>
<option value="2">ERROR</option>
<option value="3">WARNING</option>
<option value="4">INFO</option>
<option value="5">NOTICE</option>
<option value="6">TRACE</option>
<option value="7">VERBOSE</option>
</select>
</label>
<div class="grid"> <div class="grid">
<label for="system-serial-baudrate"> <label for="system-serial-baudrate">
<span data-i18n>settings.system.serial.baud.title</span> <span data-i18n>settings.system.serial.baud</span>
<input type="number" inputmode="numeric" id="system-serial-baudrate" name="system[serial][baudrate]" min="9600" max="115200" step="1" required> <select id="system-serial-baudrate" name="system[serial][baudrate]" required>
<small data-i18n>settings.system.serial.baud.note</small> <option value="9600">9600</option>
<option value="19200">19200</option>
<option value="38400">38400</option>
<option value="57600">57600</option>
<option value="74880">74880</option>
<option value="115200">115200</option>
</select>
</label> </label>
<label for="system-telnet-port"> <label for="system-telnet-port">
@@ -151,17 +166,10 @@
</label> </label>
</div> </div>
<div class="grid"> <label for="heating-hysteresis">
<label for="heating-hysteresis"> <span data-i18n>settings.heating.hyst</span>
<span data-i18n>settings.heating.hyst</span> <input type="number" inputmode="numeric" id="heating-hysteresis" name="heating[hysteresis]" min="0" max="5" step="0.05" required>
<input type="number" inputmode="numeric" id="heating-hysteresis" name="heating[hysteresis]" min="0" max="5" step="0.05" required> </label>
</label>
<label for="heating-max-modulation">
<span data-i18n>settings.heating.maxMod</span>
<input type="number" inputmode="numeric" id="heating-max-modulation" name="heating[maxModulation]" min="1" max="100" step="1" required>
</label>
</div>
<button type="submit" data-i18n>button.save</button> <button type="submit" data-i18n>button.save</button>
</form> </form>
@@ -386,32 +394,37 @@
<span data-i18n>settings.ot.outGpio</span> <span data-i18n>settings.ot.outGpio</span>
<input type="number" inputmode="numeric" id="opentherm-out-gpio" name="opentherm[outGpio]" min="0" max="254" step="1"> <input type="number" inputmode="numeric" id="opentherm-out-gpio" name="opentherm[outGpio]" min="0" max="254" step="1">
</label> </label>
</div>
<div class="grid">
<label for="opentherm-rx-led-gpio"> <label for="opentherm-rx-led-gpio">
<span data-i18n>settings.ot.ledGpio</span> <span data-i18n>settings.ot.ledGpio</span>
<input type="number" inputmode="numeric" id="opentherm-rx-led-gpio" name="opentherm[rxLedGpio]" min="0" max="254" step="1"> <input type="number" inputmode="numeric" id="opentherm-rx-led-gpio" name="opentherm[rxLedGpio]" min="0" max="254" step="1">
<small data-i18n>settings.note.blankNotUse</small> <small data-i18n>settings.note.blankNotUse</small>
</label> </label>
</div>
<div class="grid">
<label for="opentherm-member-id-code"> <label for="opentherm-member-id-code">
<span data-i18n>settings.ot.memberIdCode</span> <span data-i18n>settings.ot.memberIdCode</span>
<input type="number" inputmode="numeric" id="opentherm-member-id-code" name="opentherm[memberIdCode]" min="0" max="65535" step="1" required> <input type="number" inputmode="numeric" id="opentherm-member-id-code" name="opentherm[memberIdCode]" min="0" max="65535" step="1" required>
</label> </label>
<label for="opentherm-max-modulation">
<span data-i18n>settings.ot.maxMod</span>
<input type="number" inputmode="numeric" id="opentherm-max-modulation" name="opentherm[maxModulation]" min="1" max="100" step="1" required>
</label>
</div> </div>
<div class="grid"> <div class="grid">
<label for="opentherm-pressure-factor"> <label for="opentherm-min-power">
<span data-i18n>settings.ot.pressureFactor.title</span> <span data-i18n>settings.ot.minPower.title</span>
<input type="number" inputmode="numeric" id="opentherm-pressure-factor" name="opentherm[pressureFactor]" min="0.1" max="100" step="0.01"> <input type="number" inputmode="numeric" id="opentherm-min-power" name="opentherm[minPower]" min="0" max="1000" step="0.1">
<small data-i18n>settings.ot.pressureFactor.note</small> <small data-i18n>settings.ot.minPower.note</small>
</label> </label>
<label for="opentherm-dhw-fr-factor"> <label for="opentherm-max-power">
<span data-i18n>settings.ot.dhwFlowRateFactor.title</span> <span data-i18n>settings.ot.maxPower.title</span>
<input type="number" inputmode="numeric" id="opentherm-dhw-fr-factor" name="opentherm[dhwFlowRateFactor]" min="0.1" max="100" step="0.01"> <input type="number" inputmode="numeric" id="opentherm-max-power" name="opentherm[maxPower]" min="0" max="1000" step="0.1">
<small data-i18n>settings.ot.dhwFlowRateFactor.note</small> <small data-i18n>settings.ot.maxPower.note</small>
</label> </label>
</div> </div>
@@ -462,40 +475,6 @@
<span data-i18n>settings.ot.options.immergasFix</span> <span data-i18n>settings.ot.options.immergasFix</span>
</label> </label>
<hr />
<fieldset>
<legend>
<span data-i18n>settings.ot.fnv.title</span>
</legend>
<label for="opentherm-fnv-enable">
<input type="checkbox" id="opentherm-fnv-enable" name="opentherm[filterNumValues][enable]" value="true">
<span data-i18n>settings.ot.fnv.enable.title</span>
<br>
<small data-i18n>settings.ot.fnv.enable.note</small>
</label>
<label for="opentherm-fnv-factor">
<span data-i18n>settings.ot.fnv.factor.title</span>
<input type="number" inputmode="numeric" id="opentherm-fnv-factor" name="opentherm[filterNumValues][factor]" min="0.01" max="1" step="0.01">
<small data-i18n>settings.ot.fnv.factor.note</small>
</label>
</fieldset>
<hr />
<fieldset>
<label for="opentherm-fault-state-gpio">
<span data-i18n>settings.ot.faultState.gpio</span>
<input type="number" inputmode="numeric" id="opentherm-fault-state-gpio" name="opentherm[faultStateGpio]" min="0" max="254" step="1">
<small data-i18n>settings.ot.faultState.note</small>
</label>
<label for="opentherm-invert-fault-state">
<input type="checkbox" id="opentherm-invert-fault-state" name="opentherm[invertFaultState]" value="true">
<span data-i18n>settings.ot.faultState.invert</span>
</label>
</fieldset>
<hr /> <hr />
<label for="opentherm-native-heating-control"> <label for="opentherm-native-heating-control">
<input type="checkbox" id="opentherm-native-heating-control" name="opentherm[nativeHeatingControl]" value="true"> <input type="checkbox" id="opentherm-native-heating-control" name="opentherm[nativeHeatingControl]" value="true">
@@ -503,6 +482,60 @@
<small data-i18n>settings.ot.nativeHeating.note</small> <small data-i18n>settings.ot.nativeHeating.note</small>
</label> </label>
</fieldset> </fieldset>
<hr />
<details>
<summary role="button" class="secondary" data-i18n>settings.ot.advanced</summary>
<div>
<div class="grid">
<label for="opentherm-pressure-factor">
<span data-i18n>settings.ot.pressureFactor.title</span>
<input type="number" inputmode="numeric" id="opentherm-pressure-factor" name="opentherm[pressureFactor]" min="0.1" max="100" step="0.01">
<small data-i18n>settings.ot.pressureFactor.note</small>
</label>
<label for="opentherm-dhw-fr-factor">
<span data-i18n>settings.ot.dhwFlowRateFactor.title</span>
<input type="number" inputmode="numeric" id="opentherm-dhw-fr-factor" name="opentherm[dhwFlowRateFactor]" min="0.1" max="100" step="0.01">
<small data-i18n>settings.ot.dhwFlowRateFactor.note</small>
</label>
</div>
<hr />
<fieldset>
<legend>
<span data-i18n>settings.ot.fnv.title</span>
</legend>
<label for="opentherm-fnv-enable">
<input type="checkbox" id="opentherm-fnv-enable" name="opentherm[filterNumValues][enable]" value="true">
<span data-i18n>settings.ot.fnv.enable.title</span>
<br>
<small data-i18n>settings.ot.fnv.enable.note</small>
</label>
<label for="opentherm-fnv-factor">
<span data-i18n>settings.ot.fnv.factor.title</span>
<input type="number" inputmode="numeric" id="opentherm-fnv-factor" name="opentherm[filterNumValues][factor]" min="0.01" max="1" step="0.01">
<small data-i18n>settings.ot.fnv.factor.note</small>
</label>
</fieldset>
<hr />
<fieldset>
<label for="opentherm-fault-state-gpio">
<span data-i18n>settings.ot.faultState.gpio</span>
<input type="number" inputmode="numeric" id="opentherm-fault-state-gpio" name="opentherm[faultStateGpio]" min="0" max="254" step="1">
<small data-i18n>settings.ot.faultState.note</small>
</label>
<label for="opentherm-invert-fault-state">
<input type="checkbox" id="opentherm-invert-fault-state" name="opentherm[invertFaultState]" value="true">
<span data-i18n>settings.ot.faultState.invert</span>
</label>
</fieldset>
</div>
</details>
<button type="submit" data-i18n>button.save</button> <button type="submit" data-i18n>button.save</button>
</form> </form>
@@ -743,9 +776,9 @@
const fillData = (data) => { const fillData = (data) => {
// System // System
setCheckboxValue('#system-debug', data.system.debug); setSelectValue('#system-log-level', data.system.logLevel);
setCheckboxValue('#system-serial-enable', data.system.serial.enable); setCheckboxValue('#system-serial-enable', data.system.serial.enable);
setInputValue('#system-serial-baudrate', data.system.serial.baudrate); setSelectValue('#system-serial-baudrate', data.system.serial.baudrate);
setCheckboxValue('#system-telnet-enable', data.system.telnet.enable); setCheckboxValue('#system-telnet-enable', data.system.telnet.enable);
setInputValue('#system-telnet-port', data.system.telnet.port); setInputValue('#system-telnet-port', data.system.telnet.port);
setRadioValue('.system-unit-system', data.system.unitSystem); setRadioValue('.system-unit-system', data.system.unitSystem);
@@ -766,8 +799,11 @@
setInputValue('#opentherm-fault-state-gpio', data.opentherm.faultStateGpio < 255 ? data.opentherm.faultStateGpio : ''); setInputValue('#opentherm-fault-state-gpio', data.opentherm.faultStateGpio < 255 ? data.opentherm.faultStateGpio : '');
setCheckboxValue('#opentherm-invert-fault-state', data.opentherm.invertFaultState); setCheckboxValue('#opentherm-invert-fault-state', data.opentherm.invertFaultState);
setInputValue('#opentherm-member-id-code', data.opentherm.memberIdCode); setInputValue('#opentherm-member-id-code', data.opentherm.memberIdCode);
setInputValue('#opentherm-max-modulation', data.opentherm.maxModulation);
setInputValue('#opentherm-pressure-factor', data.opentherm.pressureFactor); setInputValue('#opentherm-pressure-factor', data.opentherm.pressureFactor);
setInputValue('#opentherm-dhw-fr-factor', data.opentherm.dhwFlowRateFactor); setInputValue('#opentherm-dhw-fr-factor', data.opentherm.dhwFlowRateFactor);
setInputValue('#opentherm-min-power', data.opentherm.minPower);
setInputValue('#opentherm-max-power', data.opentherm.maxPower);
setCheckboxValue('#opentherm-dhw-present', data.opentherm.dhwPresent); setCheckboxValue('#opentherm-dhw-present', data.opentherm.dhwPresent);
setCheckboxValue('#opentherm-sw-mode', data.opentherm.summerWinterMode); setCheckboxValue('#opentherm-sw-mode', data.opentherm.summerWinterMode);
setCheckboxValue('#opentherm-heating-ch2-enabled', data.opentherm.heatingCh2Enabled); setCheckboxValue('#opentherm-heating-ch2-enabled', data.opentherm.heatingCh2Enabled);
@@ -825,7 +861,6 @@
"max": data.system.unitSystem == 0 ? 100 : 212 "max": data.system.unitSystem == 0 ? 100 : 212
}); });
setInputValue('#heating-hysteresis', data.heating.hysteresis); setInputValue('#heating-hysteresis', data.heating.hysteresis);
setInputValue('#heating-max-modulation', data.heating.maxModulation);
setBusy('#heating-settings-busy', '#heating-settings', false); setBusy('#heating-settings-busy', '#heating-settings', false);
// DHW // DHW

View File

@@ -539,6 +539,17 @@ function setInputValue(selector, value, attrs = {}) {
} }
} }
function setSelectValue(selector, value) {
let item = document.querySelector(selector);
if (!item) {
return;
}
for (let option of item.options) {
option.selected = option.value == value;
}
}
function show(selector) { function show(selector) {
let items = document.querySelectorAll(selector); let items = document.querySelectorAll(selector);
if (!items.length) { if (!items.length) {