mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-10 18:24:27 +05:00
feat: added opentherm option for filtering numeric values
This commit is contained in:
@@ -810,12 +810,19 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
vars.temperatures.outdoor = settings.sensors.outdoor.offset + convertTemp(
|
float value = settings.sensors.outdoor.offset + convertTemp(
|
||||||
CustomOpenTherm::getFloat(response),
|
CustomOpenTherm::getFloat(response),
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (settings.opentherm.filteringNumValues && fabs(vars.temperatures.outdoor) >= 0.1f) {
|
||||||
|
vars.temperatures.outdoor += (value - vars.temperatures.outdoor) * EXT_SENSORS_FILTER_K;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
vars.temperatures.outdoor = value;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -835,12 +842,19 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
vars.temperatures.exhaust = convertTemp(
|
value = convertTemp(
|
||||||
value,
|
value,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (settings.opentherm.filteringNumValues && fabs(vars.temperatures.exhaust) >= 0.1f) {
|
||||||
|
vars.temperatures.exhaust += (value - vars.temperatures.exhaust) * EXT_SENSORS_FILTER_K;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
vars.temperatures.exhaust = value;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -860,12 +874,19 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
vars.temperatures.heating = convertTemp(
|
value = convertTemp(
|
||||||
value,
|
value,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (settings.opentherm.filteringNumValues && fabs(vars.temperatures.heating) >= 0.1f) {
|
||||||
|
vars.temperatures.heating += (value - vars.temperatures.heating) * EXT_SENSORS_FILTER_K;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
vars.temperatures.heating = value;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -880,12 +901,20 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
vars.temperatures.heatingReturn = convertTemp(
|
float value = convertTemp(
|
||||||
CustomOpenTherm::getFloat(response),
|
CustomOpenTherm::getFloat(response),
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (settings.opentherm.filteringNumValues && fabs(vars.temperatures.heatingReturn) >= 0.1f) {
|
||||||
|
vars.temperatures.heatingReturn += (value - vars.temperatures.heatingReturn) * EXT_SENSORS_FILTER_K;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
vars.temperatures.heatingReturn = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -906,12 +935,19 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
vars.temperatures.dhw = convertTemp(
|
value = convertTemp(
|
||||||
value,
|
value,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (settings.opentherm.filteringNumValues && fabs(vars.temperatures.dhw) >= 0.1f) {
|
||||||
|
vars.temperatures.dhw += (value - vars.temperatures.dhw) * EXT_SENSORS_FILTER_K;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
vars.temperatures.dhw = value;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -983,7 +1019,13 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
vars.sensors.modulation = CustomOpenTherm::getFloat(response);
|
float value = CustomOpenTherm::getFloat(response);
|
||||||
|
if (settings.opentherm.filteringNumValues && fabs(vars.sensors.modulation) >= 0.1f) {
|
||||||
|
vars.sensors.modulation += (value - vars.sensors.modulation) * EXT_SENSORS_FILTER_K;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
vars.sensors.modulation = value;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1004,12 +1046,19 @@ protected:
|
|||||||
this->pressureMultiplier = 10;
|
this->pressureMultiplier = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
vars.sensors.pressure = convertPressure(
|
value = convertPressure(
|
||||||
value / this->pressureMultiplier,
|
value / this->pressureMultiplier,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (settings.opentherm.filteringNumValues && fabs(vars.sensors.pressure) >= 0.1f) {
|
||||||
|
vars.sensors.pressure += (value - vars.sensors.pressure) * EXT_SENSORS_FILTER_K;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
vars.sensors.pressure = value;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ struct Settings {
|
|||||||
bool getMinMaxTemp = true;
|
bool getMinMaxTemp = true;
|
||||||
bool nativeHeatingControl = false;
|
bool nativeHeatingControl = false;
|
||||||
bool immergasFix = false;
|
bool immergasFix = false;
|
||||||
|
bool filteringNumValues = false;
|
||||||
} opentherm;
|
} opentherm;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|||||||
10
src/utils.h
10
src/utils.h
@@ -355,6 +355,7 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
|
|||||||
dst["opentherm"]["getMinMaxTemp"] = src.opentherm.getMinMaxTemp;
|
dst["opentherm"]["getMinMaxTemp"] = src.opentherm.getMinMaxTemp;
|
||||||
dst["opentherm"]["nativeHeatingControl"] = src.opentherm.nativeHeatingControl;
|
dst["opentherm"]["nativeHeatingControl"] = src.opentherm.nativeHeatingControl;
|
||||||
dst["opentherm"]["immergasFix"] = src.opentherm.immergasFix;
|
dst["opentherm"]["immergasFix"] = src.opentherm.immergasFix;
|
||||||
|
dst["opentherm"]["filteringNumValues"] = src.opentherm.filteringNumValues;
|
||||||
|
|
||||||
dst["mqtt"]["enable"] = src.mqtt.enable;
|
dst["mqtt"]["enable"] = src.mqtt.enable;
|
||||||
dst["mqtt"]["server"] = src.mqtt.server;
|
dst["mqtt"]["server"] = src.mqtt.server;
|
||||||
@@ -810,6 +811,15 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (src["opentherm"]["filteringNumValues"].is<bool>()) {
|
||||||
|
bool value = src["opentherm"]["filteringNumValues"].as<bool>();
|
||||||
|
|
||||||
|
if (value != dst.opentherm.filteringNumValues) {
|
||||||
|
dst.opentherm.filteringNumValues = value;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// mqtt
|
// mqtt
|
||||||
if (src["mqtt"]["enable"].is<bool>()) {
|
if (src["mqtt"]["enable"].is<bool>()) {
|
||||||
|
|||||||
@@ -271,7 +271,8 @@
|
|||||||
"dhwBlocking": "DHW blocking",
|
"dhwBlocking": "DHW blocking",
|
||||||
"modulationSyncWithHeating": "Sync modulation with heating",
|
"modulationSyncWithHeating": "Sync modulation with heating",
|
||||||
"getMinMaxTemp": "Get min/max temp from boiler",
|
"getMinMaxTemp": "Get min/max temp from boiler",
|
||||||
"immergasFix": "Fix for Immergas boilers"
|
"immergasFix": "Fix for Immergas boilers",
|
||||||
|
"filteringNumValues": "Use filtering for numeric values"
|
||||||
},
|
},
|
||||||
|
|
||||||
"faultState": {
|
"faultState": {
|
||||||
|
|||||||
@@ -271,7 +271,8 @@
|
|||||||
"dhwBlocking": "DHW blocking",
|
"dhwBlocking": "DHW blocking",
|
||||||
"modulationSyncWithHeating": "Синхронизировать модуляцию с отоплением",
|
"modulationSyncWithHeating": "Синхронизировать модуляцию с отоплением",
|
||||||
"getMinMaxTemp": "Получать мин. и макс. температуру от котла",
|
"getMinMaxTemp": "Получать мин. и макс. температуру от котла",
|
||||||
"immergasFix": "Фикс для котлов Immergas"
|
"immergasFix": "Фикс для котлов Immergas",
|
||||||
|
"filteringNumValues": "Использовать фильтрацию для числовых значений"
|
||||||
},
|
},
|
||||||
|
|
||||||
"faultState": {
|
"faultState": {
|
||||||
|
|||||||
@@ -443,11 +443,16 @@
|
|||||||
<span data-i18n>settings.ot.options.getMinMaxTemp</span>
|
<span data-i18n>settings.ot.options.getMinMaxTemp</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label for="opentherm-immergas-fix"></label>
|
<label for="opentherm-immergas-fix">
|
||||||
<input type="checkbox" id="opentherm-immergas-fix" name="opentherm[immergasFix]" value="true">
|
<input type="checkbox" id="opentherm-immergas-fix" name="opentherm[immergasFix]" value="true">
|
||||||
<span data-i18n>settings.ot.options.immergasFix</span>
|
<span data-i18n>settings.ot.options.immergasFix</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<label for="opentherm-filtering-num-values">
|
||||||
|
<input type="checkbox" id="opentherm-filtering-num-values" name="opentherm[filteringNumValues]" value="true">
|
||||||
|
<span data-i18n>settings.ot.options.filteringNumValues</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="opentherm-fault-state-gpio">
|
<label for="opentherm-fault-state-gpio">
|
||||||
@@ -742,6 +747,7 @@
|
|||||||
setCheckboxValue('#opentherm-get-min-max-temp', data.opentherm.getMinMaxTemp);
|
setCheckboxValue('#opentherm-get-min-max-temp', data.opentherm.getMinMaxTemp);
|
||||||
setCheckboxValue('#opentherm-native-heating-control', data.opentherm.nativeHeatingControl);
|
setCheckboxValue('#opentherm-native-heating-control', data.opentherm.nativeHeatingControl);
|
||||||
setCheckboxValue('#opentherm-immergas-fix', data.opentherm.immergasFix);
|
setCheckboxValue('#opentherm-immergas-fix', data.opentherm.immergasFix);
|
||||||
|
setCheckboxValue('#opentherm-filtering-num-values', data.opentherm.filteringNumValues);
|
||||||
setBusy('#opentherm-settings-busy', '#opentherm-settings', false);
|
setBusy('#opentherm-settings-busy', '#opentherm-settings', false);
|
||||||
|
|
||||||
// MQTT
|
// MQTT
|
||||||
|
|||||||
Reference in New Issue
Block a user