mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-12 03:04:27 +05:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95d508553d | ||
|
|
d474be26dc | ||
|
|
d54a9cf2d7 | ||
|
|
98e5fe42e8 |
@@ -27,9 +27,6 @@ let paths = {
|
|||||||
'src_data/scripts/i18n.min.js',
|
'src_data/scripts/i18n.min.js',
|
||||||
'src_data/scripts/lang.js',
|
'src_data/scripts/lang.js',
|
||||||
'src_data/scripts/utils.js'
|
'src_data/scripts/utils.js'
|
||||||
],
|
|
||||||
'chart.js': [
|
|
||||||
'src_data/scripts/chart.js'
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
63
lib/Equitherm/Equitherm.h
Normal file
63
lib/Equitherm/Equitherm.h
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
#if defined(EQUITHERM_INTEGER)
|
||||||
|
// расчёты с целыми числами
|
||||||
|
typedef int datatype;
|
||||||
|
#else
|
||||||
|
// расчёты с float числами
|
||||||
|
typedef float datatype;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class Equitherm {
|
||||||
|
public:
|
||||||
|
datatype targetTemp = 0;
|
||||||
|
datatype indoorTemp = 0;
|
||||||
|
datatype outdoorTemp = 0;
|
||||||
|
float Kn = 0.0;
|
||||||
|
float Kk = 0.0;
|
||||||
|
float Kt = 0.0;
|
||||||
|
|
||||||
|
Equitherm() = default;
|
||||||
|
|
||||||
|
// kn, kk, kt
|
||||||
|
Equitherm(float new_kn, float new_kk, float new_kt) {
|
||||||
|
Kn = new_kn;
|
||||||
|
Kk = new_kk;
|
||||||
|
Kt = new_kt;
|
||||||
|
}
|
||||||
|
|
||||||
|
// лимит выходной величины
|
||||||
|
void setLimits(unsigned short min_output, unsigned short max_output) {
|
||||||
|
_minOut = min_output;
|
||||||
|
_maxOut = max_output;
|
||||||
|
}
|
||||||
|
|
||||||
|
// возвращает новое значение при вызове
|
||||||
|
datatype getResult() {
|
||||||
|
datatype output = getResultN() + getResultK() + getResultT();
|
||||||
|
output = constrain(output, _minOut, _maxOut); // ограничиваем выход
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned short _minOut = 20, _maxOut = 90;
|
||||||
|
|
||||||
|
// температура контура отопления в зависимости от наружной температуры
|
||||||
|
datatype getResultN() {
|
||||||
|
float a = (-0.21 * Kn) - 0.06; // a = -0,21k — 0,06
|
||||||
|
float b = (6.04 * Kn) + 1.98; // b = 6,04k + 1,98
|
||||||
|
float c = (-5.06 * Kn) + 18.06; // с = -5,06k + 18,06
|
||||||
|
float x = (-0.2 * outdoorTemp) + 5; // x = -0.2*t1 + 5
|
||||||
|
return (a * x * x) + (b * x) + c; // Tn = ax2 + bx + c
|
||||||
|
}
|
||||||
|
|
||||||
|
// поправка на желаемую комнатную температуру
|
||||||
|
datatype getResultK() {
|
||||||
|
return (targetTemp - 20) * Kk;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Расчет поправки (ошибки) термостата
|
||||||
|
datatype getResultT() {
|
||||||
|
return constrain((targetTemp - indoorTemp), -3, 3) * Kt;
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -14,7 +14,7 @@ extra_configs = secrets.default.ini
|
|||||||
core_dir = .pio
|
core_dir = .pio
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
version = 1.6.0
|
version = 1.5.6
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
bblanchon/ArduinoJson@^7.4.2
|
bblanchon/ArduinoJson@^7.4.2
|
||||||
@@ -98,7 +98,7 @@ board_build.partitions = esp32_partitions.csv
|
|||||||
lib_deps =
|
lib_deps =
|
||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
laxilef/ESP32Scheduler@^1.0.1
|
laxilef/ESP32Scheduler@^1.0.1
|
||||||
nimble_lib = h2zero/NimBLE-Arduino@2.3.7
|
nimble_lib = h2zero/NimBLE-Arduino@2.3.3
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
extra_scripts =
|
extra_scripts =
|
||||||
post:tools/esp32.py
|
post:tools/esp32.py
|
||||||
@@ -234,7 +234,7 @@ build_flags =
|
|||||||
${esp32_defaults.build_flags}
|
${esp32_defaults.build_flags}
|
||||||
-D ARDUINO_USB_MODE=0
|
-D ARDUINO_USB_MODE=0
|
||||||
-D ARDUINO_USB_CDC_ON_BOOT=1
|
-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||||
-D MYNEWT_VAL_BLE_EXT_ADV=1
|
-D CONFIG_BT_NIMBLE_EXT_ADV=1
|
||||||
-D USE_BLE=1
|
-D USE_BLE=1
|
||||||
-D DEFAULT_OT_IN_GPIO=35
|
-D DEFAULT_OT_IN_GPIO=35
|
||||||
-D DEFAULT_OT_OUT_GPIO=36
|
-D DEFAULT_OT_OUT_GPIO=36
|
||||||
@@ -260,7 +260,7 @@ build_unflags =
|
|||||||
build_type = ${esp32_defaults.build_type}
|
build_type = ${esp32_defaults.build_type}
|
||||||
build_flags =
|
build_flags =
|
||||||
${esp32_defaults.build_flags}
|
${esp32_defaults.build_flags}
|
||||||
-D MYNEWT_VAL_BLE_EXT_ADV=1
|
-D CONFIG_BT_NIMBLE_EXT_ADV=1
|
||||||
-D USE_BLE=1
|
-D USE_BLE=1
|
||||||
-D DEFAULT_OT_IN_GPIO=8
|
-D DEFAULT_OT_IN_GPIO=8
|
||||||
-D DEFAULT_OT_OUT_GPIO=10
|
-D DEFAULT_OT_OUT_GPIO=10
|
||||||
@@ -366,7 +366,7 @@ build_unflags =
|
|||||||
build_type = ${esp32_defaults.build_type}
|
build_type = ${esp32_defaults.build_type}
|
||||||
build_flags =
|
build_flags =
|
||||||
${esp32_defaults.build_flags}
|
${esp32_defaults.build_flags}
|
||||||
-D MYNEWT_VAL_BLE_EXT_ADV=1
|
-D CONFIG_BT_NIMBLE_EXT_ADV=1
|
||||||
-D USE_BLE=1
|
-D USE_BLE=1
|
||||||
-D DEFAULT_OT_IN_GPIO=3
|
-D DEFAULT_OT_IN_GPIO=3
|
||||||
-D DEFAULT_OT_OUT_GPIO=1
|
-D DEFAULT_OT_OUT_GPIO=1
|
||||||
|
|||||||
@@ -866,19 +866,19 @@ public:
|
|||||||
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_SWITCH), F("equitherm")).c_str(), doc);
|
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_SWITCH), F("equitherm")).c_str(), doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool publishInputEquithermSlope(bool enabledByDefault = true) {
|
bool publishInputEquithermFactorN(bool enabledByDefault = true) {
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_slope"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_n"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_slope"));
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_n"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("Equitherm slope");
|
doc[FPSTR(HA_NAME)] = F("Equitherm factor N");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:slope-uphill");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-n-circle-outline");
|
||||||
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
||||||
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.equitherm.slope|float(0)|round(3) }}");
|
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.equitherm.n_factor|float(0)|round(3) }}");
|
||||||
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
||||||
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"equitherm\": {\"slope\" : {{ value }}}}");
|
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"equitherm\": {\"n_factor\" : {{ value }}}}");
|
||||||
doc[FPSTR(HA_MIN)] = 0.001f;
|
doc[FPSTR(HA_MIN)] = 0.001f;
|
||||||
doc[FPSTR(HA_MAX)] = 10;
|
doc[FPSTR(HA_MAX)] = 10;
|
||||||
doc[FPSTR(HA_STEP)] = 0.001f;
|
doc[FPSTR(HA_STEP)] = 0.001f;
|
||||||
@@ -886,80 +886,56 @@ public:
|
|||||||
doc[FPSTR(HA_EXPIRE_AFTER)] = this->expireAfter;
|
doc[FPSTR(HA_EXPIRE_AFTER)] = this->expireAfter;
|
||||||
doc.shrinkToFit();
|
doc.shrinkToFit();
|
||||||
|
|
||||||
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_slope")).c_str(), doc);
|
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_n_factor")).c_str(), doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool publishInputEquithermExponent(bool enabledByDefault = true) {
|
bool publishInputEquithermFactorK(bool enabledByDefault = true) {
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_exponent"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_k"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_exponent"));
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_k"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("Equitherm exponent");
|
doc[FPSTR(HA_NAME)] = F("Equitherm factor K");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:exponent");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-k-circle-outline");
|
||||||
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
||||||
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.equitherm.exponent|float(0)|round(3) }}");
|
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.equitherm.k_factor|float(0)|round(2) }}");
|
||||||
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
||||||
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"equitherm\": {\"exponent\" : {{ value }}}}");
|
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"equitherm\": {\"k_factor\" : {{ value }}}}");
|
||||||
doc[FPSTR(HA_MIN)] = 0.1;
|
doc[FPSTR(HA_MIN)] = 0;
|
||||||
doc[FPSTR(HA_MAX)] = 2;
|
doc[FPSTR(HA_MAX)] = 10;
|
||||||
doc[FPSTR(HA_STEP)] = 0.001f;
|
|
||||||
doc[FPSTR(HA_MODE)] = FPSTR(HA_MODE_BOX);
|
|
||||||
doc[FPSTR(HA_EXPIRE_AFTER)] = this->expireAfter;
|
|
||||||
doc.shrinkToFit();
|
|
||||||
|
|
||||||
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_exponent")).c_str(), doc);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool publishInputEquithermShift(bool enabledByDefault = true) {
|
|
||||||
JsonDocument doc;
|
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_shift"));
|
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_shift"));
|
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
|
||||||
doc[FPSTR(HA_NAME)] = F("Equitherm shift");
|
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:chart-areaspline");
|
|
||||||
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
|
||||||
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.equitherm.shift|float(0)|round(2) }}");
|
|
||||||
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
|
||||||
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"equitherm\": {\"shift\" : {{ value }}}}");
|
|
||||||
doc[FPSTR(HA_MIN)] = -15;
|
|
||||||
doc[FPSTR(HA_MAX)] = 15;
|
|
||||||
doc[FPSTR(HA_STEP)] = 0.01f;
|
doc[FPSTR(HA_STEP)] = 0.01f;
|
||||||
doc[FPSTR(HA_MODE)] = FPSTR(HA_MODE_BOX);
|
doc[FPSTR(HA_MODE)] = FPSTR(HA_MODE_BOX);
|
||||||
doc[FPSTR(HA_EXPIRE_AFTER)] = this->expireAfter;
|
doc[FPSTR(HA_EXPIRE_AFTER)] = this->expireAfter;
|
||||||
doc.shrinkToFit();
|
doc.shrinkToFit();
|
||||||
|
|
||||||
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_shift")).c_str(), doc);
|
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_k_factor")).c_str(), doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool publishInputEquithermTargetDiffFactor(bool enabledByDefault = true) {
|
bool publishInputEquithermFactorT(bool enabledByDefault = true) {
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][0][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][0][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_TOPIC)] = this->settingsTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_TOPIC)] = this->settingsTopic.c_str();
|
||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.pid.enabled, 'offline', 'online') }}");
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.pid.enabled, 'offline', 'online') }}");
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_target_diff_factor"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_t"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_target_diff_factor"));
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_t"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("Equitherm target diff factor");
|
doc[FPSTR(HA_NAME)] = F("Equitherm factor T");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:chart-timeline-variant-shimmer");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-t-circle-outline");
|
||||||
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
||||||
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.equitherm.targetDiffFactor|float(0)|round(3) }}");
|
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.equitherm.t_factor|float(0)|round(2) }}");
|
||||||
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
||||||
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"equitherm\": {\"targetDiffFactor\" : {{ value }}}}");
|
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"equitherm\": {\"t_factor\" : {{ value }}}}");
|
||||||
doc[FPSTR(HA_MIN)] = 0;
|
doc[FPSTR(HA_MIN)] = 0;
|
||||||
doc[FPSTR(HA_MAX)] = 10;
|
doc[FPSTR(HA_MAX)] = 10;
|
||||||
doc[FPSTR(HA_STEP)] = 0.001f;
|
doc[FPSTR(HA_STEP)] = 0.01f;
|
||||||
doc[FPSTR(HA_MODE)] = FPSTR(HA_MODE_BOX);
|
doc[FPSTR(HA_MODE)] = FPSTR(HA_MODE_BOX);
|
||||||
doc[FPSTR(HA_EXPIRE_AFTER)] = this->expireAfter;
|
doc[FPSTR(HA_EXPIRE_AFTER)] = this->expireAfter;
|
||||||
doc.shrinkToFit();
|
doc.shrinkToFit();
|
||||||
|
|
||||||
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_target_diff_factor")).c_str(), doc);
|
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_t_factor")).c_str(), doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -503,10 +503,9 @@ protected:
|
|||||||
|
|
||||||
// equitherm
|
// equitherm
|
||||||
this->haHelper->publishSwitchEquitherm();
|
this->haHelper->publishSwitchEquitherm();
|
||||||
this->haHelper->publishInputEquithermSlope(false);
|
this->haHelper->publishInputEquithermFactorN(false);
|
||||||
this->haHelper->publishInputEquithermExponent(false);
|
this->haHelper->publishInputEquithermFactorK(false);
|
||||||
this->haHelper->publishInputEquithermShift(false);
|
this->haHelper->publishInputEquithermFactorT(false);
|
||||||
this->haHelper->publishInputEquithermTargetDiffFactor(false);
|
|
||||||
|
|
||||||
// states
|
// states
|
||||||
this->haHelper->publishStatusState();
|
this->haHelper->publishStatusState();
|
||||||
|
|||||||
@@ -1209,8 +1209,8 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set indoor temp for Native heating control/Always set indoor temp
|
// Native heating control
|
||||||
if (settings.opentherm.options.nativeHeatingControl || settings.opentherm.options.alwaysSetIndoorTemp) {
|
if (settings.opentherm.options.nativeHeatingControl) {
|
||||||
// Converted current indoor temp
|
// Converted current indoor temp
|
||||||
float convertedTemp = convertTemp(vars.master.heating.indoorTemp, settings.system.unitSystem, settings.opentherm.unitSystem);
|
float convertedTemp = convertTemp(vars.master.heating.indoorTemp, settings.system.unitSystem, settings.opentherm.unitSystem);
|
||||||
|
|
||||||
@@ -1237,13 +1237,10 @@ protected:
|
|||||||
Log.swarningln(FPSTR(L_OT_HEATING), F("Failed set current CH2 indoor temp"));
|
Log.swarningln(FPSTR(L_OT_HEATING), F("Failed set current CH2 indoor temp"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Native heating control
|
|
||||||
if (settings.opentherm.options.nativeHeatingControl) {
|
|
||||||
// Converted target indoor temp
|
// Converted target indoor temp
|
||||||
float convertedTemp = convertTemp(vars.master.heating.targetTemp, settings.system.unitSystem, settings.opentherm.unitSystem);
|
convertedTemp = convertTemp(vars.master.heating.targetTemp, settings.system.unitSystem, settings.opentherm.unitSystem);
|
||||||
|
|
||||||
// Set target indoor temp
|
// Set target indoor temp
|
||||||
if (this->needSetHeatingTemp(convertedTemp)) {
|
if (this->needSetHeatingTemp(convertedTemp)) {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
|
#include <Equitherm.h>
|
||||||
#include <GyverPID.h>
|
#include <GyverPID.h>
|
||||||
|
|
||||||
|
Equitherm etRegulator;
|
||||||
GyverPID pidRegulator(0, 0, 0);
|
GyverPID pidRegulator(0, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
@@ -155,32 +157,39 @@ protected:
|
|||||||
|
|
||||||
// if use equitherm
|
// if use equitherm
|
||||||
if (settings.equitherm.enabled) {
|
if (settings.equitherm.enabled) {
|
||||||
float tempDelta = settings.heating.target - vars.master.heating.outdoorTemp;
|
unsigned short minTemp = settings.heating.minTemp;
|
||||||
float maxPoint = settings.heating.target - (
|
unsigned short maxTemp = settings.heating.maxTemp;
|
||||||
settings.heating.maxTemp - settings.heating.target
|
float targetTemp = settings.heating.target;
|
||||||
) / settings.equitherm.slope;
|
float indoorTemp = vars.master.heating.indoorTemp;
|
||||||
|
float outdoorTemp = vars.master.heating.outdoorTemp;
|
||||||
|
|
||||||
float sf = (settings.heating.maxTemp - settings.heating.target) / pow(
|
if (settings.system.unitSystem == UnitSystem::IMPERIAL) {
|
||||||
settings.heating.target - maxPoint,
|
minTemp = f2c(minTemp);
|
||||||
1.0f / settings.equitherm.exponent
|
maxTemp = f2c(maxTemp);
|
||||||
);
|
targetTemp = f2c(targetTemp);
|
||||||
float etResult = settings.heating.target + settings.equitherm.shift + sf * (
|
indoorTemp = f2c(indoorTemp);
|
||||||
tempDelta >= 0
|
outdoorTemp = f2c(outdoorTemp);
|
||||||
? pow(tempDelta, 1.0f / settings.equitherm.exponent)
|
|
||||||
: -(pow(-(tempDelta), 1.0f / settings.equitherm.exponent))
|
|
||||||
);
|
|
||||||
|
|
||||||
// add diff
|
|
||||||
if (this->indoorSensorsConnected && !settings.pid.enabled && !settings.heating.turbo) {
|
|
||||||
etResult += constrain(
|
|
||||||
settings.heating.target - vars.master.heating.indoorTemp,
|
|
||||||
-3.0f,
|
|
||||||
3.0f
|
|
||||||
) * settings.equitherm.targetDiffFactor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// limit
|
if (!this->indoorSensorsConnected || settings.pid.enabled) {
|
||||||
etResult = constrain(etResult, settings.heating.minTemp, settings.heating.maxTemp);
|
etRegulator.Kt = 0.0f;
|
||||||
|
etRegulator.indoorTemp = 0.0f;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
etRegulator.Kt = settings.heating.turbo ? 0.0f : settings.equitherm.t_factor;
|
||||||
|
etRegulator.indoorTemp = indoorTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
etRegulator.setLimits(minTemp, maxTemp);
|
||||||
|
etRegulator.Kn = settings.equitherm.n_factor;
|
||||||
|
etRegulator.Kk = settings.equitherm.k_factor;
|
||||||
|
etRegulator.targetTemp = targetTemp;
|
||||||
|
etRegulator.outdoorTemp = outdoorTemp;
|
||||||
|
float etResult = etRegulator.getResult();
|
||||||
|
|
||||||
|
if (settings.system.unitSystem == UnitSystem::IMPERIAL) {
|
||||||
|
etResult = c2f(etResult);
|
||||||
|
}
|
||||||
|
|
||||||
if (fabsf(prevEtResult - etResult) > 0.09f) {
|
if (fabsf(prevEtResult - etResult) > 0.09f) {
|
||||||
prevEtResult = etResult;
|
prevEtResult = etResult;
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ public:
|
|||||||
|
|
||||||
static int16_t getIdByName(const char* name) {
|
static int16_t getIdByName(const char* name) {
|
||||||
if (settings == nullptr) {
|
if (settings == nullptr) {
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t id = 0; id <= getMaxSensorId(); id++) {
|
for (uint8_t id = 0; id <= getMaxSensorId(); id++) {
|
||||||
@@ -163,7 +163,7 @@ public:
|
|||||||
|
|
||||||
static int16_t getIdByObjectId(const char* objectId) {
|
static int16_t getIdByObjectId(const char* objectId) {
|
||||||
if (settings == nullptr) {
|
if (settings == nullptr) {
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
String refObjectId;
|
String refObjectId;
|
||||||
@@ -329,12 +329,12 @@ public:
|
|||||||
|
|
||||||
static float getMeanValueByPurpose(Purpose purpose, const ValueType valueType, bool onlyConnected = true) {
|
static float getMeanValueByPurpose(Purpose purpose, const ValueType valueType, bool onlyConnected = true) {
|
||||||
if (settings == nullptr || results == nullptr) {
|
if (settings == nullptr || results == nullptr) {
|
||||||
return 0.0f;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t valueId = (uint8_t) valueType;
|
uint8_t valueId = (uint8_t) valueType;
|
||||||
if (!isValidValueId(valueId)) {
|
if (!isValidValueId(valueId)) {
|
||||||
return 0.0f;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
float value = 0.0f;
|
float value = 0.0f;
|
||||||
@@ -363,7 +363,7 @@ public:
|
|||||||
|
|
||||||
static bool existsConnectedSensorsByPurpose(Purpose purpose) {
|
static bool existsConnectedSensorsByPurpose(Purpose purpose) {
|
||||||
if (settings == nullptr || results == nullptr) {
|
if (settings == nullptr || results == nullptr) {
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t id = 0; id <= getMaxSensorId(); id++) {
|
for (uint8_t id = 0; id <= getMaxSensorId(); id++) {
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ struct Settings {
|
|||||||
bool autoFaultReset = false;
|
bool autoFaultReset = false;
|
||||||
bool autoDiagReset = false;
|
bool autoDiagReset = false;
|
||||||
bool setDateAndTime = false;
|
bool setDateAndTime = false;
|
||||||
bool alwaysSetIndoorTemp = true;
|
|
||||||
bool nativeHeatingControl = false;
|
bool nativeHeatingControl = false;
|
||||||
bool immergasFix = false;
|
bool immergasFix = false;
|
||||||
} options;
|
} options;
|
||||||
@@ -160,10 +159,9 @@ struct Settings {
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
float slope = 0.7f;
|
float n_factor = 0.7f;
|
||||||
float exponent = 1.3f;
|
float k_factor = 3.0f;
|
||||||
float shift = 0.0f;
|
float t_factor = 2.0f;
|
||||||
float targetDiffFactor = 2.0f;
|
|
||||||
} equitherm;
|
} equitherm;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ const char S_ACTION[] PROGMEM = "action";
|
|||||||
const char S_ACTIONS[] PROGMEM = "actions";
|
const char S_ACTIONS[] PROGMEM = "actions";
|
||||||
const char S_ACTIVE[] PROGMEM = "active";
|
const char S_ACTIVE[] PROGMEM = "active";
|
||||||
const char S_ADDRESS[] PROGMEM = "address";
|
const char S_ADDRESS[] PROGMEM = "address";
|
||||||
const char S_ALWAYS_SET_INDOOR_TEMP[] PROGMEM = "alwaysSetIndoorTemp";
|
|
||||||
const char S_ANTI_STUCK_INTERVAL[] PROGMEM = "antiStuckInterval";
|
const char S_ANTI_STUCK_INTERVAL[] PROGMEM = "antiStuckInterval";
|
||||||
const char S_ANTI_STUCK_TIME[] PROGMEM = "antiStuckTime";
|
const char S_ANTI_STUCK_TIME[] PROGMEM = "antiStuckTime";
|
||||||
const char S_AP[] PROGMEM = "ap";
|
const char S_AP[] PROGMEM = "ap";
|
||||||
@@ -83,7 +82,6 @@ const char S_ENABLED[] PROGMEM = "enabled";
|
|||||||
const char S_ENV[] PROGMEM = "env";
|
const char S_ENV[] PROGMEM = "env";
|
||||||
const char S_EPC[] PROGMEM = "epc";
|
const char S_EPC[] PROGMEM = "epc";
|
||||||
const char S_EQUITHERM[] PROGMEM = "equitherm";
|
const char S_EQUITHERM[] PROGMEM = "equitherm";
|
||||||
const char S_EXPONENT[] PROGMEM = "exponent";
|
|
||||||
const char S_EXTERNAL_PUMP[] PROGMEM = "externalPump";
|
const char S_EXTERNAL_PUMP[] PROGMEM = "externalPump";
|
||||||
const char S_FACTOR[] PROGMEM = "factor";
|
const char S_FACTOR[] PROGMEM = "factor";
|
||||||
const char S_FAULT[] PROGMEM = "fault";
|
const char S_FAULT[] PROGMEM = "fault";
|
||||||
@@ -120,6 +118,7 @@ const char S_INVERT_STATE[] PROGMEM = "invertState";
|
|||||||
const char S_IP[] PROGMEM = "ip";
|
const char S_IP[] PROGMEM = "ip";
|
||||||
const char S_I_FACTOR[] PROGMEM = "i_factor";
|
const char S_I_FACTOR[] PROGMEM = "i_factor";
|
||||||
const char S_I_MULTIPLIER[] PROGMEM = "i_multiplier";
|
const char S_I_MULTIPLIER[] PROGMEM = "i_multiplier";
|
||||||
|
const char S_K_FACTOR[] PROGMEM = "k_factor";
|
||||||
const char S_LOGIN[] PROGMEM = "login";
|
const char S_LOGIN[] PROGMEM = "login";
|
||||||
const char S_LOG_LEVEL[] PROGMEM = "logLevel";
|
const char S_LOG_LEVEL[] PROGMEM = "logLevel";
|
||||||
const char S_LOW_TEMP[] PROGMEM = "lowTemp";
|
const char S_LOW_TEMP[] PROGMEM = "lowTemp";
|
||||||
@@ -145,6 +144,7 @@ const char S_NAME[] PROGMEM = "name";
|
|||||||
const char S_NATIVE_HEATING_CONTROL[] PROGMEM = "nativeHeatingControl";
|
const char S_NATIVE_HEATING_CONTROL[] PROGMEM = "nativeHeatingControl";
|
||||||
const char S_NETWORK[] PROGMEM = "network";
|
const char S_NETWORK[] PROGMEM = "network";
|
||||||
const char S_NTP[] PROGMEM = "ntp";
|
const char S_NTP[] PROGMEM = "ntp";
|
||||||
|
const char S_N_FACTOR[] PROGMEM = "n_factor";
|
||||||
const char S_OFFSET[] PROGMEM = "offset";
|
const char S_OFFSET[] PROGMEM = "offset";
|
||||||
const char S_ON_ENABLED_HEATING[] PROGMEM = "onEnabledHeating";
|
const char S_ON_ENABLED_HEATING[] PROGMEM = "onEnabledHeating";
|
||||||
const char S_ON_FAULT[] PROGMEM = "onFault";
|
const char S_ON_FAULT[] PROGMEM = "onFault";
|
||||||
@@ -183,11 +183,9 @@ const char S_SERIAL[] PROGMEM = "serial";
|
|||||||
const char S_SERVER[] PROGMEM = "server";
|
const char S_SERVER[] PROGMEM = "server";
|
||||||
const char S_SETTINGS[] PROGMEM = "settings";
|
const char S_SETTINGS[] PROGMEM = "settings";
|
||||||
const char S_SET_DATE_AND_TIME[] PROGMEM = "setDateAndTime";
|
const char S_SET_DATE_AND_TIME[] PROGMEM = "setDateAndTime";
|
||||||
const char S_SHIFT[] PROGMEM = "shift";
|
|
||||||
const char S_SIGNAL_QUALITY[] PROGMEM = "signalQuality";
|
const char S_SIGNAL_QUALITY[] PROGMEM = "signalQuality";
|
||||||
const char S_SIZE[] PROGMEM = "size";
|
const char S_SIZE[] PROGMEM = "size";
|
||||||
const char S_SLAVE[] PROGMEM = "slave";
|
const char S_SLAVE[] PROGMEM = "slave";
|
||||||
const char S_SLOPE[] PROGMEM = "slope";
|
|
||||||
const char S_SSID[] PROGMEM = "ssid";
|
const char S_SSID[] PROGMEM = "ssid";
|
||||||
const char S_STA[] PROGMEM = "sta";
|
const char S_STA[] PROGMEM = "sta";
|
||||||
const char S_STATE[] PROGMEM = "state";
|
const char S_STATE[] PROGMEM = "state";
|
||||||
@@ -199,7 +197,6 @@ const char S_SUBNET[] PROGMEM = "subnet";
|
|||||||
const char S_SUMMER_WINTER_MODE[] PROGMEM = "summerWinterMode";
|
const char S_SUMMER_WINTER_MODE[] PROGMEM = "summerWinterMode";
|
||||||
const char S_SYSTEM[] PROGMEM = "system";
|
const char S_SYSTEM[] PROGMEM = "system";
|
||||||
const char S_TARGET[] PROGMEM = "target";
|
const char S_TARGET[] PROGMEM = "target";
|
||||||
const char S_TARGET_DIFF_FACTOR[] PROGMEM = "targetDiffFactor";
|
|
||||||
const char S_TARGET_TEMP[] PROGMEM = "targetTemp";
|
const char S_TARGET_TEMP[] PROGMEM = "targetTemp";
|
||||||
const char S_TELNET[] PROGMEM = "telnet";
|
const char S_TELNET[] PROGMEM = "telnet";
|
||||||
const char S_TEMPERATURE[] PROGMEM = "temperature";
|
const char S_TEMPERATURE[] PROGMEM = "temperature";
|
||||||
@@ -212,6 +209,7 @@ const char S_TRESHOLD_TIME[] PROGMEM = "tresholdTime";
|
|||||||
const char S_TURBO[] PROGMEM = "turbo";
|
const char S_TURBO[] PROGMEM = "turbo";
|
||||||
const char S_TURBO_FACTOR[] PROGMEM = "turboFactor";
|
const char S_TURBO_FACTOR[] PROGMEM = "turboFactor";
|
||||||
const char S_TYPE[] PROGMEM = "type";
|
const char S_TYPE[] PROGMEM = "type";
|
||||||
|
const char S_T_FACTOR[] PROGMEM = "t_factor";
|
||||||
const char S_UNIT_SYSTEM[] PROGMEM = "unitSystem";
|
const char S_UNIT_SYSTEM[] PROGMEM = "unitSystem";
|
||||||
const char S_UPTIME[] PROGMEM = "uptime";
|
const char S_UPTIME[] PROGMEM = "uptime";
|
||||||
const char S_USE[] PROGMEM = "use";
|
const char S_USE[] PROGMEM = "use";
|
||||||
|
|||||||
50
src/utils.h
50
src/utils.h
@@ -468,7 +468,6 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
|
|||||||
otOptions[FPSTR(S_AUTO_FAULT_RESET)] = src.opentherm.options.autoFaultReset;
|
otOptions[FPSTR(S_AUTO_FAULT_RESET)] = src.opentherm.options.autoFaultReset;
|
||||||
otOptions[FPSTR(S_AUTO_DIAG_RESET)] = src.opentherm.options.autoDiagReset;
|
otOptions[FPSTR(S_AUTO_DIAG_RESET)] = src.opentherm.options.autoDiagReset;
|
||||||
otOptions[FPSTR(S_SET_DATE_AND_TIME)] = src.opentherm.options.setDateAndTime;
|
otOptions[FPSTR(S_SET_DATE_AND_TIME)] = src.opentherm.options.setDateAndTime;
|
||||||
otOptions[FPSTR(S_ALWAYS_SET_INDOOR_TEMP)] = src.opentherm.options.alwaysSetIndoorTemp;
|
|
||||||
otOptions[FPSTR(S_NATIVE_HEATING_CONTROL)] = src.opentherm.options.nativeHeatingControl;
|
otOptions[FPSTR(S_NATIVE_HEATING_CONTROL)] = src.opentherm.options.nativeHeatingControl;
|
||||||
otOptions[FPSTR(S_IMMERGAS_FIX)] = src.opentherm.options.immergasFix;
|
otOptions[FPSTR(S_IMMERGAS_FIX)] = src.opentherm.options.immergasFix;
|
||||||
|
|
||||||
@@ -520,10 +519,9 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
|
|||||||
|
|
||||||
auto equitherm = dst[FPSTR(S_EQUITHERM)].to<JsonObject>();
|
auto equitherm = dst[FPSTR(S_EQUITHERM)].to<JsonObject>();
|
||||||
equitherm[FPSTR(S_ENABLED)] = src.equitherm.enabled;
|
equitherm[FPSTR(S_ENABLED)] = src.equitherm.enabled;
|
||||||
equitherm[FPSTR(S_SLOPE)] = roundf(src.equitherm.slope, 3);
|
equitherm[FPSTR(S_N_FACTOR)] = roundf(src.equitherm.n_factor, 3);
|
||||||
equitherm[FPSTR(S_EXPONENT)] = roundf(src.equitherm.exponent, 3);
|
equitherm[FPSTR(S_K_FACTOR)] = roundf(src.equitherm.k_factor, 3);
|
||||||
equitherm[FPSTR(S_SHIFT)] = roundf(src.equitherm.shift, 2);
|
equitherm[FPSTR(S_T_FACTOR)] = roundf(src.equitherm.t_factor, 3);
|
||||||
equitherm[FPSTR(S_TARGET_DIFF_FACTOR)] = roundf(src.equitherm.targetDiffFactor, 3);
|
|
||||||
|
|
||||||
auto pid = dst[FPSTR(S_PID)].to<JsonObject>();
|
auto pid = dst[FPSTR(S_PID)].to<JsonObject>();
|
||||||
pid[FPSTR(S_ENABLED)] = src.pid.enabled;
|
pid[FPSTR(S_ENABLED)] = src.pid.enabled;
|
||||||
@@ -1004,15 +1002,6 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_ALWAYS_SET_INDOOR_TEMP)].is<bool>()) {
|
|
||||||
bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_ALWAYS_SET_INDOOR_TEMP)].as<bool>();
|
|
||||||
|
|
||||||
if (value != dst.opentherm.options.alwaysSetIndoorTemp) {
|
|
||||||
dst.opentherm.options.alwaysSetIndoorTemp = value;
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_NATIVE_HEATING_CONTROL)].is<bool>()) {
|
if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_NATIVE_HEATING_CONTROL)].is<bool>()) {
|
||||||
bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_NATIVE_HEATING_CONTROL)].as<bool>();
|
bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_NATIVE_HEATING_CONTROL)].as<bool>();
|
||||||
|
|
||||||
@@ -1140,38 +1129,29 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_SLOPE)].isNull()) {
|
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_N_FACTOR)].isNull()) {
|
||||||
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_SLOPE)].as<float>();
|
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_N_FACTOR)].as<float>();
|
||||||
|
|
||||||
if (value > 0.0f && value <= 10.0f && fabsf(value - dst.equitherm.slope) > 0.0001f) {
|
if (value > 0 && value <= 10 && fabsf(value - dst.equitherm.n_factor) > 0.0001f) {
|
||||||
dst.equitherm.slope = roundf(value, 3);
|
dst.equitherm.n_factor = roundf(value, 3);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_EXPONENT)].isNull()) {
|
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_K_FACTOR)].isNull()) {
|
||||||
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_EXPONENT)].as<float>();
|
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_K_FACTOR)].as<float>();
|
||||||
|
|
||||||
if (value > 0.0f && value <= 2.0f && fabsf(value - dst.equitherm.exponent) > 0.0001f) {
|
if (value >= 0 && value <= 10 && fabsf(value - dst.equitherm.k_factor) > 0.0001f) {
|
||||||
dst.equitherm.exponent = roundf(value, 3);
|
dst.equitherm.k_factor = roundf(value, 3);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_SHIFT)].isNull()) {
|
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_T_FACTOR)].isNull()) {
|
||||||
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_SHIFT)].as<float>();
|
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_T_FACTOR)].as<float>();
|
||||||
|
|
||||||
if (value >= -15.0f && value <= 15.0f && fabsf(value - dst.equitherm.shift) > 0.0001f) {
|
if (value >= 0 && value <= 10 && fabsf(value - dst.equitherm.t_factor) > 0.0001f) {
|
||||||
dst.equitherm.shift = roundf(value, 2);
|
dst.equitherm.t_factor = roundf(value, 3);
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_TARGET_DIFF_FACTOR)].isNull()) {
|
|
||||||
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_TARGET_DIFF_FACTOR)].as<float>();
|
|
||||||
|
|
||||||
if (value >= 0.0f && value <= 10.0f && fabsf(value - dst.equitherm.targetDiffFactor) > 0.0001f) {
|
|
||||||
dst.equitherm.targetDiffFactor = roundf(value, 3);
|
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -380,26 +380,11 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"equitherm": {
|
"equitherm": {
|
||||||
"slope": {
|
"n": "N 系数",
|
||||||
"title": "斜率",
|
"k": "K 系数",
|
||||||
"note": "热损失补偿。主要调谐参数。"
|
"t": {
|
||||||
},
|
"title": "T 系数",
|
||||||
"exponent": {
|
"note": "启用PID时此参数无效"
|
||||||
"title": "指数",
|
|
||||||
"note": "散热器效率。典型值:<code>1.1</code> - 地板采暖,<code>1.2</code> - 铸铁,<code>1.3</code> - 面板散热器,<code>1.4</code> - 对流器。"
|
|
||||||
},
|
|
||||||
"shift": {
|
|
||||||
"title": "偏移",
|
|
||||||
"note": "补偿额外热损失(例如,在管道中)或额外热源。"
|
|
||||||
},
|
|
||||||
"targetDiffFactor": {
|
|
||||||
"title": "T 因子",
|
|
||||||
"note": "如果启用 PID,则不使用。将目标和当前室内温度之间的差值添加到设定点:<code>setpoint = setpoint + ((target - indoor) * T)</code>。"
|
|
||||||
},
|
|
||||||
"chart": {
|
|
||||||
"targetTemp": "目标室内温度",
|
|
||||||
"setpointTemp": "热载体温度",
|
|
||||||
"outdoorTemp": "室外温度"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -380,26 +380,11 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"equitherm": {
|
"equitherm": {
|
||||||
"slope": {
|
"n": "N factor",
|
||||||
"title": "Slope",
|
"k": "K factor",
|
||||||
"note": "Heat loss compensation. Main tuning parameter."
|
"t": {
|
||||||
},
|
|
||||||
"exponent": {
|
|
||||||
"title": "Exponent",
|
|
||||||
"note": "Radiator efficiency. Typical values: <code>1.1</code> - Floor heating, <code>1.2</code> - Cast iron, <code>1.3</code> - Panel radiators, <code>1.4</code> - Convectors."
|
|
||||||
},
|
|
||||||
"shift": {
|
|
||||||
"title": "Shift",
|
|
||||||
"note": "Compensates for additional heat losses (e.g., in pipes) or extra heat sources."
|
|
||||||
},
|
|
||||||
"targetDiffFactor": {
|
|
||||||
"title": "T factor",
|
"title": "T factor",
|
||||||
"note": "Not used if PID is enabled. Adds to the setpoint the difference between the target and current indoor temp: <code>setpoint = setpoint + ((target - indoor) * T)</code>."
|
"note": "Not used if PID is enabled"
|
||||||
},
|
|
||||||
"chart": {
|
|
||||||
"targetTemp": "Target indoor temperature",
|
|
||||||
"setpointTemp": "Heat carrier temperature",
|
|
||||||
"outdoorTemp": "Outdoor temperature"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -457,7 +442,6 @@
|
|||||||
"autoFaultReset": "Auto fault reset <small>(not recommended!)</small>",
|
"autoFaultReset": "Auto fault reset <small>(not recommended!)</small>",
|
||||||
"autoDiagReset": "Auto diag reset <small>(not recommended!)</small>",
|
"autoDiagReset": "Auto diag reset <small>(not recommended!)</small>",
|
||||||
"setDateAndTime": "Set date & time on boiler",
|
"setDateAndTime": "Set date & time on boiler",
|
||||||
"alwaysSetIndoorTemp": "Always set indoor temperature",
|
|
||||||
"immergasFix": "Fix for Immergas boilers"
|
"immergasFix": "Fix for Immergas boilers"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -380,26 +380,11 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"equitherm": {
|
"equitherm": {
|
||||||
"slope": {
|
"n": "Fattore N",
|
||||||
"title": "Pendenza",
|
"k": "Fattore K",
|
||||||
"note": "Compensazione della perdita di calore. Parametro di regolazione principale."
|
"t": {
|
||||||
},
|
|
||||||
"exponent": {
|
|
||||||
"title": "Esponente",
|
|
||||||
"note": "Efficienza del radiatore. Valori tipici: <code>1.1</code> - Riscaldamento a pavimento, <code>1.2</code> - Ghisa, <code>1.3</code> - Radiatori a pannello, <code>1.4</code> - Convettori."
|
|
||||||
},
|
|
||||||
"shift": {
|
|
||||||
"title": "Spostamento",
|
|
||||||
"note": "Compensa perdite di calore aggiuntive (ad es., nelle tubature) o fonti di calore extra."
|
|
||||||
},
|
|
||||||
"targetDiffFactor": {
|
|
||||||
"title": "Fattore T",
|
"title": "Fattore T",
|
||||||
"note": "Non utilizzato se PID è abilitato. Aggiunge al setpoint la differenza tra la temperatura target e quella interna attuale: <code>setpoint = setpoint + ((target - indoor) * T)</code>."
|
"note": "Non usato se PID è attivato"
|
||||||
},
|
|
||||||
"chart": {
|
|
||||||
"targetTemp": "Temperatura interna target",
|
|
||||||
"setpointTemp": "Temperatura del vettore termico",
|
|
||||||
"outdoorTemp": "Temperatura esterna"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -348,26 +348,11 @@
|
|||||||
"treshold": "Drempeltijd <small>(sec)</small>"
|
"treshold": "Drempeltijd <small>(sec)</small>"
|
||||||
},
|
},
|
||||||
"equitherm": {
|
"equitherm": {
|
||||||
"slope": {
|
"n": "N-factor",
|
||||||
"title": "Helling",
|
"k": "K-factor",
|
||||||
"note": "Compensatie voor warmteverlies. Hoofdafstelparameter."
|
"t": {
|
||||||
},
|
"title": "T-factor",
|
||||||
"exponent": {
|
"note": "Niet gebruikt als PID is ingeschakeld"
|
||||||
"title": "Exponent",
|
|
||||||
"note": "Radiator efficiëntie. Typische waarden: <code>1.1</code> - Vloerverwarming, <code>1.2</code> - Gietijzer, <code>1.3</code> - Paneelradiatoren, <code>1.4</code> - Convectors."
|
|
||||||
},
|
|
||||||
"shift": {
|
|
||||||
"title": "Verschuiving",
|
|
||||||
"note": "Compenseert voor extra warmteverliezen (bijv. in leidingen) of extra warmtebronnen."
|
|
||||||
},
|
|
||||||
"targetDiffFactor": {
|
|
||||||
"title": "T factor",
|
|
||||||
"note": "Niet gebruikt als PID is ingeschakeld. Voegt aan de setpoint de verschil tussen de target en huidige binnentemperatuur toe: <code>setpoint = setpoint + ((target - indoor) * T)</code>."
|
|
||||||
},
|
|
||||||
"chart": {
|
|
||||||
"targetTemp": "Doel binnentemperatuur",
|
|
||||||
"setpointTemp": "Warmtedrager temperatuur",
|
|
||||||
"outdoorTemp": "Buitentemperatuur"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pid": {
|
"pid": {
|
||||||
|
|||||||
@@ -358,7 +358,7 @@
|
|||||||
"heating": {
|
"heating": {
|
||||||
"hyst": {
|
"hyst": {
|
||||||
"title": "Гистерезис",
|
"title": "Гистерезис",
|
||||||
"desc": "Гистерезис полезен для поддержания заданной внутр. темп. (при использовании «ПЗА» и/или «ПИД»). Принудительно откл. отопление, когда <code>current indoor > target + value</code>, и вкл. отопление, когда <code>current indoor < (target - value)</code>.",
|
"desc": "Гистерезис полезен для поддержания заданной внутр. темп. (при использовании «Equitherm» и/или «PID»). Принудительно откл. отопление, когда <code>current indoor > target + value</code>, и вкл. отопление, когда <code>current indoor < (target - value)</code>.",
|
||||||
"value": "Значение <small>(в градусах)</small>",
|
"value": "Значение <small>(в градусах)</small>",
|
||||||
"action": {
|
"action": {
|
||||||
"title": "Действие",
|
"title": "Действие",
|
||||||
@@ -380,26 +380,11 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"equitherm": {
|
"equitherm": {
|
||||||
"slope": {
|
"n": "Коэффициент N",
|
||||||
"title": "Наклон",
|
"k": "Коэффициент K",
|
||||||
"note": "Компенсация теплопотерь. Основной параметр настройки."
|
"t": {
|
||||||
},
|
|
||||||
"exponent": {
|
|
||||||
"title": "Экспонента",
|
|
||||||
"note": "Эффективность радиатора. Типичные значения: <code>1.1</code> - Тёплый пол, <code>1.2</code> - Чугунные радиаторы, <code>1.3</code> - Панельные радиаторы, <code>1.4</code> - Конвекторы."
|
|
||||||
},
|
|
||||||
"shift": {
|
|
||||||
"title": "Смещение",
|
|
||||||
"note": "Компенсирует дополнительные теплопотери (например, в трубах) или дополнительные источники тепла."
|
|
||||||
},
|
|
||||||
"targetDiffFactor": {
|
|
||||||
"title": "Коэффициент T",
|
"title": "Коэффициент T",
|
||||||
"note": "Не используется, если ПИД включен. Добавляет разницу между целевой и текущей температурой в помещении: <code>setpoint = setpoint + ((target - indoor) * T)</code>."
|
"note": "Не используется, если ПИД включен"
|
||||||
},
|
|
||||||
"chart": {
|
|
||||||
"targetTemp": "Целевая внутренняя температура",
|
|
||||||
"setpointTemp": "Температура теплоносителя",
|
|
||||||
"outdoorTemp": "Наружная температура"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -241,9 +241,7 @@
|
|||||||
setCheckboxValue("[name='filtering']", data.filtering, sensorForm);
|
setCheckboxValue("[name='filtering']", data.filtering, sensorForm);
|
||||||
setInputValue("[name='filteringFactor']", data.filteringFactor, {}, sensorForm);
|
setInputValue("[name='filteringFactor']", data.filteringFactor, {}, sensorForm);
|
||||||
|
|
||||||
setTimeout(() => {
|
sensorForm.querySelector("[name='type']").dispatchEvent(new Event("change"));
|
||||||
sensorForm.querySelector("[name='type']").dispatchEvent(new Event("change"));
|
|
||||||
}, 10);
|
|
||||||
|
|
||||||
setBusy(".form-busy", "form", false, sensorNode);
|
setBusy(".form-busy", "form", false, sensorNode);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -106,7 +106,7 @@
|
|||||||
<option disabled selected data-i18n>settings.system.ntp.timezonePresets</option>
|
<option disabled selected data-i18n>settings.system.ntp.timezonePresets</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
@@ -381,44 +381,21 @@
|
|||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<div>
|
|
||||||
<div>
|
|
||||||
<canvas id="etChart"></canvas>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<label>
|
|
||||||
<div>
|
|
||||||
<span data-i18n>settings.equitherm.chart.targetTemp</span>: <b class="etChartTargetTempValue"></b>°
|
|
||||||
</div>
|
|
||||||
<input class="etChartTargetTemp" type="range" value="0" min="0" max="0" step="0.5">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<label>
|
<label>
|
||||||
<span data-i18n>settings.equitherm.slope.title</span>
|
<span data-i18n>settings.equitherm.n</span>
|
||||||
<input type="number" inputmode="decimal" name="equitherm[slope]" min="0.001" max="10" step="0.001" required>
|
<input type="number" inputmode="decimal" name="equitherm[n_factor]" min="0.001" max="10" step="0.001" required>
|
||||||
<small data-i18n>settings.equitherm.slope.note</small>
|
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<span data-i18n>settings.equitherm.exponent.title</span>
|
<span data-i18n>settings.equitherm.k</span>
|
||||||
<input type="number" inputmode="decimal" name="equitherm[exponent]" min="0.1" max="2" step="0.001" required>
|
<input type="number" inputmode="decimal" name="equitherm[k_factor]" min="0" max="10" step="0.01" required>
|
||||||
<small data-i18n>settings.equitherm.exponent.note</small>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid">
|
|
||||||
<label>
|
|
||||||
<span data-i18n>settings.equitherm.shift.title</span>
|
|
||||||
<input type="number" inputmode="decimal" name="equitherm[shift]" min="-15" max="15" step="0.01" required>
|
|
||||||
<small data-i18n>settings.equitherm.shift.note</small>
|
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<span data-i18n>settings.equitherm.targetDiffFactor.title</span>
|
<span data-i18n>settings.equitherm.t.title</span>
|
||||||
<input type="number" inputmode="decimal" name="equitherm[targetDiffFactor]" min="0" max="10" step="0.01" required>
|
<input type="number" inputmode="decimal" name="equitherm[t_factor]" min="0" max="10" step="0.01" required>
|
||||||
<small data-i18n>settings.equitherm.targetDiffFactor.note</small>
|
<small data-i18n>settings.equitherm.t.note</small>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -687,11 +664,6 @@
|
|||||||
<span data-i18n>settings.ot.options.setDateAndTime</span>
|
<span data-i18n>settings.ot.options.setDateAndTime</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" name="opentherm[options][alwaysSetIndoorTemp]" value="true">
|
|
||||||
<span data-i18n>settings.ot.options.alwaysSetIndoorTemp</span>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="opentherm[options][immergasFix]" value="true">
|
<input type="checkbox" name="opentherm[options][immergasFix]" value="true">
|
||||||
<span data-i18n>settings.ot.options.immergasFix</span>
|
<span data-i18n>settings.ot.options.immergasFix</span>
|
||||||
@@ -921,163 +893,11 @@
|
|||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script src="/static/app.js?{BUILD_TIME}"></script>
|
<script src="/static/app.js?{BUILD_TIME}"></script>
|
||||||
<script src="/static/chart.js?{BUILD_TIME}"></script>
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
const lang = new Lang(document.getElementById('lang'));
|
const lang = new Lang(document.getElementById('lang'));
|
||||||
lang.build();
|
lang.build();
|
||||||
|
|
||||||
let etChart = null;
|
|
||||||
let etChartConfig = {
|
|
||||||
slope: null,
|
|
||||||
exponent: null,
|
|
||||||
shift: null,
|
|
||||||
unitSystem: null,
|
|
||||||
targetTemp: null,
|
|
||||||
minTemp: null,
|
|
||||||
maxTemp: null,
|
|
||||||
decimated: false
|
|
||||||
};
|
|
||||||
|
|
||||||
const hasNeedDecimationChart = () => {
|
|
||||||
return window.innerWidth <= 800;
|
|
||||||
}
|
|
||||||
|
|
||||||
const makeEquithermChart = () => {
|
|
||||||
if (etChart == null) {
|
|
||||||
const ctx = document.getElementById('etChart').getContext('2d');
|
|
||||||
|
|
||||||
try {
|
|
||||||
etChart = new Chart(ctx, {
|
|
||||||
type: 'line',
|
|
||||||
data: {
|
|
||||||
datasets: [{
|
|
||||||
borderColor: (context) => {
|
|
||||||
const chart = context.chart;
|
|
||||||
const { ctx, chartArea } = chart;
|
|
||||||
|
|
||||||
if (!chartArea) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const gradient = ctx.createLinearGradient(0, chartArea.bottom, 0, chartArea.top);
|
|
||||||
gradient.addColorStop(0, 'rgba(1, 114, 173, 1)');
|
|
||||||
gradient.addColorStop(0.5, 'rgba(255, 99, 132, 1)');
|
|
||||||
|
|
||||||
return gradient;
|
|
||||||
},
|
|
||||||
borderWidth: 3,
|
|
||||||
fill: false,
|
|
||||||
tension: 0.1,
|
|
||||||
pointRadius: 2,
|
|
||||||
pointHoverRadius: 4,
|
|
||||||
indexAxis: "x",
|
|
||||||
data: []
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
responsive: true,
|
|
||||||
resizeDelay: 500,
|
|
||||||
parsing: false,
|
|
||||||
interaction: {
|
|
||||||
mode: 'nearest',
|
|
||||||
intersect: false
|
|
||||||
},
|
|
||||||
plugins: {
|
|
||||||
tooltip: {
|
|
||||||
enabled: true,
|
|
||||||
position: 'nearest',
|
|
||||||
displayColors: false,
|
|
||||||
callbacks: {
|
|
||||||
title: (items) => {
|
|
||||||
return `${i18n("settings.equitherm.chart.outdoorTemp")}: ${items[0].label}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
display: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
scales: {
|
|
||||||
x: {
|
|
||||||
display: true,
|
|
||||||
type: "linear",
|
|
||||||
reverse: true,
|
|
||||||
title: {
|
|
||||||
display: true
|
|
||||||
},
|
|
||||||
ticks: {
|
|
||||||
stepSize: 1,
|
|
||||||
format: {
|
|
||||||
style: "unit",
|
|
||||||
unit: "degree",
|
|
||||||
unitDisplay: "narrow"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
y: {
|
|
||||||
display: true,
|
|
||||||
title: {
|
|
||||||
display: true
|
|
||||||
},
|
|
||||||
ticks: {
|
|
||||||
format: {
|
|
||||||
style: "unit",
|
|
||||||
unit: "degree",
|
|
||||||
unitDisplay: "narrow"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!etChart) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let data = [];
|
|
||||||
etChartConfig.decimated = hasNeedDecimationChart();
|
|
||||||
for (let value = 30; value >= -30; value -= etChartConfig.decimated ? 2 : 1) {
|
|
||||||
const outdoorTemp = etChartConfig.unitSystem == 0 ? value : c2f(value);
|
|
||||||
|
|
||||||
data.push({
|
|
||||||
x: parseFloat(outdoorTemp.toFixed(1)),
|
|
||||||
y: parseFloat(calculateEquithermTemp(outdoorTemp).toFixed(1))
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
etChart.data.datasets[0].data = data;
|
|
||||||
etChart.data.datasets[0].label = i18n("settings.equitherm.chart.setpointTemp");
|
|
||||||
etChart.options.scales.x.title.text = i18n("settings.equitherm.chart.outdoorTemp");
|
|
||||||
etChart.options.scales.y.title.text = i18n("settings.equitherm.chart.setpointTemp");
|
|
||||||
etChart.update();
|
|
||||||
}
|
|
||||||
|
|
||||||
const calculateEquithermTemp = (outdoorTemp) => {
|
|
||||||
const tempDelta = etChartConfig.targetTemp - outdoorTemp;
|
|
||||||
const maxPoint = etChartConfig.targetTemp - (
|
|
||||||
etChartConfig.maxTemp - etChartConfig.targetTemp
|
|
||||||
) / etChartConfig.slope;
|
|
||||||
|
|
||||||
const sf = (etChartConfig.maxTemp - etChartConfig.targetTemp) / Math.pow(
|
|
||||||
etChartConfig.targetTemp - maxPoint,
|
|
||||||
1 / etChartConfig.exponent
|
|
||||||
);
|
|
||||||
const result = etChartConfig.targetTemp + etChartConfig.shift + sf * (
|
|
||||||
tempDelta >= 0
|
|
||||||
? Math.pow(tempDelta, 1 / etChartConfig.exponent)
|
|
||||||
: -(Math.pow(-(tempDelta), 1 / etChartConfig.exponent))
|
|
||||||
);
|
|
||||||
|
|
||||||
return Math.max(Math.min(result, etChartConfig.maxTemp), etChartConfig.minTemp);
|
|
||||||
}
|
|
||||||
|
|
||||||
const fillData = (data) => {
|
const fillData = (data) => {
|
||||||
// System
|
// System
|
||||||
setSelectValue("[name='system[logLevel]']", data.system.logLevel);
|
setSelectValue("[name='system[logLevel]']", data.system.logLevel);
|
||||||
@@ -1122,7 +942,6 @@
|
|||||||
setCheckboxValue("[name='opentherm[options][autoFaultReset]']", data.opentherm.options.autoFaultReset);
|
setCheckboxValue("[name='opentherm[options][autoFaultReset]']", data.opentherm.options.autoFaultReset);
|
||||||
setCheckboxValue("[name='opentherm[options][autoDiagReset]']", data.opentherm.options.autoDiagReset);
|
setCheckboxValue("[name='opentherm[options][autoDiagReset]']", data.opentherm.options.autoDiagReset);
|
||||||
setCheckboxValue("[name='opentherm[options][setDateAndTime]']", data.opentherm.options.setDateAndTime);
|
setCheckboxValue("[name='opentherm[options][setDateAndTime]']", data.opentherm.options.setDateAndTime);
|
||||||
setCheckboxValue("[name='opentherm[options][alwaysSetIndoorTemp]']", data.opentherm.options.alwaysSetIndoorTemp);
|
|
||||||
setCheckboxValue("[name='opentherm[options][nativeHeatingControl]']", data.opentherm.options.nativeHeatingControl);
|
setCheckboxValue("[name='opentherm[options][nativeHeatingControl]']", data.opentherm.options.nativeHeatingControl);
|
||||||
setCheckboxValue("[name='opentherm[options][immergasFix]']", data.opentherm.options.immergasFix);
|
setCheckboxValue("[name='opentherm[options][immergasFix]']", data.opentherm.options.immergasFix);
|
||||||
setBusy('#ot-settings-busy', '#ot-settings', false);
|
setBusy('#ot-settings-busy', '#ot-settings', false);
|
||||||
@@ -1229,10 +1048,9 @@
|
|||||||
|
|
||||||
// Equitherm
|
// Equitherm
|
||||||
setCheckboxValue("[name='equitherm[enabled]']", data.equitherm.enabled);
|
setCheckboxValue("[name='equitherm[enabled]']", data.equitherm.enabled);
|
||||||
setInputValue("[name='equitherm[slope]']", data.equitherm.slope);
|
setInputValue("[name='equitherm[n_factor]']", data.equitherm.n_factor);
|
||||||
setInputValue("[name='equitherm[exponent]']", data.equitherm.exponent);
|
setInputValue("[name='equitherm[k_factor]']", data.equitherm.k_factor);
|
||||||
setInputValue("[name='equitherm[shift]']", data.equitherm.shift);
|
setInputValue("[name='equitherm[t_factor]']", data.equitherm.t_factor);
|
||||||
setInputValue("[name='equitherm[targetDiffFactor]']", data.equitherm.targetDiffFactor);
|
|
||||||
setBusy('#equitherm-settings-busy', '#equitherm-settings', false);
|
setBusy('#equitherm-settings-busy', '#equitherm-settings', false);
|
||||||
|
|
||||||
// PID
|
// PID
|
||||||
@@ -1256,24 +1074,6 @@
|
|||||||
setInputValue("[name='pid[deadband][thresholdHigh]']", data.pid.deadband.thresholdHigh);
|
setInputValue("[name='pid[deadband][thresholdHigh]']", data.pid.deadband.thresholdHigh);
|
||||||
setInputValue("[name='pid[deadband][thresholdLow]']", data.pid.deadband.thresholdLow);
|
setInputValue("[name='pid[deadband][thresholdLow]']", data.pid.deadband.thresholdLow);
|
||||||
setBusy('#pid-settings-busy', '#pid-settings', false);
|
setBusy('#pid-settings-busy', '#pid-settings', false);
|
||||||
|
|
||||||
const etMinTemp = parseInt(data.system.unitSystem == 0 ? 5 : 41);
|
|
||||||
const etMaxTemp = parseInt(data.system.unitSystem == 0 ? 30 : 86);
|
|
||||||
const etTargetTemp = constrain(parseFloat(data.heating.target), etMinTemp, etMaxTemp);
|
|
||||||
|
|
||||||
setInputValue(".etChartTargetTemp", etTargetTemp.toFixed(1), {
|
|
||||||
"min": etMinTemp,
|
|
||||||
"max": etMaxTemp
|
|
||||||
});
|
|
||||||
|
|
||||||
etChartConfig.slope = data.equitherm.slope;
|
|
||||||
etChartConfig.exponent = data.equitherm.exponent;
|
|
||||||
etChartConfig.shift = data.equitherm.shift;
|
|
||||||
etChartConfig.unitSystem = data.system.unitSystem;
|
|
||||||
etChartConfig.minTemp = data.heating.minTemp;
|
|
||||||
etChartConfig.maxTemp = data.heating.maxTemp;
|
|
||||||
|
|
||||||
makeEquithermChart();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -1326,57 +1126,6 @@
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelector(".etChartTargetTemp").addEventListener("input", async (event) => {
|
|
||||||
setValue('.etChartTargetTempValue', parseFloat(event.target.value).toFixed(1));
|
|
||||||
});
|
|
||||||
|
|
||||||
document.querySelector(".etChartTargetTemp").addEventListener("change", async (event) => {
|
|
||||||
if (!event.target.checkValidity()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
etChartConfig.targetTemp = parseFloat(event.target.value);
|
|
||||||
setValue('.etChartTargetTempValue', etChartConfig.targetTemp.toFixed(1));
|
|
||||||
makeEquithermChart();
|
|
||||||
});
|
|
||||||
|
|
||||||
document.querySelector("[name='equitherm[slope]']").addEventListener("change", async (event) => {
|
|
||||||
if (!event.target.checkValidity()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
etChartConfig.slope = parseFloat(event.target.value);
|
|
||||||
makeEquithermChart();
|
|
||||||
});
|
|
||||||
|
|
||||||
document.querySelector("[name='equitherm[exponent]']").addEventListener("change", async (event) => {
|
|
||||||
if (!event.target.checkValidity()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
etChartConfig.exponent = parseFloat(event.target.value);
|
|
||||||
makeEquithermChart();
|
|
||||||
});
|
|
||||||
|
|
||||||
document.querySelector("[name='equitherm[shift]']").addEventListener("change", async (event) => {
|
|
||||||
if (!event.target.checkValidity()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
etChartConfig.shift = parseFloat(event.target.value);
|
|
||||||
makeEquithermChart();
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener('resize', async (event) => {
|
|
||||||
if (etChart) {
|
|
||||||
etChart.resize();
|
|
||||||
|
|
||||||
if (etChartConfig.decimated != hasNeedDecimationChart()) {
|
|
||||||
makeEquithermChart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -5,13 +5,8 @@ const setupForm = (formSelector, onResultCallback = null, noCastItems = []) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
form.querySelectorAll('input').forEach(item => {
|
form.querySelectorAll('input').forEach(item => {
|
||||||
item.addEventListener('change', (event) => {
|
item.addEventListener('change', (e) => {
|
||||||
if (!event.target.checkValidity()) {
|
e.target.setAttribute('aria-invalid', !e.target.checkValidity());
|
||||||
event.target.setAttribute('aria-invalid', true);
|
|
||||||
|
|
||||||
} else if (event.target.hasAttribute('aria-invalid')) {
|
|
||||||
event.target.removeAttribute('aria-invalid');
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -635,10 +630,6 @@ const setCheckboxValue = (selector, value, parent = undefined) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
item.checked = value;
|
item.checked = value;
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
item.dispatchEvent(new Event("change"));
|
|
||||||
}, 10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const setRadioValue = (selector, value, parent = undefined) => {
|
const setRadioValue = (selector, value, parent = undefined) => {
|
||||||
@@ -652,14 +643,7 @@ const setRadioValue = (selector, value, parent = undefined) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let item of items) {
|
for (let item of items) {
|
||||||
const checked = item.value == value;
|
item.checked = item.value == value;
|
||||||
if (item.checked != checked) {
|
|
||||||
item.checked = checked;
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
item.dispatchEvent(new Event("change"));
|
|
||||||
}, 10);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -674,17 +658,13 @@ const setInputValue = (selector, value, attrs = {}, parent = undefined) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let item of items) {
|
for (let item of items) {
|
||||||
|
item.value = value;
|
||||||
|
|
||||||
if (attrs instanceof Object) {
|
if (attrs instanceof Object) {
|
||||||
for (let attrKey of Object.keys(attrs)) {
|
for (let attrKey of Object.keys(attrs)) {
|
||||||
item.setAttribute(attrKey, attrs[attrKey]);
|
item.setAttribute(attrKey, attrs[attrKey]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
item.value = value;
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
item.dispatchEvent(new Event("change"));
|
|
||||||
}, 10);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -874,11 +854,3 @@ function dec2hex(i) {
|
|||||||
function constrain(amt, low, high) {
|
function constrain(amt, low, high) {
|
||||||
return ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)));
|
return ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function c2f(value) {
|
|
||||||
return (9 / 5) * value + 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
function f2c(value) {
|
|
||||||
return (value - 32) * (5 / 9);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user