mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-12 11:14:28 +05:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8641f9f1e4 | ||
|
|
c9fee6f1eb | ||
|
|
eafb33cb6a | ||
|
|
0038a200ca | ||
|
|
1112a25172 | ||
|
|
69b3cdf05a | ||
|
|
01192a59f5 | ||
|
|
cb8251dd40 | ||
|
|
00baf10b9f | ||
|
|
6f8c8567a0 | ||
|
|
e573ce582f | ||
|
|
0b60734a3b | ||
|
|
d4603aa0de |
22
.github/workflows/pio-dependabot.yaml
vendored
22
.github/workflows/pio-dependabot.yaml
vendored
@@ -1,22 +0,0 @@
|
|||||||
name: PlatformIO Dependabot
|
|
||||||
on:
|
|
||||||
workflow_dispatch: # option to manually trigger the workflow
|
|
||||||
schedule:
|
|
||||||
# Runs every day at 00:00
|
|
||||||
- cron: "0 0 * * *"
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
dependabot:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: run PlatformIO Dependabot
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v5
|
|
||||||
- name: run PlatformIO Dependabot
|
|
||||||
uses: peterus/platformio_dependabot@v1.2.0
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
@@ -27,6 +27,9 @@ 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'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,63 +0,0 @@
|
|||||||
#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;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -147,8 +147,19 @@ public:
|
|||||||
return topic;
|
return topic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class DT, class VT>
|
||||||
|
String getEntityIdWithPrefix(DT domain, VT value, char separator = '_') {
|
||||||
|
String topic = "";
|
||||||
|
topic.concat(domain);
|
||||||
|
topic.concat('.');
|
||||||
|
topic.concat(this->devicePrefix);
|
||||||
|
topic.concat(separator);
|
||||||
|
topic.concat(value);
|
||||||
|
return topic;
|
||||||
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
String getObjectIdWithPrefix(T value, char separator = '_') {
|
String getUniqueIdWithPrefix(T value, char separator = '_') {
|
||||||
String topic = "";
|
String topic = "";
|
||||||
topic.concat(this->devicePrefix);
|
topic.concat(this->devicePrefix);
|
||||||
topic.concat(separator);
|
topic.concat(separator);
|
||||||
|
|||||||
@@ -12,66 +12,67 @@ const char HA_ENTITY_SELECT[] PROGMEM = "select";
|
|||||||
const char HA_ENTITY_SENSOR[] PROGMEM = "sensor";
|
const char HA_ENTITY_SENSOR[] PROGMEM = "sensor";
|
||||||
const char HA_ENTITY_SWITCH[] PROGMEM = "switch";
|
const char HA_ENTITY_SWITCH[] PROGMEM = "switch";
|
||||||
|
|
||||||
const char HA_DEVICE[] PROGMEM = "device";
|
// https://www.home-assistant.io/integrations/mqtt/#supported-abbreviations-in-mqtt-discovery-messages
|
||||||
const char HA_IDENTIFIERS[] PROGMEM = "identifiers";
|
const char HA_DEFAULT_ENTITY_ID[] PROGMEM = "def_ent_id"; // "default_entity_id "
|
||||||
const char HA_SW_VERSION[] PROGMEM = "sw_version";
|
const char HA_DEVICE[] PROGMEM = "dev"; // "device"
|
||||||
const char HA_MANUFACTURER[] PROGMEM = "manufacturer";
|
const char HA_IDENTIFIERS[] PROGMEM = "ids"; // "identifiers"
|
||||||
const char HA_MODEL[] PROGMEM = "model";
|
const char HA_SW_VERSION[] PROGMEM = "sw"; // "sw_version"
|
||||||
|
const char HA_MANUFACTURER[] PROGMEM = "mf"; // "manufacturer"
|
||||||
|
const char HA_MODEL[] PROGMEM = "mdl"; // "model"
|
||||||
const char HA_NAME[] PROGMEM = "name";
|
const char HA_NAME[] PROGMEM = "name";
|
||||||
const char HA_CONF_URL[] PROGMEM = "configuration_url";
|
const char HA_CONF_URL[] PROGMEM = "cu"; // "configuration_url"
|
||||||
const char HA_COMMAND_TOPIC[] PROGMEM = "command_topic";
|
const char HA_COMMAND_TOPIC[] PROGMEM = "cmd_t"; // "command_topic"
|
||||||
const char HA_COMMAND_TEMPLATE[] PROGMEM = "command_template";
|
const char HA_COMMAND_TEMPLATE[] PROGMEM = "cmd_tpl"; // "command_template"
|
||||||
const char HA_ENABLED_BY_DEFAULT[] PROGMEM = "enabled_by_default";
|
const char HA_ENABLED_BY_DEFAULT[] PROGMEM = "en"; // "enabled_by_default"
|
||||||
const char HA_UNIQUE_ID[] PROGMEM = "unique_id";
|
const char HA_UNIQUE_ID[] PROGMEM = "uniq_id"; // "unique_id"
|
||||||
const char HA_OBJECT_ID[] PROGMEM = "object_id";
|
const char HA_ENTITY_CATEGORY[] PROGMEM = "ent_cat"; // "entity_category"
|
||||||
const char HA_ENTITY_CATEGORY[] PROGMEM = "entity_category";
|
|
||||||
const char HA_ENTITY_CATEGORY_DIAGNOSTIC[] PROGMEM = "diagnostic";
|
const char HA_ENTITY_CATEGORY_DIAGNOSTIC[] PROGMEM = "diagnostic";
|
||||||
const char HA_ENTITY_CATEGORY_CONFIG[] PROGMEM = "config";
|
const char HA_ENTITY_CATEGORY_CONFIG[] PROGMEM = "config";
|
||||||
const char HA_STATE_TOPIC[] PROGMEM = "state_topic";
|
const char HA_STATE_TOPIC[] PROGMEM = "stat_t"; // "state_topic"
|
||||||
const char HA_VALUE_TEMPLATE[] PROGMEM = "value_template";
|
const char HA_VALUE_TEMPLATE[] PROGMEM = "val_tpl"; // "value_template"
|
||||||
const char HA_OPTIONS[] PROGMEM = "options";
|
const char HA_OPTIONS[] PROGMEM = "ops"; // "options"
|
||||||
const char HA_AVAILABILITY[] PROGMEM = "availability";
|
const char HA_AVAILABILITY[] PROGMEM = "avty"; // "availability"
|
||||||
const char HA_AVAILABILITY_MODE[] PROGMEM = "availability_mode";
|
const char HA_AVAILABILITY_MODE[] PROGMEM = "avty_mode"; // "availability_mode"
|
||||||
const char HA_TOPIC[] PROGMEM = "topic";
|
const char HA_TOPIC[] PROGMEM = "t"; // "topic"
|
||||||
const char HA_DEVICE_CLASS[] PROGMEM = "device_class";
|
const char HA_DEVICE_CLASS[] PROGMEM = "dev_cla"; // "device_class"
|
||||||
const char HA_UNIT_OF_MEASUREMENT[] PROGMEM = "unit_of_measurement";
|
const char HA_UNIT_OF_MEASUREMENT[] PROGMEM = "unit_of_meas"; // "unit_of_measurement"
|
||||||
const char HA_UNIT_OF_MEASUREMENT_C[] PROGMEM = "°C";
|
const char HA_UNIT_OF_MEASUREMENT_C[] PROGMEM = "°C";
|
||||||
const char HA_UNIT_OF_MEASUREMENT_F[] PROGMEM = "°F";
|
const char HA_UNIT_OF_MEASUREMENT_F[] PROGMEM = "°F";
|
||||||
const char HA_UNIT_OF_MEASUREMENT_PERCENT[] PROGMEM = "%";
|
const char HA_UNIT_OF_MEASUREMENT_PERCENT[] PROGMEM = "%";
|
||||||
const char HA_UNIT_OF_MEASUREMENT_L_MIN[] PROGMEM = "L/min";
|
const char HA_UNIT_OF_MEASUREMENT_L_MIN[] PROGMEM = "L/min";
|
||||||
const char HA_UNIT_OF_MEASUREMENT_GAL_MIN[] PROGMEM = "gal/min";
|
const char HA_UNIT_OF_MEASUREMENT_GAL_MIN[] PROGMEM = "gal/min";
|
||||||
const char HA_ICON[] PROGMEM = "icon";
|
const char HA_ICON[] PROGMEM = "ic"; // "icon"
|
||||||
const char HA_MIN[] PROGMEM = "min";
|
const char HA_MIN[] PROGMEM = "min";
|
||||||
const char HA_MAX[] PROGMEM = "max";
|
const char HA_MAX[] PROGMEM = "max";
|
||||||
const char HA_STEP[] PROGMEM = "step";
|
const char HA_STEP[] PROGMEM = "step";
|
||||||
const char HA_MODE[] PROGMEM = "mode";
|
const char HA_MODE[] PROGMEM = "mode";
|
||||||
const char HA_MODE_BOX[] PROGMEM = "box";
|
const char HA_MODE_BOX[] PROGMEM = "box";
|
||||||
const char HA_STATE_ON[] PROGMEM = "state_on";
|
const char HA_STATE_ON[] PROGMEM = "stat_on"; // "state_on"
|
||||||
const char HA_STATE_OFF[] PROGMEM = "state_off";
|
const char HA_STATE_OFF[] PROGMEM = "stat_off"; // "state_off"
|
||||||
const char HA_PAYLOAD_ON[] PROGMEM = "payload_on";
|
const char HA_PAYLOAD_ON[] PROGMEM = "pl_on"; // "payload_on"
|
||||||
const char HA_PAYLOAD_OFF[] PROGMEM = "payload_off";
|
const char HA_PAYLOAD_OFF[] PROGMEM = "pl_off"; // "payload_off"
|
||||||
const char HA_STATE_CLASS[] PROGMEM = "state_class";
|
const char HA_STATE_CLASS[] PROGMEM = "stat_cla"; // "state_class"
|
||||||
const char HA_STATE_CLASS_MEASUREMENT[] PROGMEM = "measurement";
|
const char HA_STATE_CLASS_MEASUREMENT[] PROGMEM = "measurement";
|
||||||
const char HA_EXPIRE_AFTER[] PROGMEM = "expire_after";
|
const char HA_EXPIRE_AFTER[] PROGMEM = "exp_aft"; // "expire_after"
|
||||||
const char HA_CURRENT_TEMPERATURE_TOPIC[] PROGMEM = "current_temperature_topic";
|
const char HA_CURRENT_TEMPERATURE_TOPIC[] PROGMEM = "curr_temp_t"; // "current_temperature_topic"
|
||||||
const char HA_CURRENT_TEMPERATURE_TEMPLATE[] PROGMEM = "current_temperature_template";
|
const char HA_CURRENT_TEMPERATURE_TEMPLATE[] PROGMEM = "curr_temp_tpl"; // "current_temperature_template"
|
||||||
const char HA_TEMPERATURE_COMMAND_TOPIC[] PROGMEM = "temperature_command_topic";
|
const char HA_TEMPERATURE_COMMAND_TOPIC[] PROGMEM = "temp_cmd_t"; // "temperature_command_topic"
|
||||||
const char HA_TEMPERATURE_COMMAND_TEMPLATE[] PROGMEM = "temperature_command_template";
|
const char HA_TEMPERATURE_COMMAND_TEMPLATE[] PROGMEM = "temp_cmd_tpl"; // "temperature_command_template"
|
||||||
const char HA_TEMPERATURE_STATE_TOPIC[] PROGMEM = "temperature_state_topic";
|
const char HA_TEMPERATURE_STATE_TOPIC[] PROGMEM = "temp_stat_t"; // "temperature_state_topic"
|
||||||
const char HA_TEMPERATURE_STATE_TEMPLATE[] PROGMEM = "temperature_state_template";
|
const char HA_TEMPERATURE_STATE_TEMPLATE[] PROGMEM = "temp_stat_tpl"; // "temperature_state_template"
|
||||||
const char HA_TEMPERATURE_UNIT[] PROGMEM = "temperature_unit";
|
const char HA_TEMPERATURE_UNIT[] PROGMEM = "temp_unit"; // "temperature_unit"
|
||||||
const char HA_MODE_COMMAND_TOPIC[] PROGMEM = "mode_command_topic";
|
const char HA_MODE_COMMAND_TOPIC[] PROGMEM = "mode_cmd_t"; // "mode_command_topic"
|
||||||
const char HA_MODE_COMMAND_TEMPLATE[] PROGMEM = "mode_command_template";
|
const char HA_MODE_COMMAND_TEMPLATE[] PROGMEM = "mode_cmd_tpl"; // "mode_command_template"
|
||||||
const char HA_MODE_STATE_TOPIC[] PROGMEM = "mode_state_topic";
|
const char HA_MODE_STATE_TOPIC[] PROGMEM = "mode_stat_t"; // "mode_state_topic"
|
||||||
const char HA_MODE_STATE_TEMPLATE[] PROGMEM = "mode_state_template";
|
const char HA_MODE_STATE_TEMPLATE[] PROGMEM = "mode_stat_tpl"; // "mode_state_template"
|
||||||
const char HA_MODES[] PROGMEM = "modes";
|
const char HA_MODES[] PROGMEM = "modes";
|
||||||
const char HA_ACTION_TOPIC[] PROGMEM = "action_topic";
|
const char HA_ACTION_TOPIC[] PROGMEM = "act_t"; // "action_topic"
|
||||||
const char HA_ACTION_TEMPLATE[] PROGMEM = "action_template";
|
const char HA_ACTION_TEMPLATE[] PROGMEM = "act_tpl"; // "action_template"
|
||||||
const char HA_MIN_TEMP[] PROGMEM = "min_temp";
|
const char HA_MIN_TEMP[] PROGMEM = "min_temp";
|
||||||
const char HA_MAX_TEMP[] PROGMEM = "max_temp";
|
const char HA_MAX_TEMP[] PROGMEM = "max_temp";
|
||||||
const char HA_TEMP_STEP[] PROGMEM = "temp_step";
|
const char HA_TEMP_STEP[] PROGMEM = "temp_step";
|
||||||
const char HA_PRESET_MODE_COMMAND_TOPIC[] PROGMEM = "preset_mode_command_topic";
|
const char HA_PRESET_MODE_COMMAND_TOPIC[] PROGMEM = "pr_mode_cmd_t"; // "preset_mode_command_topic"
|
||||||
const char HA_PRESET_MODE_COMMAND_TEMPLATE[] PROGMEM = "preset_mode_command_template";
|
const char HA_PRESET_MODE_COMMAND_TEMPLATE[] PROGMEM = "pr_mode_cmd_tpl"; // "preset_mode_command_template"
|
||||||
const char HA_PRESET_MODE_STATE_TOPIC[] PROGMEM = "preset_mode_state_topic";
|
const char HA_PRESET_MODE_STATE_TOPIC[] PROGMEM = "pr_mode_stat_t"; // "preset_mode_state_topic"
|
||||||
const char HA_PRESET_MODE_VALUE_TEMPLATE[] PROGMEM = "preset_mode_value_template";
|
const char HA_PRESET_MODE_VALUE_TEMPLATE[] PROGMEM = "pr_mode_val_tpl"; // "preset_mode_value_template"
|
||||||
const char HA_PRESET_MODES[] PROGMEM = "preset_modes";
|
const char HA_PRESET_MODES[] PROGMEM = "pr_modes"; // "preset_modes"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
class UpgradeHandler : public AsyncWebHandler {
|
class UpgradeHandler : public RequestHandler {
|
||||||
public:
|
public:
|
||||||
enum class UpgradeType {
|
enum class UpgradeType {
|
||||||
FIRMWARE = 0,
|
FIRMWARE = 0,
|
||||||
@@ -12,7 +12,7 @@ public:
|
|||||||
NO_FILE,
|
NO_FILE,
|
||||||
SUCCESS,
|
SUCCESS,
|
||||||
PROHIBITED,
|
PROHIBITED,
|
||||||
SIZE_MISMATCH,
|
ABORTED,
|
||||||
ERROR_ON_START,
|
ERROR_ON_START,
|
||||||
ERROR_ON_WRITE,
|
ERROR_ON_WRITE,
|
||||||
ERROR_ON_FINISH
|
ERROR_ON_FINISH
|
||||||
@@ -22,21 +22,27 @@ public:
|
|||||||
UpgradeType type;
|
UpgradeType type;
|
||||||
UpgradeStatus status;
|
UpgradeStatus status;
|
||||||
String error;
|
String error;
|
||||||
size_t progress = 0;
|
|
||||||
size_t size = 0;
|
|
||||||
} UpgradeResult;
|
} UpgradeResult;
|
||||||
|
|
||||||
typedef std::function<bool(AsyncWebServerRequest *request, UpgradeType)> BeforeUpgradeCallback;
|
typedef std::function<bool(HTTPMethod, const String&)> CanHandleCallback;
|
||||||
typedef std::function<void(AsyncWebServerRequest *request, const UpgradeResult&, const UpgradeResult&)> AfterUpgradeCallback;
|
typedef std::function<bool(const String&)> CanUploadCallback;
|
||||||
|
typedef std::function<bool(UpgradeType)> BeforeUpgradeCallback;
|
||||||
|
typedef std::function<void(const UpgradeResult&, const UpgradeResult&)> AfterUpgradeCallback;
|
||||||
|
|
||||||
UpgradeHandler(AsyncURIMatcher uri) : uri(uri) {}
|
UpgradeHandler(const char* uri) {
|
||||||
|
this->uri = uri;
|
||||||
|
}
|
||||||
|
|
||||||
bool canHandle(AsyncWebServerRequest *request) const override final {
|
UpgradeHandler* setCanHandleCallback(CanHandleCallback callback = nullptr) {
|
||||||
if (!request->isHTTP()) {
|
this->canHandleCallback = callback;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this->uri.matches(request);
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpgradeHandler* setCanUploadCallback(CanUploadCallback callback = nullptr) {
|
||||||
|
this->canUploadCallback = callback;
|
||||||
|
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpgradeHandler* setBeforeUpgradeCallback(BeforeUpgradeCallback callback = nullptr) {
|
UpgradeHandler* setBeforeUpgradeCallback(BeforeUpgradeCallback callback = nullptr) {
|
||||||
@@ -51,9 +57,29 @@ public:
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleRequest(AsyncWebServerRequest *request) override final {
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
|
bool canHandle(WebServer &server, HTTPMethod method, const String &uri) override {
|
||||||
|
return this->canHandle(method, uri);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool canHandle(HTTPMethod method, const String& uri) override {
|
||||||
|
return method == HTTP_POST && uri.equals(this->uri) && (!this->canHandleCallback || this->canHandleCallback(method, uri));
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
|
bool canUpload(WebServer &server, const String &uri) override {
|
||||||
|
return this->canUpload(uri);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool canUpload(const String& uri) override {
|
||||||
|
return uri.equals(this->uri) && (!this->canUploadCallback || this->canUploadCallback(uri));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool handle(WebServer& server, HTTPMethod method, const String& uri) override {
|
||||||
if (this->afterUpgradeCallback) {
|
if (this->afterUpgradeCallback) {
|
||||||
this->afterUpgradeCallback(request, this->firmwareResult, this->filesystemResult);
|
this->afterUpgradeCallback(this->firmwareResult, this->filesystemResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->firmwareResult.status = UpgradeStatus::NONE;
|
this->firmwareResult.status = UpgradeStatus::NONE;
|
||||||
@@ -61,147 +87,129 @@ public:
|
|||||||
|
|
||||||
this->filesystemResult.status = UpgradeStatus::NONE;
|
this->filesystemResult.status = UpgradeStatus::NONE;
|
||||||
this->filesystemResult.error.clear();
|
this->filesystemResult.error.clear();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleUpload(AsyncWebServerRequest *request, const String &fileName, size_t index, uint8_t *data, size_t dataLength, bool isFinal) override final {
|
void upload(WebServer& server, const String& uri, HTTPUpload& upload) override {
|
||||||
UpgradeResult* result = nullptr;
|
UpgradeResult* result;
|
||||||
|
if (upload.name.equals(F("firmware"))) {
|
||||||
if (!request->hasParam(asyncsrv::T_name, true, true)) {
|
|
||||||
// Missing content-disposition 'name' parameter
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto& pName = request->getParam(asyncsrv::T_name, true, true)->value();
|
|
||||||
if (pName.equals("fw")) {
|
|
||||||
result = &this->firmwareResult;
|
result = &this->firmwareResult;
|
||||||
|
|
||||||
if (!index) {
|
} else if (upload.name.equals(F("filesystem"))) {
|
||||||
result->progress = 0;
|
|
||||||
result->size = request->hasParam("fw_size", true)
|
|
||||||
? request->getParam("fw_size", true)->value().toInt()
|
|
||||||
: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (pName.equals("fs")) {
|
|
||||||
result = &this->filesystemResult;
|
result = &this->filesystemResult;
|
||||||
|
|
||||||
if (!index) {
|
|
||||||
result->progress = 0;
|
|
||||||
result->size = request->hasParam("fs_size", true)
|
|
||||||
? request->getParam("fs_size", true)->value().toInt()
|
|
||||||
: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Unknown parameter name
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check result status
|
|
||||||
if (result->status != UpgradeStatus::NONE) {
|
if (result->status != UpgradeStatus::NONE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->beforeUpgradeCallback && !this->beforeUpgradeCallback(request, result->type)) {
|
if (this->beforeUpgradeCallback && !this->beforeUpgradeCallback(result->type)) {
|
||||||
result->status = UpgradeStatus::PROHIBITED;
|
result->status = UpgradeStatus::PROHIBITED;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fileName.length()) {
|
if (!upload.filename.length()) {
|
||||||
result->status = UpgradeStatus::NO_FILE;
|
result->status = UpgradeStatus::NO_FILE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!index) {
|
if (upload.status == UPLOAD_FILE_START) {
|
||||||
// reset
|
// reset
|
||||||
if (Update.isRunning()) {
|
if (Update.isRunning()) {
|
||||||
Update.end(false);
|
Update.end(false);
|
||||||
Update.clearError();
|
Update.clearError();
|
||||||
}
|
}
|
||||||
|
|
||||||
// try begin
|
|
||||||
bool begin = false;
|
bool begin = false;
|
||||||
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
|
Update.runAsync(true);
|
||||||
|
|
||||||
|
if (result->type == UpgradeType::FIRMWARE) {
|
||||||
|
begin = Update.begin((ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000, U_FLASH);
|
||||||
|
|
||||||
|
} else if (result->type == UpgradeType::FILESYSTEM) {
|
||||||
|
close_all_fs();
|
||||||
|
begin = Update.begin((size_t)FS_end - (size_t)FS_start, U_FS);
|
||||||
|
}
|
||||||
|
#elif defined(ARDUINO_ARCH_ESP32)
|
||||||
if (result->type == UpgradeType::FIRMWARE) {
|
if (result->type == UpgradeType::FIRMWARE) {
|
||||||
begin = Update.begin(UPDATE_SIZE_UNKNOWN, U_FLASH);
|
begin = Update.begin(UPDATE_SIZE_UNKNOWN, U_FLASH);
|
||||||
|
|
||||||
} else if (result->type == UpgradeType::FILESYSTEM) {
|
} else if (result->type == UpgradeType::FILESYSTEM) {
|
||||||
begin = Update.begin(UPDATE_SIZE_UNKNOWN, U_SPIFFS);
|
begin = Update.begin(UPDATE_SIZE_UNKNOWN, U_SPIFFS);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!begin || Update.hasError()) {
|
if (!begin || Update.hasError()) {
|
||||||
result->status = UpgradeStatus::ERROR_ON_START;
|
result->status = UpgradeStatus::ERROR_ON_START;
|
||||||
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
|
result->error = Update.getErrorString();
|
||||||
|
#else
|
||||||
result->error = Update.errorString();
|
result->error = Update.errorString();
|
||||||
|
#endif
|
||||||
|
|
||||||
Log.serrorln(FPSTR(L_PORTAL_OTA), "File '%s', on start: %s", fileName.c_str(), result->error.c_str());
|
Log.serrorln(FPSTR(L_PORTAL_OTA), F("File '%s', on start: %s"), upload.filename.c_str(), result->error.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_PORTAL_OTA), "File '%s', started", fileName.c_str());
|
Log.sinfoln(FPSTR(L_PORTAL_OTA), F("File '%s', started"), upload.filename.c_str());
|
||||||
}
|
|
||||||
|
|
||||||
if (dataLength) {
|
} else if (upload.status == UPLOAD_FILE_WRITE) {
|
||||||
if (Update.write(data, dataLength) != dataLength) {
|
if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) {
|
||||||
Update.end(false);
|
Update.end(false);
|
||||||
|
|
||||||
result->status = UpgradeStatus::ERROR_ON_WRITE;
|
result->status = UpgradeStatus::ERROR_ON_WRITE;
|
||||||
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
|
result->error = Update.getErrorString();
|
||||||
|
#else
|
||||||
result->error = Update.errorString();
|
result->error = Update.errorString();
|
||||||
|
#endif
|
||||||
|
|
||||||
Log.serrorln(
|
Log.serrorln(
|
||||||
FPSTR(L_PORTAL_OTA), "File '%s', on write %d bytes, %d of %d bytes",
|
FPSTR(L_PORTAL_OTA),
|
||||||
fileName.c_str(),
|
F("File '%s', on writing %d bytes: %s"),
|
||||||
dataLength,
|
upload.filename.c_str(), upload.totalSize, result->error.c_str()
|
||||||
result->progress + dataLength,
|
|
||||||
result->size
|
|
||||||
);
|
);
|
||||||
return;
|
|
||||||
|
} else {
|
||||||
|
Log.sinfoln(FPSTR(L_PORTAL_OTA), F("File '%s', writed %d bytes"), upload.filename.c_str(), upload.totalSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
result->progress += dataLength;
|
} else if (upload.status == UPLOAD_FILE_END) {
|
||||||
Log.sinfoln(
|
if (Update.end(true)) {
|
||||||
FPSTR(L_PORTAL_OTA), "File '%s', write %d bytes, %d of %d bytes",
|
result->status = UpgradeStatus::SUCCESS;
|
||||||
fileName.c_str(),
|
|
||||||
dataLength,
|
|
||||||
result->progress,
|
|
||||||
result->size
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result->size > 0) {
|
Log.sinfoln(FPSTR(L_PORTAL_OTA), F("File '%s': finish"), upload.filename.c_str());
|
||||||
if (result->progress > result->size || (isFinal && result->progress < result->size)) {
|
|
||||||
Update.end(false);
|
|
||||||
result->status = UpgradeStatus::SIZE_MISMATCH;
|
|
||||||
|
|
||||||
Log.serrorln(
|
} else {
|
||||||
FPSTR(L_PORTAL_OTA), "File '%s', size mismatch: %d of %d bytes",
|
|
||||||
fileName.c_str(),
|
|
||||||
result->progress,
|
|
||||||
result->size
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isFinal) {
|
|
||||||
if (!Update.end(true)) {
|
|
||||||
result->status = UpgradeStatus::ERROR_ON_FINISH;
|
result->status = UpgradeStatus::ERROR_ON_FINISH;
|
||||||
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
|
result->error = Update.getErrorString();
|
||||||
|
#else
|
||||||
result->error = Update.errorString();
|
result->error = Update.errorString();
|
||||||
|
#endif
|
||||||
|
|
||||||
Log.serrorln(FPSTR(L_PORTAL_OTA), "File '%s', on finish: %s", fileName.c_str(), result->error);
|
Log.serrorln(FPSTR(L_PORTAL_OTA), F("File '%s', on finish: %s"), upload.filename.c_str(), result->error);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result->status = UpgradeStatus::SUCCESS;
|
} else if (upload.status == UPLOAD_FILE_ABORTED) {
|
||||||
Log.sinfoln(FPSTR(L_PORTAL_OTA), "File '%s': finish", fileName.c_str());
|
Update.end(false);
|
||||||
}
|
result->status = UpgradeStatus::ABORTED;
|
||||||
}
|
|
||||||
|
|
||||||
bool isRequestHandlerTrivial() const override final {
|
Log.serrorln(FPSTR(L_PORTAL_OTA), F("File '%s': aborted"), upload.filename.c_str());
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
CanHandleCallback canHandleCallback;
|
||||||
|
CanUploadCallback canUploadCallback;
|
||||||
BeforeUpgradeCallback beforeUpgradeCallback;
|
BeforeUpgradeCallback beforeUpgradeCallback;
|
||||||
AfterUpgradeCallback afterUpgradeCallback;
|
AfterUpgradeCallback afterUpgradeCallback;
|
||||||
AsyncURIMatcher uri;
|
const char* uri = nullptr;
|
||||||
|
|
||||||
UpgradeResult firmwareResult{UpgradeType::FIRMWARE, UpgradeStatus::NONE};
|
UpgradeResult firmwareResult{UpgradeType::FIRMWARE, UpgradeStatus::NONE};
|
||||||
UpgradeResult filesystemResult{UpgradeType::FILESYSTEM, UpgradeStatus::NONE};
|
UpgradeResult filesystemResult{UpgradeType::FILESYSTEM, UpgradeStatus::NONE};
|
||||||
|
|||||||
@@ -14,23 +14,19 @@ extra_configs = secrets.default.ini
|
|||||||
core_dir = .pio
|
core_dir = .pio
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
version = 1.5.6
|
version = 1.6.0
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
ESP32Async/AsyncTCP
|
|
||||||
;ESP32Async/ESPAsyncWebServer
|
|
||||||
https://github.com/ESP32Async/ESPAsyncWebServer#main
|
|
||||||
mathieucarbou/MycilaWebSerial@^8.2.0
|
|
||||||
bblanchon/ArduinoJson@^7.4.2
|
bblanchon/ArduinoJson@^7.4.2
|
||||||
;ihormelnyk/OpenTherm Library@^1.1.5
|
;ihormelnyk/OpenTherm Library@^1.1.5
|
||||||
https://github.com/Laxilef/opentherm_library#esp32_timer
|
https://github.com/Laxilef/opentherm_library#esp32_timer
|
||||||
arduino-libraries/ArduinoMqttClient@^0.1.8
|
arduino-libraries/ArduinoMqttClient@^0.1.8
|
||||||
|
lennarthennigs/ESP Telnet@^2.2.3
|
||||||
gyverlibs/FileData@^1.0.3
|
gyverlibs/FileData@^1.0.3
|
||||||
gyverlibs/GyverPID@^3.3.2
|
gyverlibs/GyverPID@^3.3.2
|
||||||
gyverlibs/GyverBlinker@^1.1.1
|
gyverlibs/GyverBlinker@^1.1.1
|
||||||
https://github.com/pstolarz/Arduino-Temperature-Control-Library.git#OneWireNg
|
https://github.com/pstolarz/Arduino-Temperature-Control-Library.git#OneWireNg
|
||||||
;laxilef/TinyLogger@^1.1.1
|
laxilef/TinyLogger@^1.1.1
|
||||||
https://github.com/Laxilef/TinyLogger#custom_handlers
|
|
||||||
build_type = ${secrets.build_type}
|
build_type = ${secrets.build_type}
|
||||||
build_flags =
|
build_flags =
|
||||||
-mtext-section-literals
|
-mtext-section-literals
|
||||||
@@ -38,13 +34,10 @@ build_flags =
|
|||||||
;-D DEBUG_ESP_CORE -D DEBUG_ESP_WIFI -D DEBUG_ESP_HTTP_SERVER -D DEBUG_ESP_PORT=Serial
|
;-D DEBUG_ESP_CORE -D DEBUG_ESP_WIFI -D DEBUG_ESP_HTTP_SERVER -D DEBUG_ESP_PORT=Serial
|
||||||
-D BUILD_VERSION='"${this.version}"'
|
-D BUILD_VERSION='"${this.version}"'
|
||||||
-D BUILD_ENV='"$PIOENV"'
|
-D BUILD_ENV='"$PIOENV"'
|
||||||
-D CONFIG_ASYNC_TCP_STACK_SIZE=4096
|
|
||||||
-D ARDUINOJSON_USE_DOUBLE=0
|
|
||||||
-D ARDUINOJSON_USE_LONG_LONG=0
|
|
||||||
-D TINYLOGGER_GLOBAL
|
|
||||||
-D DEFAULT_SERIAL_ENABLED=${secrets.serial_enabled}
|
-D DEFAULT_SERIAL_ENABLED=${secrets.serial_enabled}
|
||||||
-D DEFAULT_SERIAL_BAUD=${secrets.serial_baud}
|
-D DEFAULT_SERIAL_BAUD=${secrets.serial_baud}
|
||||||
-D DEFAULT_WEBSERIAL_ENABLED=${secrets.webserial_enabled}
|
-D DEFAULT_TELNET_ENABLED=${secrets.telnet_enabled}
|
||||||
|
-D DEFAULT_TELNET_PORT=${secrets.telnet_port}
|
||||||
-D DEFAULT_LOG_LEVEL=${secrets.log_level}
|
-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}"'
|
||||||
@@ -99,13 +92,13 @@ check_flags = ${env.check_flags}
|
|||||||
;platform_packages =
|
;platform_packages =
|
||||||
; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.5
|
; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.5
|
||||||
; framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip
|
; framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip
|
||||||
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.33/platform-espressif32.zip
|
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.34/platform-espressif32.zip
|
||||||
platform_packages = ${env.platform_packages}
|
platform_packages = ${env.platform_packages}
|
||||||
board_build.partitions = esp32_partitions.csv
|
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 = https://github.com/h2zero/NimBLE-Arduino
|
nimble_lib = h2zero/NimBLE-Arduino@2.3.7
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
extra_scripts =
|
extra_scripts =
|
||||||
post:tools/esp32.py
|
post:tools/esp32.py
|
||||||
@@ -241,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 CONFIG_BT_NIMBLE_EXT_ADV=1
|
-D MYNEWT_VAL_BLE_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
|
||||||
@@ -267,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 CONFIG_BT_NIMBLE_EXT_ADV=1
|
-D MYNEWT_VAL_BLE_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
|
||||||
@@ -373,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 CONFIG_BT_NIMBLE_EXT_ADV=1
|
-D MYNEWT_VAL_BLE_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
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ build_type = release
|
|||||||
|
|
||||||
serial_enabled = true
|
serial_enabled = true
|
||||||
serial_baud = 115200
|
serial_baud = 115200
|
||||||
webserial_enabled = true
|
telnet_enabled = true
|
||||||
|
telnet_port = 23
|
||||||
log_level = 5
|
log_level = 5
|
||||||
hostname = opentherm
|
hostname = opentherm
|
||||||
|
|
||||||
|
|||||||
257
src/HaHelper.h
257
src/HaHelper.h
@@ -261,8 +261,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// object id's
|
// object id's
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(objId.c_str());
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(objId.c_str());
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(
|
||||||
|
sSensor.type == Sensors::Type::MANUAL
|
||||||
|
? FPSTR(HA_ENTITY_NUMBER)
|
||||||
|
: FPSTR(HA_ENTITY_SENSOR),
|
||||||
|
objId.c_str()
|
||||||
|
);
|
||||||
|
|
||||||
const String& configTopic = this->makeConfigTopic(
|
const String& configTopic = this->makeConfigTopic(
|
||||||
sSensor.type == Sensors::Type::MANUAL ? FPSTR(HA_ENTITY_NUMBER) : FPSTR(HA_ENTITY_SENSOR),
|
sSensor.type == Sensors::Type::MANUAL ? FPSTR(HA_ENTITY_NUMBER) : FPSTR(HA_ENTITY_SENSOR),
|
||||||
@@ -323,8 +328,8 @@ public:
|
|||||||
String objId = Sensors::makeObjectIdWithSuffix(sSensor.name, F("connected"));
|
String objId = Sensors::makeObjectIdWithSuffix(sSensor.name, F("connected"));
|
||||||
|
|
||||||
// object id's
|
// object id's
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(objId.c_str());
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(objId.c_str());
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), objId.c_str());
|
||||||
|
|
||||||
// state topic
|
// state topic
|
||||||
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(
|
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(
|
||||||
@@ -370,8 +375,8 @@ public:
|
|||||||
String objId = Sensors::makeObjectIdWithSuffix(sSensor.name, F("signal_quality"));
|
String objId = Sensors::makeObjectIdWithSuffix(sSensor.name, F("signal_quality"));
|
||||||
|
|
||||||
// object id's
|
// object id's
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(objId.c_str());
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(objId.c_str());
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), objId.c_str());
|
||||||
|
|
||||||
// state topic
|
// state topic
|
||||||
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(
|
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(
|
||||||
@@ -407,7 +412,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool deleteSignalQualityDynamicSensor(Sensors::Settings& sSensor) {
|
bool deleteSignalQualityDynamicSensor(Sensors::Settings& sSensor) {
|
||||||
JsonDocument doc;
|
|
||||||
const String& configTopic = this->makeConfigTopic(
|
const String& configTopic = this->makeConfigTopic(
|
||||||
FPSTR(HA_ENTITY_SENSOR),
|
FPSTR(HA_ENTITY_SENSOR),
|
||||||
Sensors::makeObjectIdWithSuffix(sSensor.name, F("signal_quality")).c_str()
|
Sensors::makeObjectIdWithSuffix(sSensor.name, F("signal_quality")).c_str()
|
||||||
@@ -421,8 +425,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("heating_turbo"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating_turbo"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SWITCH), F("heating_turbo"));
|
||||||
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("Turbo heating");
|
doc[FPSTR(HA_NAME)] = F("Turbo heating");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:rocket-launch-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:rocket-launch-outline");
|
||||||
@@ -439,12 +443,34 @@ public:
|
|||||||
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_SWITCH), F("heating_turbo")).c_str(), doc);
|
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_SWITCH), F("heating_turbo")).c_str(), doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool publishSwitchHeatingHysteresis(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("heating_hysteresis"));
|
||||||
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SWITCH), F("heating_hysteresis"));
|
||||||
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
|
doc[FPSTR(HA_NAME)] = F("Use heating hysteresis");
|
||||||
|
doc[FPSTR(HA_ICON)] = F("mdi:altimeter");
|
||||||
|
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
||||||
|
doc[FPSTR(HA_STATE_ON)] = true;
|
||||||
|
doc[FPSTR(HA_STATE_OFF)] = false;
|
||||||
|
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.heating.hysteresis.enabled }}");
|
||||||
|
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
||||||
|
doc[FPSTR(HA_PAYLOAD_ON)] = F("{\"heating\": {\"hysteresis\" : {\"enabled\" : true}}}");
|
||||||
|
doc[FPSTR(HA_PAYLOAD_OFF)] = F("{\"heating\": {\"hysteresis\" : {\"enabled\" : false}}}");
|
||||||
|
doc[FPSTR(HA_EXPIRE_AFTER)] = this->expireAfter;
|
||||||
|
doc.shrinkToFit();
|
||||||
|
|
||||||
|
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_SWITCH), F("heating_hysteresis")).c_str(), doc);
|
||||||
|
}
|
||||||
|
|
||||||
bool publishInputHeatingHysteresis(UnitSystem unit = UnitSystem::METRIC, bool enabledByDefault = true) {
|
bool publishInputHeatingHysteresis(UnitSystem unit = UnitSystem::METRIC, 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->getObjectIdWithPrefix(F("heating_hysteresis"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating_hysteresis"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("heating_hysteresis"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -458,9 +484,9 @@ public:
|
|||||||
doc[FPSTR(HA_NAME)] = F("Heating hysteresis");
|
doc[FPSTR(HA_NAME)] = F("Heating hysteresis");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:altimeter");
|
doc[FPSTR(HA_ICON)] = F("mdi:altimeter");
|
||||||
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.heating.hysteresis|float(0)|round(2) }}");
|
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.heating.hysteresis.value|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("{\"heating\": {\"hysteresis\" : {{ value }}}}");
|
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"heating\": {\"hysteresis\" : {\"value\" : {{ value }}}}}");
|
||||||
doc[FPSTR(HA_MIN)] = 0;
|
doc[FPSTR(HA_MIN)] = 0;
|
||||||
doc[FPSTR(HA_MAX)] = 15;
|
doc[FPSTR(HA_MAX)] = 15;
|
||||||
doc[FPSTR(HA_STEP)] = 0.01f;
|
doc[FPSTR(HA_STEP)] = 0.01f;
|
||||||
@@ -475,8 +501,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("heating_turbo_factor"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating_turbo_factor"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("heating_turbo_factor"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("power_factor");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("power_factor");
|
||||||
doc[FPSTR(HA_NAME)] = F("Heating turbo factor");
|
doc[FPSTR(HA_NAME)] = F("Heating turbo factor");
|
||||||
@@ -499,8 +525,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("heating_min_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating_min_temp"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("heating_min_temp"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -533,8 +559,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("heating_max_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating_max_temp"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("heating_max_temp"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -568,8 +594,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("dhw_min_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("dhw_min_temp"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("dhw_min_temp"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -602,8 +628,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("dhw_max_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("dhw_max_temp"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("dhw_max_temp"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -637,8 +663,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("pid"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SWITCH), F("pid"));
|
||||||
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("PID");
|
doc[FPSTR(HA_NAME)] = F("PID");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:chart-bar-stacked");
|
doc[FPSTR(HA_ICON)] = F("mdi:chart-bar-stacked");
|
||||||
@@ -659,8 +685,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("pid_p"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_p"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_p"));
|
||||||
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("PID factor P");
|
doc[FPSTR(HA_NAME)] = F("PID factor P");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-p-circle-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-p-circle-outline");
|
||||||
@@ -682,8 +708,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("pid_i"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_i"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_i"));
|
||||||
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("PID factor I");
|
doc[FPSTR(HA_NAME)] = F("PID factor I");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-i-circle-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-i-circle-outline");
|
||||||
@@ -705,8 +731,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("pid_d"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_d"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_d"));
|
||||||
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("PID factor D");
|
doc[FPSTR(HA_NAME)] = F("PID factor D");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-d-circle-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-d-circle-outline");
|
||||||
@@ -728,8 +754,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("pid_dt"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_dt"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_dt"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("duration");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("duration");
|
||||||
doc[FPSTR(HA_UNIT_OF_MEASUREMENT)] = F("s");
|
doc[FPSTR(HA_UNIT_OF_MEASUREMENT)] = F("s");
|
||||||
@@ -753,8 +779,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("pid_min_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_min_temp"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_min_temp"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -787,8 +813,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("pid_max_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_max_temp"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_max_temp"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -822,8 +848,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("equitherm"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SWITCH), F("equitherm"));
|
||||||
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");
|
doc[FPSTR(HA_NAME)] = F("Equitherm");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:sun-snowflake-variant");
|
doc[FPSTR(HA_ICON)] = F("mdi:sun-snowflake-variant");
|
||||||
@@ -840,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 publishInputEquithermFactorN(bool enabledByDefault = true) {
|
bool publishInputEquithermSlope(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->getObjectIdWithPrefix(F("equitherm_n"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_slope"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_slope"));
|
||||||
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 factor N");
|
doc[FPSTR(HA_NAME)] = F("Equitherm slope");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-n-circle-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:slope-uphill");
|
||||||
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.n_factor|float(0)|round(3) }}");
|
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.equitherm.slope|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\": {\"n_factor\" : {{ value }}}}");
|
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"equitherm\": {\"slope\" : {{ 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;
|
||||||
@@ -860,64 +886,88 @@ 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_n_factor")).c_str(), doc);
|
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_slope")).c_str(), doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool publishInputEquithermFactorK(bool enabledByDefault = true) {
|
bool publishInputEquithermExponent(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->getObjectIdWithPrefix(F("equitherm_k"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_exponent"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_exponent"));
|
||||||
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 factor K");
|
doc[FPSTR(HA_NAME)] = F("Equitherm exponent");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-k-circle-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:exponent");
|
||||||
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.k_factor|float(0)|round(2) }}");
|
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.equitherm.exponent|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\": {\"k_factor\" : {{ value }}}}");
|
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"equitherm\": {\"exponent\" : {{ value }}}}");
|
||||||
doc[FPSTR(HA_MIN)] = 0;
|
doc[FPSTR(HA_MIN)] = 0.1;
|
||||||
doc[FPSTR(HA_MAX)] = 10;
|
doc[FPSTR(HA_MAX)] = 2;
|
||||||
|
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_k_factor")).c_str(), doc);
|
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_shift")).c_str(), doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool publishInputEquithermFactorT(bool enabledByDefault = true) {
|
bool publishInputEquithermTargetDiffFactor(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->getObjectIdWithPrefix(F("equitherm_t"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_target_diff_factor"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_target_diff_factor"));
|
||||||
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 factor T");
|
doc[FPSTR(HA_NAME)] = F("Equitherm target diff factor");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-t-circle-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:chart-timeline-variant-shimmer");
|
||||||
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.t_factor|float(0)|round(2) }}");
|
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.equitherm.targetDiffFactor|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\": {\"t_factor\" : {{ value }}}}");
|
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"equitherm\": {\"targetDiffFactor\" : {{ 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.01f;
|
doc[FPSTR(HA_STEP)] = 0.001f;
|
||||||
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_t_factor")).c_str(), doc);
|
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_target_diff_factor")).c_str(), doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool publishStatusState(bool enabledByDefault = true) {
|
bool publishStatusState(bool enabledByDefault = true) {
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("status"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("status"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("status"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
||||||
doc[FPSTR(HA_NAME)] = F("Status");
|
doc[FPSTR(HA_NAME)] = F("Status");
|
||||||
@@ -934,8 +984,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("emergency"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("emergency"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("emergency"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
||||||
doc[FPSTR(HA_NAME)] = F("Emergency");
|
doc[FPSTR(HA_NAME)] = F("Emergency");
|
||||||
@@ -952,8 +1002,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("ot_status"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("ot_status"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("ot_status"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("connectivity");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("connectivity");
|
||||||
doc[FPSTR(HA_NAME)] = F("Opentherm status");
|
doc[FPSTR(HA_NAME)] = F("Opentherm status");
|
||||||
@@ -973,9 +1023,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
||||||
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->getObjectIdWithPrefix(F("heating"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("heating"));
|
||||||
//doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
||||||
doc[FPSTR(HA_NAME)] = F("Heating");
|
doc[FPSTR(HA_NAME)] = F("Heating");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:radiator");
|
doc[FPSTR(HA_ICON)] = F("mdi:radiator");
|
||||||
@@ -994,9 +1043,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
||||||
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->getObjectIdWithPrefix(F("dhw"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("dhw"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("dhw"));
|
||||||
//doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
||||||
doc[FPSTR(HA_NAME)] = F("DHW");
|
doc[FPSTR(HA_NAME)] = F("DHW");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:faucet");
|
doc[FPSTR(HA_ICON)] = F("mdi:faucet");
|
||||||
@@ -1015,9 +1063,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
||||||
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->getObjectIdWithPrefix(F("flame"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("flame"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("flame"));
|
||||||
//doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
||||||
doc[FPSTR(HA_NAME)] = F("Flame");
|
doc[FPSTR(HA_NAME)] = F("Flame");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:gas-burner");
|
doc[FPSTR(HA_ICON)] = F("mdi:gas-burner");
|
||||||
@@ -1036,8 +1083,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
||||||
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->getObjectIdWithPrefix(F("fault"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("fault"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("fault"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
||||||
doc[FPSTR(HA_NAME)] = F("Fault");
|
doc[FPSTR(HA_NAME)] = F("Fault");
|
||||||
@@ -1057,8 +1104,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
||||||
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->getObjectIdWithPrefix(FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
||||||
doc[FPSTR(HA_NAME)] = F("Diagnostic");
|
doc[FPSTR(HA_NAME)] = F("Diagnostic");
|
||||||
@@ -1075,8 +1122,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("ext_pump"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("ext_pump"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("ext_pump"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
||||||
doc[FPSTR(HA_NAME)] = F("External pump");
|
doc[FPSTR(HA_NAME)] = F("External pump");
|
||||||
@@ -1096,8 +1143,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.connected and value_json.slave.fault.active, 'online', 'offline') }}");
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.connected and value_json.slave.fault.active, 'online', 'offline') }}");
|
||||||
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->getObjectIdWithPrefix(F("fault_code"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("fault_code"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), F("fault_code"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_NAME)] = F("Fault code");
|
doc[FPSTR(HA_NAME)] = F("Fault code");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:cog-box");
|
doc[FPSTR(HA_ICON)] = F("mdi:cog-box");
|
||||||
@@ -1116,8 +1163,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.connected and value_json.slave.fault.active or value_json.slave.diag.active, 'online', 'offline') }}");
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.connected and value_json.slave.fault.active or value_json.slave.diag.active, 'online', 'offline') }}");
|
||||||
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->getObjectIdWithPrefix(F("diagnostic_code"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("diagnostic_code"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), F("diagnostic_code"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_NAME)] = F("Diagnostic code");
|
doc[FPSTR(HA_NAME)] = F("Diagnostic code");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:information-box");
|
doc[FPSTR(HA_ICON)] = F("mdi:information-box");
|
||||||
@@ -1133,8 +1180,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(FPSTR(S_RSSI));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(FPSTR(S_RSSI));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), FPSTR(S_RSSI));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("signal_strength");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("signal_strength");
|
||||||
doc[FPSTR(HA_STATE_CLASS)] = FPSTR(HA_STATE_CLASS_MEASUREMENT);
|
doc[FPSTR(HA_STATE_CLASS)] = FPSTR(HA_STATE_CLASS_MEASUREMENT);
|
||||||
@@ -1153,8 +1200,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("uptime"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("uptime"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), F("uptime"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("duration");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("duration");
|
||||||
doc[FPSTR(HA_STATE_CLASS)] = F("total_increasing");
|
doc[FPSTR(HA_STATE_CLASS)] = F("total_increasing");
|
||||||
@@ -1174,8 +1221,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("heating"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_CLIMATE), F("heating"));
|
||||||
doc[FPSTR(HA_NAME)] = F("Heating");
|
doc[FPSTR(HA_NAME)] = F("Heating");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:radiator");
|
doc[FPSTR(HA_ICON)] = F("mdi:radiator");
|
||||||
|
|
||||||
@@ -1226,8 +1273,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(F("dhw"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("dhw"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_CLIMATE), F("dhw"));
|
||||||
doc[FPSTR(HA_NAME)] = F("DHW");
|
doc[FPSTR(HA_NAME)] = F("DHW");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:faucet");
|
doc[FPSTR(HA_ICON)] = F("mdi:faucet");
|
||||||
|
|
||||||
@@ -1271,8 +1318,8 @@ public:
|
|||||||
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->getObjectIdWithPrefix(FPSTR(S_RESTART));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(FPSTR(S_RESTART));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BUTTON), FPSTR(S_RESTART));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
||||||
doc[FPSTR(HA_NAME)] = F("Restart");
|
doc[FPSTR(HA_NAME)] = F("Restart");
|
||||||
@@ -1291,8 +1338,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.fault.active, 'online', 'offline') }}");
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.fault.active, 'online', 'offline') }}");
|
||||||
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->getObjectIdWithPrefix(F("reset_fault"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("reset_fault"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BUTTON), F("reset_fault"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
||||||
doc[FPSTR(HA_NAME)] = F("Reset fault");
|
doc[FPSTR(HA_NAME)] = F("Reset fault");
|
||||||
@@ -1311,8 +1358,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.diag.active, 'online', 'offline') }}");
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.diag.active, 'online', 'offline') }}");
|
||||||
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->getObjectIdWithPrefix(F("reset_diagnostic"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("reset_diagnostic"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BUTTON), F("reset_diagnostic"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
||||||
doc[FPSTR(HA_NAME)] = F("Reset diagnostic");
|
doc[FPSTR(HA_NAME)] = F("Reset diagnostic");
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ extern NetworkMgr* network;
|
|||||||
extern MqttTask* tMqtt;
|
extern MqttTask* tMqtt;
|
||||||
extern OpenThermTask* tOt;
|
extern OpenThermTask* tOt;
|
||||||
extern FileData fsNetworkSettings, fsSettings, fsSensorsSettings;
|
extern FileData fsNetworkSettings, fsSettings, fsSensorsSettings;
|
||||||
|
extern ESPTelnetStream* telnetStream;
|
||||||
|
|
||||||
|
|
||||||
class MainTask : public Task {
|
class MainTask : public Task {
|
||||||
@@ -39,6 +40,7 @@ protected:
|
|||||||
PumpStartReason extPumpStartReason = PumpStartReason::NONE;
|
PumpStartReason extPumpStartReason = PumpStartReason::NONE;
|
||||||
unsigned long externalPumpStartTime = 0;
|
unsigned long externalPumpStartTime = 0;
|
||||||
bool ntpStarted = false;
|
bool ntpStarted = false;
|
||||||
|
bool telnetStarted = false;
|
||||||
bool emergencyDetected = false;
|
bool emergencyDetected = false;
|
||||||
unsigned long emergencyFlipTime = 0;
|
unsigned long emergencyFlipTime = 0;
|
||||||
bool freezeDetected = false;
|
bool freezeDetected = false;
|
||||||
@@ -104,9 +106,9 @@ protected:
|
|||||||
vars.network.connected = network->isConnected();
|
vars.network.connected = network->isConnected();
|
||||||
vars.network.rssi = network->isConnected() ? WiFi.RSSI() : 0;
|
vars.network.rssi = network->isConnected() ? WiFi.RSSI() : 0;
|
||||||
|
|
||||||
if (settings.system.logLevel >= TinyLoggerLevel::SILENT && settings.system.logLevel <= TinyLoggerLevel::VERBOSE) {
|
if (settings.system.logLevel >= TinyLogger::Level::SILENT && settings.system.logLevel <= TinyLogger::Level::VERBOSE) {
|
||||||
if (Log.getLevel() != settings.system.logLevel) {
|
if (Log.getLevel() != settings.system.logLevel) {
|
||||||
Log.setLevel(static_cast<TinyLoggerLevel>(settings.system.logLevel));
|
Log.setLevel(static_cast<TinyLogger::Level>(settings.system.logLevel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,6 +123,11 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this->telnetStarted && telnetStream != nullptr) {
|
||||||
|
telnetStream->begin(23, false);
|
||||||
|
this->telnetStarted = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (settings.mqtt.enabled && !tMqtt->isEnabled()) {
|
if (settings.mqtt.enabled && !tMqtt->isEnabled()) {
|
||||||
tMqtt->enable();
|
tMqtt->enable();
|
||||||
|
|
||||||
@@ -135,6 +142,11 @@ protected:
|
|||||||
this->ntpStarted = false;
|
this->ntpStarted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this->telnetStarted) {
|
||||||
|
telnetStream->stop();
|
||||||
|
this->telnetStarted = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (tMqtt->isEnabled()) {
|
if (tMqtt->isEnabled()) {
|
||||||
tMqtt->disable();
|
tMqtt->disable();
|
||||||
}
|
}
|
||||||
@@ -148,10 +160,23 @@ protected:
|
|||||||
}
|
}
|
||||||
this->ledStatus();
|
this->ledStatus();
|
||||||
|
|
||||||
|
// telnet
|
||||||
|
if (this->telnetStarted) {
|
||||||
|
this->yield();
|
||||||
|
telnetStream->loop();
|
||||||
|
this->yield();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// anti memory leak
|
// anti memory leak
|
||||||
while (Serial.available() > 0) {
|
for (Stream* stream : Log.getStreams()) {
|
||||||
Serial.read();
|
while (stream->available() > 0) {
|
||||||
|
stream->read();
|
||||||
|
|
||||||
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
|
::optimistic_yield(1000);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// heap info
|
// heap info
|
||||||
@@ -190,7 +215,7 @@ protected:
|
|||||||
vars.states.restarting = true;
|
vars.states.restarting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.system.logLevel < TinyLoggerLevel::VERBOSE) {
|
if (settings.system.logLevel < TinyLogger::Level::VERBOSE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ protected:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.system.logLevel >= TinyLoggerLevel::TRACE) {
|
if (settings.system.logLevel >= TinyLogger::Level::TRACE) {
|
||||||
Log.strace(FPSTR(L_MQTT_MSG), F("Topic: %s\r\n> "), topic.c_str());
|
Log.strace(FPSTR(L_MQTT_MSG), F("Topic: %s\r\n> "), topic.c_str());
|
||||||
if (Log.lock()) {
|
if (Log.lock()) {
|
||||||
for (size_t i = 0; i < length; i++) {
|
for (size_t i = 0; i < length; i++) {
|
||||||
@@ -486,6 +486,7 @@ protected:
|
|||||||
void publishHaEntities() {
|
void publishHaEntities() {
|
||||||
// heating
|
// heating
|
||||||
this->haHelper->publishSwitchHeatingTurbo(false);
|
this->haHelper->publishSwitchHeatingTurbo(false);
|
||||||
|
this->haHelper->publishSwitchHeatingHysteresis();
|
||||||
this->haHelper->publishInputHeatingHysteresis(settings.system.unitSystem);
|
this->haHelper->publishInputHeatingHysteresis(settings.system.unitSystem);
|
||||||
this->haHelper->publishInputHeatingTurboFactor(false);
|
this->haHelper->publishInputHeatingTurboFactor(false);
|
||||||
this->haHelper->publishInputHeatingMinTemp(settings.system.unitSystem);
|
this->haHelper->publishInputHeatingMinTemp(settings.system.unitSystem);
|
||||||
@@ -502,9 +503,10 @@ protected:
|
|||||||
|
|
||||||
// equitherm
|
// equitherm
|
||||||
this->haHelper->publishSwitchEquitherm();
|
this->haHelper->publishSwitchEquitherm();
|
||||||
this->haHelper->publishInputEquithermFactorN(false);
|
this->haHelper->publishInputEquithermSlope(false);
|
||||||
this->haHelper->publishInputEquithermFactorK(false);
|
this->haHelper->publishInputEquithermExponent(false);
|
||||||
this->haHelper->publishInputEquithermFactorT(false);
|
this->haHelper->publishInputEquithermShift(false);
|
||||||
|
this->haHelper->publishInputEquithermTargetDiffFactor(false);
|
||||||
|
|
||||||
// states
|
// states
|
||||||
this->haHelper->publishStatusState();
|
this->haHelper->publishStatusState();
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ protected:
|
|||||||
vars.master.heating.enabled = this->isReady()
|
vars.master.heating.enabled = this->isReady()
|
||||||
&& settings.heating.enabled
|
&& settings.heating.enabled
|
||||||
&& vars.cascadeControl.input
|
&& vars.cascadeControl.input
|
||||||
&& !vars.master.heating.blocking
|
&& (!vars.master.heating.blocking || settings.heating.hysteresis.action != HysteresisAction::DISABLE_HEATING)
|
||||||
&& !vars.master.heating.overheat;
|
&& !vars.master.heating.overheat;
|
||||||
|
|
||||||
// DHW settings
|
// DHW settings
|
||||||
@@ -1209,8 +1209,8 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Native heating control
|
// Set indoor temp for Native heating control/Always set indoor temp
|
||||||
if (settings.opentherm.options.nativeHeatingControl) {
|
if (settings.opentherm.options.nativeHeatingControl || settings.opentherm.options.alwaysSetIndoorTemp) {
|
||||||
// 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,10 +1237,13 @@ 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
|
||||||
convertedTemp = convertTemp(vars.master.heating.targetTemp, settings.system.unitSystem, settings.opentherm.unitSystem);
|
float 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)) {
|
||||||
|
|||||||
847
src/PortalTask.h
847
src/PortalTask.h
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,5 @@
|
|||||||
#include <Equitherm.h>
|
|
||||||
#include <GyverPID.h>
|
#include <GyverPID.h>
|
||||||
|
|
||||||
Equitherm etRegulator;
|
|
||||||
GyverPID pidRegulator(0, 0, 0);
|
GyverPID pidRegulator(0, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
@@ -59,12 +57,23 @@ protected:
|
|||||||
this->turbo();
|
this->turbo();
|
||||||
this->hysteresis();
|
this->hysteresis();
|
||||||
|
|
||||||
vars.master.heating.targetTemp = settings.heating.target;
|
if (vars.master.heating.blocking && settings.heating.hysteresis.action == HysteresisAction::SET_ZERO_TARGET) {
|
||||||
vars.master.heating.setpointTemp = roundf(constrain(
|
vars.master.heating.targetTemp = 0.0f;
|
||||||
this->getHeatingSetpointTemp(),
|
vars.master.heating.setpointTemp = 0.0f;
|
||||||
this->getHeatingMinSetpointTemp(),
|
|
||||||
this->getHeatingMaxSetpointTemp()
|
// tick if PID enabled
|
||||||
), 0);
|
if (settings.pid.enabled) {
|
||||||
|
this->getHeatingSetpointTemp();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
vars.master.heating.targetTemp = settings.heating.target;
|
||||||
|
vars.master.heating.setpointTemp = roundf(constrain(
|
||||||
|
this->getHeatingSetpointTemp(),
|
||||||
|
this->getHeatingMinSetpointTemp(),
|
||||||
|
this->getHeatingMaxSetpointTemp()
|
||||||
|
), 0);
|
||||||
|
}
|
||||||
|
|
||||||
Sensors::setValueByType(
|
Sensors::setValueByType(
|
||||||
Sensors::Type::HEATING_SETPOINT_TEMP, vars.master.heating.setpointTemp,
|
Sensors::Type::HEATING_SETPOINT_TEMP, vars.master.heating.setpointTemp,
|
||||||
@@ -92,15 +101,15 @@ protected:
|
|||||||
|
|
||||||
void hysteresis() {
|
void hysteresis() {
|
||||||
bool useHyst = false;
|
bool useHyst = false;
|
||||||
if (settings.heating.hysteresis > 0.01f && this->indoorSensorsConnected) {
|
if (settings.heating.hysteresis.enabled && this->indoorSensorsConnected) {
|
||||||
useHyst = settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeHeatingControl;
|
useHyst = settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeHeatingControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useHyst) {
|
if (useHyst) {
|
||||||
if (!vars.master.heating.blocking && vars.master.heating.indoorTemp - settings.heating.target + 0.0001f >= settings.heating.hysteresis) {
|
if (!vars.master.heating.blocking && vars.master.heating.indoorTemp - settings.heating.target + 0.0001f >= settings.heating.hysteresis.value) {
|
||||||
vars.master.heating.blocking = true;
|
vars.master.heating.blocking = true;
|
||||||
|
|
||||||
} else if (vars.master.heating.blocking && vars.master.heating.indoorTemp - settings.heating.target - 0.0001f <= -(settings.heating.hysteresis)) {
|
} else if (vars.master.heating.blocking && vars.master.heating.indoorTemp - settings.heating.target - 0.0001f <= -(settings.heating.hysteresis.value)) {
|
||||||
vars.master.heating.blocking = false;
|
vars.master.heating.blocking = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,39 +155,32 @@ protected:
|
|||||||
|
|
||||||
// if use equitherm
|
// if use equitherm
|
||||||
if (settings.equitherm.enabled) {
|
if (settings.equitherm.enabled) {
|
||||||
unsigned short minTemp = settings.heating.minTemp;
|
float tempDelta = settings.heating.target - vars.master.heating.outdoorTemp;
|
||||||
unsigned short maxTemp = settings.heating.maxTemp;
|
float maxPoint = settings.heating.target - (
|
||||||
float targetTemp = settings.heating.target;
|
settings.heating.maxTemp - settings.heating.target
|
||||||
float indoorTemp = vars.master.heating.indoorTemp;
|
) / settings.equitherm.slope;
|
||||||
float outdoorTemp = vars.master.heating.outdoorTemp;
|
|
||||||
|
|
||||||
if (settings.system.unitSystem == UnitSystem::IMPERIAL) {
|
float sf = (settings.heating.maxTemp - settings.heating.target) / pow(
|
||||||
minTemp = f2c(minTemp);
|
settings.heating.target - maxPoint,
|
||||||
maxTemp = f2c(maxTemp);
|
1.0f / settings.equitherm.exponent
|
||||||
targetTemp = f2c(targetTemp);
|
);
|
||||||
indoorTemp = f2c(indoorTemp);
|
float etResult = settings.heating.target + settings.equitherm.shift + sf * (
|
||||||
outdoorTemp = f2c(outdoorTemp);
|
tempDelta >= 0
|
||||||
|
? 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this->indoorSensorsConnected || settings.pid.enabled) {
|
// limit
|
||||||
etRegulator.Kt = 0.0f;
|
etResult = constrain(etResult, settings.heating.minTemp, settings.heating.maxTemp);
|
||||||
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 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t valueId = (uint8_t) valueType;
|
uint8_t valueId = (uint8_t) valueType;
|
||||||
if (!isValidValueId(valueId)) {
|
if (!isValidValueId(valueId)) {
|
||||||
return 0;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t id = 0; id <= getMaxSensorId(); id++) {
|
for (uint8_t id = 0; id <= getMaxSensorId(); id++) {
|
||||||
|
|||||||
@@ -32,8 +32,9 @@ struct Settings {
|
|||||||
} serial;
|
} serial;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool enabled = DEFAULT_WEBSERIAL_ENABLED;
|
bool enabled = DEFAULT_TELNET_ENABLED;
|
||||||
} webSerial;
|
unsigned short port = DEFAULT_TELNET_PORT;
|
||||||
|
} telnet;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
char server[49] = "pool.ntp.org";
|
char server[49] = "pool.ntp.org";
|
||||||
@@ -77,6 +78,7 @@ 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;
|
||||||
@@ -102,12 +104,17 @@ struct Settings {
|
|||||||
bool enabled = true;
|
bool enabled = true;
|
||||||
bool turbo = false;
|
bool turbo = false;
|
||||||
float target = DEFAULT_HEATING_TARGET_TEMP;
|
float target = DEFAULT_HEATING_TARGET_TEMP;
|
||||||
float hysteresis = 0.5f;
|
|
||||||
float turboFactor = 7.5f;
|
float turboFactor = 7.5f;
|
||||||
uint8_t minTemp = DEFAULT_HEATING_MIN_TEMP;
|
uint8_t minTemp = DEFAULT_HEATING_MIN_TEMP;
|
||||||
uint8_t maxTemp = DEFAULT_HEATING_MAX_TEMP;
|
uint8_t maxTemp = DEFAULT_HEATING_MAX_TEMP;
|
||||||
uint8_t maxModulation = 100;
|
uint8_t maxModulation = 100;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
bool enabled = true;
|
||||||
|
float value = 0.5f;
|
||||||
|
HysteresisAction action = HysteresisAction::DISABLE_HEATING;
|
||||||
|
} hysteresis;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint8_t highTemp = 95;
|
uint8_t highTemp = 95;
|
||||||
uint8_t lowTemp = 90;
|
uint8_t lowTemp = 90;
|
||||||
@@ -153,9 +160,10 @@ struct Settings {
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
float n_factor = 0.7f;
|
float slope = 0.7f;
|
||||||
float k_factor = 3.0f;
|
float exponent = 1.3f;
|
||||||
float t_factor = 2.0f;
|
float shift = 0.0f;
|
||||||
|
float targetDiffFactor = 2.0f;
|
||||||
} equitherm;
|
} equitherm;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|||||||
@@ -42,8 +42,12 @@
|
|||||||
#define DEFAULT_SERIAL_BAUD 115200
|
#define DEFAULT_SERIAL_BAUD 115200
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DEFAULT_WEBSERIAL_ENABLED
|
#ifndef DEFAULT_TELNET_ENABLED
|
||||||
#define DEFAULT_WEBSERIAL_ENABLED true
|
#define DEFAULT_TELNET_ENABLED true
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DEFAULT_TELNET_PORT
|
||||||
|
#define DEFAULT_TELNET_PORT 23
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef USE_BLE
|
#ifndef USE_BLE
|
||||||
@@ -71,7 +75,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DEFAULT_LOG_LEVEL
|
#ifndef DEFAULT_LOG_LEVEL
|
||||||
#define DEFAULT_LOG_LEVEL TinyLoggerLevel::VERBOSE
|
#define DEFAULT_LOG_LEVEL TinyLogger::Level::VERBOSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DEFAULT_STATUS_LED_GPIO
|
#ifndef DEFAULT_STATUS_LED_GPIO
|
||||||
@@ -159,4 +163,9 @@ enum class UnitSystem : uint8_t {
|
|||||||
IMPERIAL = 1
|
IMPERIAL = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class HysteresisAction : uint8_t {
|
||||||
|
DISABLE_HEATING = 0,
|
||||||
|
SET_ZERO_TARGET = 1
|
||||||
|
};
|
||||||
|
|
||||||
char buffer[255];
|
char buffer[255];
|
||||||
31
src/main.cpp
31
src/main.cpp
@@ -1,8 +1,11 @@
|
|||||||
|
#define ARDUINOJSON_USE_DOUBLE 0
|
||||||
|
#define ARDUINOJSON_USE_LONG_LONG 0
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <FileData.h>
|
#include <FileData.h>
|
||||||
#include <LittleFS.h>
|
#include <LittleFS.h>
|
||||||
#include <MycilaWebSerial.h>
|
#include <ESPTelnetStream.h>
|
||||||
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "strings.h"
|
#include "strings.h"
|
||||||
@@ -34,7 +37,7 @@
|
|||||||
using namespace NetworkUtils;
|
using namespace NetworkUtils;
|
||||||
|
|
||||||
// Vars
|
// Vars
|
||||||
WebSerial* webSerial = nullptr;
|
ESPTelnetStream* telnetStream = nullptr;
|
||||||
NetworkMgr* network = nullptr;
|
NetworkMgr* network = nullptr;
|
||||||
Sensors::Result sensorsResults[SENSORS_AMOUNT];
|
Sensors::Result sensorsResults[SENSORS_AMOUNT];
|
||||||
|
|
||||||
@@ -58,7 +61,7 @@ void setup() {
|
|||||||
Sensors::results = sensorsResults;
|
Sensors::results = sensorsResults;
|
||||||
LittleFS.begin();
|
LittleFS.begin();
|
||||||
|
|
||||||
Log.setLevel(TinyLoggerLevel::VERBOSE);
|
Log.setLevel(TinyLogger::Level::VERBOSE);
|
||||||
Log.setServiceTemplate("\033[1m[%s]\033[22m");
|
Log.setServiceTemplate("\033[1m[%s]\033[22m");
|
||||||
Log.setLevelTemplate("\033[1m[%s]\033[22m");
|
Log.setLevelTemplate("\033[1m[%s]\033[22m");
|
||||||
Log.setMsgPrefix("\033[m ");
|
Log.setMsgPrefix("\033[m ");
|
||||||
@@ -76,7 +79,7 @@ void setup() {
|
|||||||
#if ARDUINO_USB_MODE
|
#if ARDUINO_USB_MODE
|
||||||
Serial.setTxBufferSize(512);
|
Serial.setTxBufferSize(512);
|
||||||
#endif
|
#endif
|
||||||
Log.addHandler(&Serial);
|
Log.addStream(&Serial);
|
||||||
Log.print("\n\n\r");
|
Log.print("\n\n\r");
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -160,24 +163,24 @@ void setup() {
|
|||||||
// Logs settings
|
// Logs settings
|
||||||
if (!settings.system.serial.enabled) {
|
if (!settings.system.serial.enabled) {
|
||||||
Serial.end();
|
Serial.end();
|
||||||
Log.clearHandlers();
|
Log.clearStreams();
|
||||||
|
|
||||||
} else if (settings.system.serial.baudrate != 115200) {
|
} else if (settings.system.serial.baudrate != 115200) {
|
||||||
Serial.end();
|
Serial.end();
|
||||||
Log.clearHandlers();
|
Log.clearStreams();
|
||||||
|
|
||||||
Serial.begin(settings.system.serial.baudrate);
|
Serial.begin(settings.system.serial.baudrate);
|
||||||
Log.addHandler(&Serial);
|
Log.addStream(&Serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.system.webSerial.enabled) {
|
if (settings.system.telnet.enabled) {
|
||||||
webSerial = new WebSerial();
|
telnetStream = new ESPTelnetStream;
|
||||||
webSerial->setBuffer(100);
|
telnetStream->setKeepAliveInterval(500);
|
||||||
Log.addHandler(webSerial);
|
Log.addStream(telnetStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.system.logLevel >= TinyLoggerLevel::SILENT && settings.system.logLevel <= TinyLoggerLevel::VERBOSE) {
|
if (settings.system.logLevel >= TinyLogger::Level::SILENT && settings.system.logLevel <= TinyLogger::Level::VERBOSE) {
|
||||||
Log.setLevel(static_cast<TinyLoggerLevel>(settings.system.logLevel));
|
Log.setLevel(static_cast<TinyLogger::Level>(settings.system.logLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -213,7 +216,7 @@ void setup() {
|
|||||||
tRegulator = new RegulatorTask(true, 10000);
|
tRegulator = new RegulatorTask(true, 10000);
|
||||||
Scheduler.start(tRegulator);
|
Scheduler.start(tRegulator);
|
||||||
|
|
||||||
tPortal = new PortalTask(true, 10);
|
tPortal = new PortalTask(true, 0);
|
||||||
Scheduler.start(tPortal);
|
Scheduler.start(tPortal);
|
||||||
|
|
||||||
tMain = new MainTask(true, 100);
|
tMain = new MainTask(true, 100);
|
||||||
|
|||||||
@@ -34,9 +34,11 @@ const char L_CASCADE_OUTPUT[] PROGMEM = "CASCADE.OUTPUT";
|
|||||||
const char L_EXTPUMP[] PROGMEM = "EXTPUMP";
|
const char L_EXTPUMP[] PROGMEM = "EXTPUMP";
|
||||||
|
|
||||||
|
|
||||||
|
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";
|
||||||
@@ -81,6 +83,7 @@ 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";
|
||||||
@@ -117,7 +120,6 @@ 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";
|
||||||
@@ -143,7 +145,6 @@ 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";
|
||||||
@@ -164,7 +165,6 @@ const char S_POWER[] PROGMEM = "power";
|
|||||||
const char S_PREFIX[] PROGMEM = "prefix";
|
const char S_PREFIX[] PROGMEM = "prefix";
|
||||||
const char S_PROTOCOL_VERSION[] PROGMEM = "protocolVersion";
|
const char S_PROTOCOL_VERSION[] PROGMEM = "protocolVersion";
|
||||||
const char S_PURPOSE[] PROGMEM = "purpose";
|
const char S_PURPOSE[] PROGMEM = "purpose";
|
||||||
const char S_PSRAM[] PROGMEM = "psram";
|
|
||||||
const char S_P_FACTOR[] PROGMEM = "p_factor";
|
const char S_P_FACTOR[] PROGMEM = "p_factor";
|
||||||
const char S_P_MULTIPLIER[] PROGMEM = "p_multiplier";
|
const char S_P_MULTIPLIER[] PROGMEM = "p_multiplier";
|
||||||
const char S_REAL_SIZE[] PROGMEM = "realSize";
|
const char S_REAL_SIZE[] PROGMEM = "realSize";
|
||||||
@@ -183,9 +183,11 @@ 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";
|
||||||
@@ -197,7 +199,9 @@ 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_TEMPERATURE[] PROGMEM = "temperature";
|
const char S_TEMPERATURE[] PROGMEM = "temperature";
|
||||||
const char S_THRESHOLD_HIGH[] PROGMEM = "thresholdHigh";
|
const char S_THRESHOLD_HIGH[] PROGMEM = "thresholdHigh";
|
||||||
const char S_THRESHOLD_LOW[] PROGMEM = "thresholdLow";
|
const char S_THRESHOLD_LOW[] PROGMEM = "thresholdLow";
|
||||||
@@ -208,7 +212,6 @@ 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";
|
||||||
@@ -216,4 +219,3 @@ const char S_USE_DHCP[] PROGMEM = "useDhcp";
|
|||||||
const char S_USER[] PROGMEM = "user";
|
const char S_USER[] PROGMEM = "user";
|
||||||
const char S_VALUE[] PROGMEM = "value";
|
const char S_VALUE[] PROGMEM = "value";
|
||||||
const char S_VERSION[] PROGMEM = "version";
|
const char S_VERSION[] PROGMEM = "version";
|
||||||
const char S_WEBSERIAL[] PROGMEM = "webSerial";
|
|
||||||
112
src/utils.h
112
src/utils.h
@@ -425,8 +425,9 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
|
|||||||
serial[FPSTR(S_ENABLED)] = src.system.serial.enabled;
|
serial[FPSTR(S_ENABLED)] = src.system.serial.enabled;
|
||||||
serial[FPSTR(S_BAUDRATE)] = src.system.serial.baudrate;
|
serial[FPSTR(S_BAUDRATE)] = src.system.serial.baudrate;
|
||||||
|
|
||||||
auto webSerial = system[FPSTR(S_WEBSERIAL)].to<JsonObject>();
|
auto telnet = system[FPSTR(S_TELNET)].to<JsonObject>();
|
||||||
webSerial[FPSTR(S_ENABLED)] = src.system.webSerial.enabled;
|
telnet[FPSTR(S_ENABLED)] = src.system.telnet.enabled;
|
||||||
|
telnet[FPSTR(S_PORT)] = src.system.telnet.port;
|
||||||
|
|
||||||
auto ntp = system[FPSTR(S_NTP)].to<JsonObject>();
|
auto ntp = system[FPSTR(S_NTP)].to<JsonObject>();
|
||||||
ntp[FPSTR(S_SERVER)] = src.system.ntp.server;
|
ntp[FPSTR(S_SERVER)] = src.system.ntp.server;
|
||||||
@@ -467,6 +468,7 @@ 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;
|
||||||
|
|
||||||
@@ -489,7 +491,9 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
|
|||||||
heating[FPSTR(S_ENABLED)] = src.heating.enabled;
|
heating[FPSTR(S_ENABLED)] = src.heating.enabled;
|
||||||
heating[FPSTR(S_TURBO)] = src.heating.turbo;
|
heating[FPSTR(S_TURBO)] = src.heating.turbo;
|
||||||
heating[FPSTR(S_TARGET)] = roundf(src.heating.target, 2);
|
heating[FPSTR(S_TARGET)] = roundf(src.heating.target, 2);
|
||||||
heating[FPSTR(S_HYSTERESIS)] = roundf(src.heating.hysteresis, 3);
|
heating[FPSTR(S_HYSTERESIS)][FPSTR(S_ENABLED)] = src.heating.hysteresis.enabled;
|
||||||
|
heating[FPSTR(S_HYSTERESIS)][FPSTR(S_VALUE)] = roundf(src.heating.hysteresis.value, 3);
|
||||||
|
heating[FPSTR(S_HYSTERESIS)][FPSTR(S_ACTION)] = static_cast<uint8_t>(src.heating.hysteresis.action);
|
||||||
heating[FPSTR(S_TURBO_FACTOR)] = roundf(src.heating.turboFactor, 3);
|
heating[FPSTR(S_TURBO_FACTOR)] = roundf(src.heating.turboFactor, 3);
|
||||||
heating[FPSTR(S_MIN_TEMP)] = src.heating.minTemp;
|
heating[FPSTR(S_MIN_TEMP)] = src.heating.minTemp;
|
||||||
heating[FPSTR(S_MAX_TEMP)] = src.heating.maxTemp;
|
heating[FPSTR(S_MAX_TEMP)] = src.heating.maxTemp;
|
||||||
@@ -516,9 +520,10 @@ 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_N_FACTOR)] = roundf(src.equitherm.n_factor, 3);
|
equitherm[FPSTR(S_SLOPE)] = roundf(src.equitherm.slope, 3);
|
||||||
equitherm[FPSTR(S_K_FACTOR)] = roundf(src.equitherm.k_factor, 3);
|
equitherm[FPSTR(S_EXPONENT)] = roundf(src.equitherm.exponent, 3);
|
||||||
equitherm[FPSTR(S_T_FACTOR)] = roundf(src.equitherm.t_factor, 3);
|
equitherm[FPSTR(S_SHIFT)] = roundf(src.equitherm.shift, 2);
|
||||||
|
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;
|
||||||
@@ -575,7 +580,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
if (!src[FPSTR(S_SYSTEM)][FPSTR(S_LOG_LEVEL)].isNull()) {
|
if (!src[FPSTR(S_SYSTEM)][FPSTR(S_LOG_LEVEL)].isNull()) {
|
||||||
uint8_t value = src[FPSTR(S_SYSTEM)][FPSTR(S_LOG_LEVEL)].as<uint8_t>();
|
uint8_t value = src[FPSTR(S_SYSTEM)][FPSTR(S_LOG_LEVEL)].as<uint8_t>();
|
||||||
|
|
||||||
if (value != dst.system.logLevel && value >= TinyLoggerLevel::SILENT && value <= TinyLoggerLevel::VERBOSE) {
|
if (value != dst.system.logLevel && value >= TinyLogger::Level::SILENT && value <= TinyLogger::Level::VERBOSE) {
|
||||||
dst.system.logLevel = value;
|
dst.system.logLevel = value;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@@ -601,11 +606,20 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src[FPSTR(S_SYSTEM)][FPSTR(S_WEBSERIAL)][FPSTR(S_ENABLED)].is<bool>()) {
|
if (src[FPSTR(S_SYSTEM)][FPSTR(S_TELNET)][FPSTR(S_ENABLED)].is<bool>()) {
|
||||||
bool value = src[FPSTR(S_SYSTEM)][FPSTR(S_WEBSERIAL)][FPSTR(S_ENABLED)].as<bool>();
|
bool value = src[FPSTR(S_SYSTEM)][FPSTR(S_TELNET)][FPSTR(S_ENABLED)].as<bool>();
|
||||||
|
|
||||||
if (value != dst.system.webSerial.enabled) {
|
if (value != dst.system.telnet.enabled) {
|
||||||
dst.system.webSerial.enabled = value;
|
dst.system.telnet.enabled = value;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!src[FPSTR(S_SYSTEM)][FPSTR(S_TELNET)][FPSTR(S_PORT)].isNull()) {
|
||||||
|
unsigned short value = src[FPSTR(S_SYSTEM)][FPSTR(S_TELNET)][FPSTR(S_PORT)].as<unsigned short>();
|
||||||
|
|
||||||
|
if (value > 0 && value <= 65535 && value != dst.system.telnet.port) {
|
||||||
|
dst.system.telnet.port = value;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -990,6 +1004,15 @@ 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>();
|
||||||
|
|
||||||
@@ -1117,29 +1140,38 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_N_FACTOR)].isNull()) {
|
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_SLOPE)].isNull()) {
|
||||||
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_N_FACTOR)].as<float>();
|
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_SLOPE)].as<float>();
|
||||||
|
|
||||||
if (value > 0 && value <= 10 && fabsf(value - dst.equitherm.n_factor) > 0.0001f) {
|
if (value > 0.0f && value <= 10.0f && fabsf(value - dst.equitherm.slope) > 0.0001f) {
|
||||||
dst.equitherm.n_factor = roundf(value, 3);
|
dst.equitherm.slope = roundf(value, 3);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_K_FACTOR)].isNull()) {
|
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_EXPONENT)].isNull()) {
|
||||||
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_K_FACTOR)].as<float>();
|
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_EXPONENT)].as<float>();
|
||||||
|
|
||||||
if (value >= 0 && value <= 10 && fabsf(value - dst.equitherm.k_factor) > 0.0001f) {
|
if (value > 0.0f && value <= 2.0f && fabsf(value - dst.equitherm.exponent) > 0.0001f) {
|
||||||
dst.equitherm.k_factor = roundf(value, 3);
|
dst.equitherm.exponent = roundf(value, 3);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_T_FACTOR)].isNull()) {
|
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_SHIFT)].isNull()) {
|
||||||
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_T_FACTOR)].as<float>();
|
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_SHIFT)].as<float>();
|
||||||
|
|
||||||
if (value >= 0 && value <= 10 && fabsf(value - dst.equitherm.t_factor) > 0.0001f) {
|
if (value >= -15.0f && value <= 15.0f && fabsf(value - dst.equitherm.shift) > 0.0001f) {
|
||||||
dst.equitherm.t_factor = roundf(value, 3);
|
dst.equitherm.shift = roundf(value, 2);
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1294,15 +1326,41 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)].isNull()) {
|
if (src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_ENABLED)].is<bool>()) {
|
||||||
float value = src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)].as<float>();
|
bool value = src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_ENABLED)].as<bool>();
|
||||||
|
|
||||||
if (value >= 0.0f && value <= 15.0f && fabsf(value - dst.heating.hysteresis) > 0.0001f) {
|
if (value != dst.heating.hysteresis.enabled) {
|
||||||
dst.heating.hysteresis = roundf(value, 2);
|
dst.heating.hysteresis.enabled = value;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_VALUE)].isNull()) {
|
||||||
|
float value = src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_VALUE)].as<float>();
|
||||||
|
|
||||||
|
if (value >= 0.0f && value <= 15.0f && fabsf(value - dst.heating.hysteresis.value) > 0.0001f) {
|
||||||
|
dst.heating.hysteresis.value = roundf(value, 2);
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_ACTION)].isNull()) {
|
||||||
|
uint8_t value = src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_ACTION)].as<uint8_t>();
|
||||||
|
|
||||||
|
switch (value) {
|
||||||
|
case static_cast<uint8_t>(HysteresisAction::DISABLE_HEATING):
|
||||||
|
case static_cast<uint8_t>(HysteresisAction::SET_ZERO_TARGET):
|
||||||
|
if (static_cast<uint8_t>(dst.heating.hysteresis.action) != value) {
|
||||||
|
dst.heating.hysteresis.action = static_cast<HysteresisAction>(value);
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!src[FPSTR(S_HEATING)][FPSTR(S_TURBO_FACTOR)].isNull()) {
|
if (!src[FPSTR(S_HEATING)][FPSTR(S_TURBO_FACTOR)].isNull()) {
|
||||||
float value = src[FPSTR(S_HEATING)][FPSTR(S_TURBO_FACTOR)].as<float>();
|
float value = src[FPSTR(S_HEATING)][FPSTR(S_TURBO_FACTOR)].as<float>();
|
||||||
|
|
||||||
|
|||||||
@@ -341,8 +341,12 @@
|
|||||||
"enable": "启用串口",
|
"enable": "启用串口",
|
||||||
"baud": "串口波特率"
|
"baud": "串口波特率"
|
||||||
},
|
},
|
||||||
"webSerial": {
|
"telnet": {
|
||||||
"enable": "启用 WebSerial"
|
"enable": "启用 Telnet",
|
||||||
|
"port": {
|
||||||
|
"title": "Telnet 端口",
|
||||||
|
"note": "默认值:23"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"ntp": {
|
"ntp": {
|
||||||
"server": "NTP服务器",
|
"server": "NTP服务器",
|
||||||
@@ -352,7 +356,16 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"heating": {
|
"heating": {
|
||||||
"hyst": "滞后值<small>(单位:度)</small>",
|
"hyst": {
|
||||||
|
"title": "滞回",
|
||||||
|
"desc": "滞回有助于维持设定的室内温度(在使用«Equitherm»和/或«PID»时)。强制禁用加热当<code>current indoor > target + value</code>,启用加热当<code>current indoor < (target - value)</code>。",
|
||||||
|
"value": "值 <small>(以度为单位)</small>",
|
||||||
|
"action": {
|
||||||
|
"title": "行动",
|
||||||
|
"disableHeating": "禁用加热",
|
||||||
|
"set0target": "设置空目标"
|
||||||
|
}
|
||||||
|
},
|
||||||
"turboFactor": "Turbo 模式系数"
|
"turboFactor": "Turbo 模式系数"
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -367,11 +380,26 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"equitherm": {
|
"equitherm": {
|
||||||
"n": "N 系数",
|
"slope": {
|
||||||
"k": "K 系数",
|
"title": "斜率",
|
||||||
"t": {
|
"note": "热损失补偿。主要调谐参数。"
|
||||||
"title": "T 系数",
|
},
|
||||||
"note": "启用PID时此参数无效"
|
"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 因子",
|
||||||
|
"note": "如果启用 PID,则不使用。将目标和当前室内温度之间的差值添加到设定点:<code>setpoint = setpoint + ((target - indoor) * T)</code>。"
|
||||||
|
},
|
||||||
|
"chart": {
|
||||||
|
"targetTemp": "目标室内温度",
|
||||||
|
"setpointTemp": "热载体温度",
|
||||||
|
"outdoorTemp": "室外温度"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -341,8 +341,12 @@
|
|||||||
"enable": "Enabled Serial port",
|
"enable": "Enabled Serial port",
|
||||||
"baud": "Serial port baud rate"
|
"baud": "Serial port baud rate"
|
||||||
},
|
},
|
||||||
"webSerial": {
|
"telnet": {
|
||||||
"enable": "Enabled WebSerial"
|
"enable": "Enabled Telnet",
|
||||||
|
"port": {
|
||||||
|
"title": "Telnet port",
|
||||||
|
"note": "Default: 23"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"ntp": {
|
"ntp": {
|
||||||
"server": "NTP server",
|
"server": "NTP server",
|
||||||
@@ -352,7 +356,16 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"heating": {
|
"heating": {
|
||||||
"hyst": "Hysteresis <small>(in degrees)</small>",
|
"hyst": {
|
||||||
|
"title": "Hysteresis",
|
||||||
|
"desc": "Hysteresis is useful for maintaining a set indoor temp (when using «Equitherm» and/or «PID»). Forces disable heating when <code>current indoor > target + value</code> and enable heating when <code>current indoor < (target - value)</code>.",
|
||||||
|
"value": "Value <small>(in degrees)</small>",
|
||||||
|
"action": {
|
||||||
|
"title": "Action",
|
||||||
|
"disableHeating": "Disable heating",
|
||||||
|
"set0target": "Set null target"
|
||||||
|
}
|
||||||
|
},
|
||||||
"turboFactor": "Turbo mode coeff."
|
"turboFactor": "Turbo mode coeff."
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -367,11 +380,26 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"equitherm": {
|
"equitherm": {
|
||||||
"n": "N factor",
|
"slope": {
|
||||||
"k": "K factor",
|
"title": "Slope",
|
||||||
"t": {
|
"note": "Heat loss compensation. Main tuning parameter."
|
||||||
|
},
|
||||||
|
"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"
|
"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>."
|
||||||
|
},
|
||||||
|
"chart": {
|
||||||
|
"targetTemp": "Target indoor temperature",
|
||||||
|
"setpointTemp": "Heat carrier temperature",
|
||||||
|
"outdoorTemp": "Outdoor temperature"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -429,6 +457,7 @@
|
|||||||
"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"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -341,8 +341,12 @@
|
|||||||
"enable": "Porta seriale attivata",
|
"enable": "Porta seriale attivata",
|
||||||
"baud": "Porta seriale baud rate"
|
"baud": "Porta seriale baud rate"
|
||||||
},
|
},
|
||||||
"webSerial": {
|
"telnet": {
|
||||||
"enable": "WebSerial attivato"
|
"enable": "Telnet attivato",
|
||||||
|
"port": {
|
||||||
|
"title": "Porta Telnet",
|
||||||
|
"note": "Default: 23"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"ntp": {
|
"ntp": {
|
||||||
"server": "NTP server",
|
"server": "NTP server",
|
||||||
@@ -352,7 +356,16 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"heating": {
|
"heating": {
|
||||||
"hyst": "Isteresi <small>(in gradi)</small>",
|
"hyst": {
|
||||||
|
"title": "Isteresi",
|
||||||
|
"desc": "L'isteresi è utile per mantenere una temperatura interna impostata (quando si utilizza «Equitherm» e/o «PID»). Forza la disabilitazione del riscaldamento quando <code>current indoor > target + value</code> e abilita il riscaldamento quando <code>current indoor < (target - value)</code>.",
|
||||||
|
"value": "Valore <small>(in gradi)</small>",
|
||||||
|
"action": {
|
||||||
|
"title": "Azione",
|
||||||
|
"disableHeating": "Disabilita riscaldamento",
|
||||||
|
"set0target": "Imposta target nullo"
|
||||||
|
}
|
||||||
|
},
|
||||||
"turboFactor": "Turbo mode coeff."
|
"turboFactor": "Turbo mode coeff."
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -367,11 +380,26 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"equitherm": {
|
"equitherm": {
|
||||||
"n": "Fattore N",
|
"slope": {
|
||||||
"k": "Fattore K",
|
"title": "Pendenza",
|
||||||
"t": {
|
"note": "Compensazione della perdita di calore. Parametro di regolazione principale."
|
||||||
|
},
|
||||||
|
"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 usato se PID è attivato"
|
"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>."
|
||||||
|
},
|
||||||
|
"chart": {
|
||||||
|
"targetTemp": "Temperatura interna target",
|
||||||
|
"setpointTemp": "Temperatura del vettore termico",
|
||||||
|
"outdoorTemp": "Temperatura esterna"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -313,8 +313,12 @@
|
|||||||
"enable": "Seriële poort ingeschakeld",
|
"enable": "Seriële poort ingeschakeld",
|
||||||
"baud": "Baudrate seriële poort"
|
"baud": "Baudrate seriële poort"
|
||||||
},
|
},
|
||||||
"webSerial": {
|
"telnet": {
|
||||||
"enable": "WebSerial ingeschakeld"
|
"enable": "Telnet ingeschakeld",
|
||||||
|
"port": {
|
||||||
|
"title": "Telnet-poort",
|
||||||
|
"note": "Standaard: 23"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"ntp": {
|
"ntp": {
|
||||||
"server": "NTP-server",
|
"server": "NTP-server",
|
||||||
@@ -323,7 +327,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"heating": {
|
"heating": {
|
||||||
"hyst": "Hysterese <small>(in graden)</small>",
|
"hyst": {
|
||||||
|
"title": "Hysterese",
|
||||||
|
"desc": "Hysterese is nuttig voor het handhaven van een ingestelde binnentemperatuur (bij gebruik van «Equitherm» en/of «PID»). Forceert uitschakelen van verwarming wanneer <code>current indoor > target + value</code> en inschakelen van verwarming wanneer <code>current indoor < (target - value)</code>.",
|
||||||
|
"value": "Waarde <small>(in graden)</small>",
|
||||||
|
"action": {
|
||||||
|
"title": "Actie",
|
||||||
|
"disableHeating": "Verwarming uitschakelen",
|
||||||
|
"set0target": "Stel null target in"
|
||||||
|
}
|
||||||
|
},
|
||||||
"turboFactor": "Turbomodus coëff."
|
"turboFactor": "Turbomodus coëff."
|
||||||
},
|
},
|
||||||
"emergency": {
|
"emergency": {
|
||||||
@@ -335,11 +348,26 @@
|
|||||||
"treshold": "Drempeltijd <small>(sec)</small>"
|
"treshold": "Drempeltijd <small>(sec)</small>"
|
||||||
},
|
},
|
||||||
"equitherm": {
|
"equitherm": {
|
||||||
"n": "N-factor",
|
"slope": {
|
||||||
"k": "K-factor",
|
"title": "Helling",
|
||||||
"t": {
|
"note": "Compensatie voor warmteverlies. Hoofdafstelparameter."
|
||||||
"title": "T-factor",
|
},
|
||||||
"note": "Niet gebruikt als PID is ingeschakeld"
|
"exponent": {
|
||||||
|
"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": {
|
||||||
|
|||||||
@@ -341,8 +341,12 @@
|
|||||||
"enable": "Вкл. Serial порт",
|
"enable": "Вкл. Serial порт",
|
||||||
"baud": "Скорость Serial порта"
|
"baud": "Скорость Serial порта"
|
||||||
},
|
},
|
||||||
"webSerial": {
|
"telnet": {
|
||||||
"enable": "Вкл. WebSerial"
|
"enable": "Вкл. Telnet",
|
||||||
|
"port": {
|
||||||
|
"title": "Telnet порт",
|
||||||
|
"note": "По умолчанию: 23"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"ntp": {
|
"ntp": {
|
||||||
"server": "NTP сервер",
|
"server": "NTP сервер",
|
||||||
@@ -352,7 +356,16 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"heating": {
|
"heating": {
|
||||||
"hyst": "Гистерезис <small>(в градусах)</small>",
|
"hyst": {
|
||||||
|
"title": "Гистерезис",
|
||||||
|
"desc": "Гистерезис полезен для поддержания заданной внутр. темп. (при использовании «ПЗА» и/или «ПИД»). Принудительно откл. отопление, когда <code>current indoor > target + value</code>, и вкл. отопление, когда <code>current indoor < (target - value)</code>.",
|
||||||
|
"value": "Значение <small>(в градусах)</small>",
|
||||||
|
"action": {
|
||||||
|
"title": "Действие",
|
||||||
|
"disableHeating": "Отключить отопление",
|
||||||
|
"set0target": "Установить 0 в качестве целевой темп."
|
||||||
|
}
|
||||||
|
},
|
||||||
"turboFactor": "Коэфф. турбо режима"
|
"turboFactor": "Коэфф. турбо режима"
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -367,11 +380,26 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"equitherm": {
|
"equitherm": {
|
||||||
"n": "Коэффициент N",
|
"slope": {
|
||||||
"k": "Коэффициент K",
|
"title": "Наклон",
|
||||||
"t": {
|
"note": "Компенсация теплопотерь. Основной параметр настройки."
|
||||||
|
},
|
||||||
|
"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": "Не используется, если ПИД включен"
|
"note": "Не используется, если ПИД включен. Добавляет разницу между целевой и текущей температурой в помещении: <code>setpoint = setpoint + ((target - indoor) * T)</code>."
|
||||||
|
},
|
||||||
|
"chart": {
|
||||||
|
"targetTemp": "Целевая внутренняя температура",
|
||||||
|
"setpointTemp": "Температура теплоносителя",
|
||||||
|
"outdoorTemp": "Наружная температура"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -241,7 +241,9 @@
|
|||||||
setCheckboxValue("[name='filtering']", data.filtering, sensorForm);
|
setCheckboxValue("[name='filtering']", data.filtering, sensorForm);
|
||||||
setInputValue("[name='filteringFactor']", data.filteringFactor, {}, sensorForm);
|
setInputValue("[name='filteringFactor']", data.filteringFactor, {}, sensorForm);
|
||||||
|
|
||||||
sensorForm.querySelector("[name='type']").dispatchEvent(new Event("change"));
|
setTimeout(() => {
|
||||||
|
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>
|
||||||
@@ -126,8 +126,8 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="system[webSerial][enabled]" value="true">
|
<input type="checkbox" name="system[telnet][enabled]" value="true">
|
||||||
<span data-i18n>settings.system.webSerial.enable</span>
|
<span data-i18n>settings.system.telnet.enable</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
@@ -156,6 +156,12 @@
|
|||||||
<option value="115200">115200</option>
|
<option value="115200">115200</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
<span data-i18n>settings.system.telnet.port.title</span>
|
||||||
|
<input type="number" inputmode="numeric" name="system[telnet][port]" min="1" max="65535" step="1" required>
|
||||||
|
<small data-i18n>settings.system.telnet.port.note</small>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<mark data-i18n>settings.note.restart</mark>
|
<mark data-i18n>settings.note.restart</mark>
|
||||||
@@ -187,21 +193,48 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<label>
|
|
||||||
<span data-i18n>settings.heating.hyst</span>
|
|
||||||
<input type="number" inputmode="decimal" name="heating[hysteresis]" min="0" max="5" step="0.05" required>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<span data-i18n>settings.heating.turboFactor</span>
|
<span data-i18n>settings.heating.turboFactor</span>
|
||||||
<input type="number" inputmode="decimal" name="heating[turboFactor]" min="1.5" max="10" step="0.1" required>
|
<input type="number" inputmode="decimal" name="heating[turboFactor]" min="1.5" max="10" step="0.1" required>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
<span data-i18n>settings.maxModulation</span>
|
||||||
|
<input type="number" inputmode="numeric" name="heating[maxModulation]" min="1" max="100" step="1" required>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label>
|
<hr />
|
||||||
<span data-i18n>settings.maxModulation</span>
|
|
||||||
<input type="number" inputmode="numeric" name="heating[maxModulation]" min="1" max="100" step="1" required>
|
<details>
|
||||||
</label>
|
<summary><b data-i18n>settings.heating.hyst.title</b></summary>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<fieldset>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="heating[hysteresis][enabled]" value="true">
|
||||||
|
<span data-i18n>settings.enable</span>
|
||||||
|
</label>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<div class="grid">
|
||||||
|
<label>
|
||||||
|
<span data-i18n>settings.heating.hyst.value</span>
|
||||||
|
<input type="number" inputmode="decimal" name="heating[hysteresis][value]" min="0" max="5" step="0.05" required>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
<span data-i18n>settings.heating.hyst.action.title</span>
|
||||||
|
<select name="heating[hysteresis][action]">
|
||||||
|
<option value="0" data-i18n>settings.heating.hyst.action.disableHeating</option>
|
||||||
|
<option value="1" data-i18n>settings.heating.hyst.action.set0target</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<small data-i18n>settings.heating.hyst.desc</small>
|
||||||
|
</details>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
@@ -348,21 +381,44 @@
|
|||||||
</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.n</span>
|
<span data-i18n>settings.equitherm.slope.title</span>
|
||||||
<input type="number" inputmode="decimal" name="equitherm[n_factor]" min="0.001" max="10" step="0.001" required>
|
<input type="number" inputmode="decimal" name="equitherm[slope]" 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.k</span>
|
<span data-i18n>settings.equitherm.exponent.title</span>
|
||||||
<input type="number" inputmode="decimal" name="equitherm[k_factor]" min="0" max="10" step="0.01" required>
|
<input type="number" inputmode="decimal" name="equitherm[exponent]" min="0.1" max="2" step="0.001" 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.t.title</span>
|
<span data-i18n>settings.equitherm.targetDiffFactor.title</span>
|
||||||
<input type="number" inputmode="decimal" name="equitherm[t_factor]" min="0" max="10" step="0.01" required>
|
<input type="number" inputmode="decimal" name="equitherm[targetDiffFactor]" min="0" max="10" step="0.01" required>
|
||||||
<small data-i18n>settings.equitherm.t.note</small>
|
<small data-i18n>settings.equitherm.targetDiffFactor.note</small>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -631,6 +687,11 @@
|
|||||||
<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>
|
||||||
@@ -860,17 +921,170 @@
|
|||||||
</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);
|
||||||
setCheckboxValue("[name='system[serial][enabled]']", data.system.serial.enabled);
|
setCheckboxValue("[name='system[serial][enabled]']", data.system.serial.enabled);
|
||||||
setSelectValue("[name='system[serial][baudrate]']", data.system.serial.baudrate);
|
setSelectValue("[name='system[serial][baudrate]']", data.system.serial.baudrate);
|
||||||
setCheckboxValue("[name='system[webSerial][enabled]']", data.system.webSerial.enabled);
|
setCheckboxValue("[name='system[telnet][enabled]']", data.system.telnet.enabled);
|
||||||
|
setInputValue("[name='system[telnet][port]']", data.system.telnet.port);
|
||||||
setInputValue("[name='system[ntp][server]']", data.system.ntp.server);
|
setInputValue("[name='system[ntp][server]']", data.system.ntp.server);
|
||||||
setInputValue("[name='system[ntp][timezone]']", data.system.ntp.timezone);
|
setInputValue("[name='system[ntp][timezone]']", data.system.ntp.timezone);
|
||||||
setRadioValue("[name='system[unitSystem]']", data.system.unitSystem);
|
setRadioValue("[name='system[unitSystem]']", data.system.unitSystem);
|
||||||
@@ -908,6 +1122,7 @@
|
|||||||
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);
|
||||||
@@ -956,7 +1171,9 @@
|
|||||||
"min": data.system.unitSystem == 0 ? 1 : 33,
|
"min": data.system.unitSystem == 0 ? 1 : 33,
|
||||||
"max": data.system.unitSystem == 0 ? 100 : 212
|
"max": data.system.unitSystem == 0 ? 100 : 212
|
||||||
});
|
});
|
||||||
setInputValue("[name='heating[hysteresis]']", data.heating.hysteresis);
|
setCheckboxValue("[name='heating[hysteresis][enabled]']", data.heating.hysteresis.enabled);
|
||||||
|
setInputValue("[name='heating[hysteresis][value]']", data.heating.hysteresis.value);
|
||||||
|
setSelectValue("[name='heating[hysteresis][action]']", data.heating.hysteresis.action);
|
||||||
setInputValue("[name='heating[turboFactor]']", data.heating.turboFactor);
|
setInputValue("[name='heating[turboFactor]']", data.heating.turboFactor);
|
||||||
setInputValue("[name='heating[maxModulation]']", data.heating.maxModulation);
|
setInputValue("[name='heating[maxModulation]']", data.heating.maxModulation);
|
||||||
setInputValue("[name='heating[overheatProtection][highTemp]']", data.heating.overheatProtection.highTemp, {
|
setInputValue("[name='heating[overheatProtection][highTemp]']", data.heating.overheatProtection.highTemp, {
|
||||||
@@ -1012,9 +1229,10 @@
|
|||||||
|
|
||||||
// Equitherm
|
// Equitherm
|
||||||
setCheckboxValue("[name='equitherm[enabled]']", data.equitherm.enabled);
|
setCheckboxValue("[name='equitherm[enabled]']", data.equitherm.enabled);
|
||||||
setInputValue("[name='equitherm[n_factor]']", data.equitherm.n_factor);
|
setInputValue("[name='equitherm[slope]']", data.equitherm.slope);
|
||||||
setInputValue("[name='equitherm[k_factor]']", data.equitherm.k_factor);
|
setInputValue("[name='equitherm[exponent]']", data.equitherm.exponent);
|
||||||
setInputValue("[name='equitherm[t_factor]']", data.equitherm.t_factor);
|
setInputValue("[name='equitherm[shift]']", data.equitherm.shift);
|
||||||
|
setInputValue("[name='equitherm[targetDiffFactor]']", data.equitherm.targetDiffFactor);
|
||||||
setBusy('#equitherm-settings-busy', '#equitherm-settings', false);
|
setBusy('#equitherm-settings-busy', '#equitherm-settings', false);
|
||||||
|
|
||||||
// PID
|
// PID
|
||||||
@@ -1038,6 +1256,24 @@
|
|||||||
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 {
|
||||||
@@ -1090,6 +1326,57 @@
|
|||||||
} 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>
|
||||||
|
|||||||
@@ -62,19 +62,19 @@
|
|||||||
|
|
||||||
<form action="/api/upgrade" id="upgrade">
|
<form action="/api/upgrade" id="upgrade">
|
||||||
<fieldset class="primary">
|
<fieldset class="primary">
|
||||||
<label>
|
<label for="firmware-file">
|
||||||
<span data-i18n>upgrade.fw</span>:
|
<span data-i18n>upgrade.fw</span>:
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<input type="file" name="fw" accept=".bin">
|
<input type="file" name="firmware" id="firmware-file" accept=".bin">
|
||||||
<button type="button" class="fwResult hidden" disabled></button>
|
<button type="button" class="upgrade-firmware-result hidden" disabled></button>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label for="filesystem-file">
|
||||||
<span data-i18n>upgrade.fs</span>:
|
<span data-i18n>upgrade.fs</span>:
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<input type="file" name="fs" accept=".bin">
|
<input type="file" name="filesystem" id="filesystem-file" accept=".bin">
|
||||||
<button type="button" class="fsResult hidden" disabled></button>
|
<button type="button" class="upgrade-filesystem-result hidden" disabled></button>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@@ -108,123 +108,7 @@
|
|||||||
lang.build();
|
lang.build();
|
||||||
|
|
||||||
setupRestoreBackupForm('#restore');
|
setupRestoreBackupForm('#restore');
|
||||||
|
setupUpgradeForm('#upgrade');
|
||||||
const upgradeForm = document.querySelector('#upgrade');
|
|
||||||
if (upgradeForm) {
|
|
||||||
upgradeForm.reset();
|
|
||||||
const statusToText = (status) => {
|
|
||||||
switch (status) {
|
|
||||||
case 0:
|
|
||||||
return "None";
|
|
||||||
case 1:
|
|
||||||
return "No file";
|
|
||||||
case 2:
|
|
||||||
return "Success";
|
|
||||||
case 3:
|
|
||||||
return "Prohibited";
|
|
||||||
case 4:
|
|
||||||
return "Size mismatch";
|
|
||||||
case 5:
|
|
||||||
return "Error on start";
|
|
||||||
case 6:
|
|
||||||
return "Error on write";
|
|
||||||
case 7:
|
|
||||||
return "Error on finish";
|
|
||||||
default:
|
|
||||||
return "Unknown";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
upgradeForm.addEventListener('submit', async (event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
hide('.fwResult');
|
|
||||||
hide('.fsResult');
|
|
||||||
|
|
||||||
let button = upgradeForm.querySelector('button[type="submit"]');
|
|
||||||
button.textContent = i18n('button.uploading');
|
|
||||||
button.setAttribute('disabled', true);
|
|
||||||
button.setAttribute('aria-busy', true);
|
|
||||||
|
|
||||||
try {
|
|
||||||
let fd = new FormData();
|
|
||||||
|
|
||||||
const fw = upgradeForm.querySelector("[name='fw']").files;
|
|
||||||
if (fw.length > 0) {
|
|
||||||
fd.append("fw_size", fw[0].size);
|
|
||||||
fd.append("fw", fw[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
const fs = upgradeForm.querySelector("[name='fs']").files;
|
|
||||||
if (fs.length > 0) {
|
|
||||||
fd.append("fs_size", fs[0].size);
|
|
||||||
fd.append("fs", fs[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
let response = await fetch(upgradeForm.action, {
|
|
||||||
method: "POST",
|
|
||||||
cache: "no-cache",
|
|
||||||
credentials: "include",
|
|
||||||
body: fd
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.status != 202 && response.status != 406) {
|
|
||||||
throw new Error('Response not valid');
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await response.json();
|
|
||||||
let resItem = upgradeForm.querySelector('.fwResult');
|
|
||||||
if (resItem && result.firmware.status > 1) {
|
|
||||||
resItem.textContent = statusToText(result.firmware.status);
|
|
||||||
resItem.classList.remove('hidden');
|
|
||||||
|
|
||||||
if (result.firmware.status == 2) {
|
|
||||||
resItem.classList.remove('failed');
|
|
||||||
resItem.classList.add('success');
|
|
||||||
} else {
|
|
||||||
resItem.classList.remove('success');
|
|
||||||
resItem.classList.add('failed');
|
|
||||||
|
|
||||||
if (result.firmware.error != "") {
|
|
||||||
resItem.textContent += `: ${result.firmware.error}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resItem = upgradeForm.querySelector('.fsResult');
|
|
||||||
if (resItem && result.filesystem.status > 1) {
|
|
||||||
resItem.textContent = statusToText(result.filesystem.status);
|
|
||||||
resItem.classList.remove('hidden');
|
|
||||||
|
|
||||||
if (result.filesystem.status == 2) {
|
|
||||||
resItem.classList.remove('failed');
|
|
||||||
resItem.classList.add('success');
|
|
||||||
} else {
|
|
||||||
resItem.classList.remove('success');
|
|
||||||
resItem.classList.add('failed');
|
|
||||||
|
|
||||||
if (result.filesystem.error != "") {
|
|
||||||
resItem.textContent += `: ${result.filesystem.error}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
button.textContent = i18n('button.error');
|
|
||||||
button.classList.add('failed');
|
|
||||||
|
|
||||||
} finally {
|
|
||||||
setTimeout(() => {
|
|
||||||
button.removeAttribute('aria-busy');
|
|
||||||
button.removeAttribute('disabled');
|
|
||||||
button.classList.remove('success', 'failed');
|
|
||||||
button.textContent = i18n(button.dataset.i18n);
|
|
||||||
upgradeForm.reset();
|
|
||||||
}, 10000);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
14
src_data/scripts/chart.js
Normal file
14
src_data/scripts/chart.js
Normal file
File diff suppressed because one or more lines are too long
@@ -5,8 +5,13 @@ const setupForm = (formSelector, onResultCallback = null, noCastItems = []) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
form.querySelectorAll('input').forEach(item => {
|
form.querySelectorAll('input').forEach(item => {
|
||||||
item.addEventListener('change', (e) => {
|
item.addEventListener('change', (event) => {
|
||||||
e.target.setAttribute('aria-invalid', !e.target.checkValidity());
|
if (!event.target.checkValidity()) {
|
||||||
|
event.target.setAttribute('aria-invalid', true);
|
||||||
|
|
||||||
|
} else if (event.target.hasAttribute('aria-invalid')) {
|
||||||
|
event.target.removeAttribute('aria-invalid');
|
||||||
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -313,25 +318,19 @@ const setupRestoreBackupForm = (formSelector) => {
|
|||||||
console.log("Backup: ", data);
|
console.log("Backup: ", data);
|
||||||
|
|
||||||
if (data.settings != undefined) {
|
if (data.settings != undefined) {
|
||||||
for (var key in data.settings) {
|
let response = await fetch(url, {
|
||||||
let response = await fetch(url, {
|
method: "POST",
|
||||||
method: "POST",
|
cache: "no-cache",
|
||||||
cache: "no-cache",
|
credentials: "include",
|
||||||
credentials: "include",
|
headers: {
|
||||||
headers: {
|
"Content-Type": "application/json"
|
||||||
"Content-Type": "application/json"
|
},
|
||||||
},
|
body: JSON.stringify({"settings": data.settings})
|
||||||
body: JSON.stringify({
|
});
|
||||||
"settings": {
|
|
||||||
[key]: data.settings[key]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
onFailed();
|
onFailed();
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -636,6 +635,10 @@ 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) => {
|
||||||
@@ -649,7 +652,14 @@ const setRadioValue = (selector, value, parent = undefined) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let item of items) {
|
for (let item of items) {
|
||||||
item.checked = item.value == value;
|
const checked = item.value == value;
|
||||||
|
if (item.checked != checked) {
|
||||||
|
item.checked = checked;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
item.dispatchEvent(new Event("change"));
|
||||||
|
}, 10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -664,13 +674,17 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -860,3 +874,11 @@ 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