mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-03-31 06:38:37 +05:00
Compare commits
2 Commits
1f72286be7
...
54095892e1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54095892e1 | ||
|
|
5dd76c9168 |
@@ -886,7 +886,7 @@ public:
|
|||||||
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_k_factor")).c_str(), doc);
|
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_k_factor")).c_str(), doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool publishInputEquithermFactorK(bool enabledByDefault = true) {
|
bool publishInputEquithermFactorE(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;
|
||||||
@@ -906,7 +906,7 @@ 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_k_factor")).c_str(), doc);
|
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_e_factor")).c_str(), doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool publishInputEquithermFactorT(bool enabledByDefault = true) {
|
bool publishInputEquithermFactorT(bool enabledByDefault = true) {
|
||||||
|
|||||||
@@ -975,10 +975,10 @@
|
|||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
//График
|
//График
|
||||||
let equithermChart;
|
let equithermChart;
|
||||||
|
|
||||||
async function initChart() {
|
async function initChart() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch("/api/settings", {
|
const response = await fetch("/api/settings", {
|
||||||
cache: "no-cache",
|
cache: "no-cache",
|
||||||
@@ -992,7 +992,7 @@ async function initChart() {
|
|||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
|
|
||||||
//График переменные
|
//График переменные
|
||||||
const targetTemp = result?.heating?.target_temp ?? 24;
|
const targetTemp = result?.heating?.target ?? 24;
|
||||||
const maxOut = result?.heating?.maxTemp ?? 90;
|
const maxOut = result?.heating?.maxTemp ?? 90;
|
||||||
const Kn = result?.equitherm?.n_factor ?? 1;
|
const Kn = result?.equitherm?.n_factor ?? 1;
|
||||||
const Ke = result?.equitherm?.e_factor ?? 1.3;
|
const Ke = result?.equitherm?.e_factor ?? 1.3;
|
||||||
@@ -1079,10 +1079,10 @@ async function initChart() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Обновление графика
|
// Обновление графика
|
||||||
function updateChart(formData) {
|
function updateChart(formData) {
|
||||||
if (!equithermChart) return;
|
if (!equithermChart) return;
|
||||||
|
|
||||||
fetch("/api/settings", {
|
fetch("/api/settings", {
|
||||||
@@ -1091,7 +1091,7 @@ function updateChart(formData) {
|
|||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(result => {
|
.then(result => {
|
||||||
const targetTemp = result?.heating?.target_temp ?? 24;
|
const targetTemp = result?.heating?.target ?? 24;
|
||||||
const maxOut = result?.heating?.maxTemp ?? 90;
|
const maxOut = result?.heating?.maxTemp ?? 90;
|
||||||
const Kn = parseFloat(formData.get('equitherm[n_factor]')) || 1;
|
const Kn = parseFloat(formData.get('equitherm[n_factor]')) || 1;
|
||||||
const Ke = parseFloat(formData.get('equitherm[e_factor]')) || 1.3;
|
const Ke = parseFloat(formData.get('equitherm[e_factor]')) || 1.3;
|
||||||
@@ -1134,7 +1134,7 @@ function updateChart(formData) {
|
|||||||
updateChart(formData);
|
updateChart(formData);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Слушаем кнопку сохранить
|
// Слушаем кнопку сохранить
|
||||||
const equithermSection = document.querySelector('details');
|
const equithermSection = document.querySelector('details');
|
||||||
const saveButton = equithermSection.querySelector('button[data-i18n="button.save"]');
|
const saveButton = equithermSection.querySelector('button[data-i18n="button.save"]');
|
||||||
saveButton.addEventListener('click', () => {
|
saveButton.addEventListener('click', () => {
|
||||||
@@ -1143,8 +1143,8 @@ function updateChart(formData) {
|
|||||||
updateChart(formData);
|
updateChart(formData);
|
||||||
});
|
});
|
||||||
|
|
||||||
// инициализируем
|
// инициализируем
|
||||||
initChart();
|
initChart();
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user