mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-13 19:54:28 +05:00
Compare commits
12 Commits
master
...
c39eeee9cf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c39eeee9cf | ||
|
|
f2fe6036c2 | ||
|
|
40dc863530 | ||
|
|
a40413aeac | ||
|
|
9a045bfc40 | ||
|
|
d576969ea4 | ||
|
|
c78d2d0c0b | ||
|
|
b7825111bb | ||
|
|
d5691ef8f7 | ||
|
|
0213582464 | ||
|
|
396dc7f7e3 | ||
|
|
9d38525251 |
22
.github/workflows/pio-dependabot.yaml
vendored
Normal file
22
.github/workflows/pio-dependabot.yaml
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
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,9 +27,6 @@ let paths = {
|
|||||||
'src_data/scripts/i18n.min.js',
|
'src_data/scripts/i18n.min.js',
|
||||||
'src_data/scripts/lang.js',
|
'src_data/scripts/lang.js',
|
||||||
'src_data/scripts/utils.js'
|
'src_data/scripts/utils.js'
|
||||||
],
|
|
||||||
'chart.js': [
|
|
||||||
'src_data/scripts/chart.js'
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -70,89 +70,50 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline auto sendBoilerReset() {
|
bool sendBoilerReset() {
|
||||||
return this->sendRequestCode(1);
|
unsigned int data = 1;
|
||||||
}
|
data <<= 8;
|
||||||
|
|
||||||
inline auto sendServiceReset() {
|
|
||||||
return this->sendRequestCode(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline auto sendWaterFilling() {
|
|
||||||
return this->sendRequestCode(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool sendRequestCode(const uint8_t requestCode) {
|
|
||||||
unsigned long response = this->sendRequest(buildRequest(
|
unsigned long response = this->sendRequest(buildRequest(
|
||||||
OpenThermMessageType::WRITE_DATA,
|
OpenThermMessageType::WRITE_DATA,
|
||||||
OpenThermMessageID::RemoteRequest,
|
OpenThermMessageID::RemoteRequest,
|
||||||
static_cast<unsigned int>(requestCode) << 8
|
data
|
||||||
));
|
));
|
||||||
|
|
||||||
if (!isValidResponse(response) || !isValidResponseId(response, OpenThermMessageID::RemoteRequest)) {
|
return isValidResponse(response) && isValidResponseId(response, OpenThermMessageID::RemoteRequest);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const uint8_t responseRequestCode = (response & 0xFFFF) >> 8;
|
|
||||||
const uint8_t responseCode = response & 0xFF;
|
|
||||||
if (responseRequestCode != requestCode || responseCode < 128) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// reset
|
|
||||||
this->sendRequest(buildRequest(
|
|
||||||
OpenThermMessageType::WRITE_DATA,
|
|
||||||
OpenThermMessageID::RemoteRequest,
|
|
||||||
0u << 8
|
|
||||||
));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getStr(OpenThermMessageID id, char* buffer, uint16_t length = 50) {
|
bool sendServiceReset() {
|
||||||
if (buffer == nullptr || length == 0) {
|
unsigned int data = 10;
|
||||||
return false;
|
data <<= 8;
|
||||||
}
|
unsigned long response = this->sendRequest(buildRequest(
|
||||||
|
OpenThermMessageType::WRITE_DATA,
|
||||||
|
OpenThermMessageID::RemoteRequest,
|
||||||
|
data
|
||||||
|
));
|
||||||
|
|
||||||
unsigned long response;
|
return isValidResponse(response) && isValidResponseId(response, OpenThermMessageID::RemoteRequest);
|
||||||
uint8_t index = 0;
|
}
|
||||||
uint8_t maxIndex = 255;
|
|
||||||
|
|
||||||
while (index <= maxIndex && index < length) {
|
bool sendWaterFilling() {
|
||||||
response = this->sendRequest(buildRequest(
|
unsigned int data = 2;
|
||||||
OpenThermMessageType::READ_DATA,
|
data <<= 8;
|
||||||
id,
|
unsigned long response = this->sendRequest(buildRequest(
|
||||||
static_cast<unsigned int>(index) << 8
|
OpenThermMessageType::WRITE_DATA,
|
||||||
));
|
OpenThermMessageID::RemoteRequest,
|
||||||
|
data
|
||||||
|
));
|
||||||
|
|
||||||
if (!isValidResponse(response) || !isValidResponseId(response, id)) {
|
return isValidResponse(response) && isValidResponseId(response, OpenThermMessageID::RemoteRequest);
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const uint8_t character = response & 0xFF;
|
|
||||||
if (character == 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (index == 0) {
|
|
||||||
maxIndex = (response & 0xFFFF) >> 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
buffer[index++] = static_cast<char>(character);
|
|
||||||
}
|
|
||||||
|
|
||||||
buffer[index] = '\0';
|
|
||||||
return index > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isCh2Active(unsigned long response) {
|
static bool isCh2Active(unsigned long response) {
|
||||||
return response & 0x20;
|
return response & 0x20;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isValidResponseId(unsigned long response, OpenThermMessageID id) {
|
static bool isValidResponseId(unsigned long response, OpenThermMessageID id) {
|
||||||
const uint8_t responseId = (response >> 16) & 0xFF;
|
uint8_t responseId = (response >> 16) & 0xFF;
|
||||||
|
|
||||||
return static_cast<uint8_t>(id) == responseId;
|
return (uint8_t)id == responseId;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t getResponseMessageTypeId(unsigned long response) {
|
static uint8_t getResponseMessageTypeId(unsigned long response) {
|
||||||
@@ -163,10 +124,10 @@ public:
|
|||||||
uint8_t msgType = getResponseMessageTypeId(response);
|
uint8_t msgType = getResponseMessageTypeId(response);
|
||||||
|
|
||||||
switch (msgType) {
|
switch (msgType) {
|
||||||
case static_cast<uint8_t>(OpenThermMessageType::READ_ACK):
|
case (uint8_t) OpenThermMessageType::READ_ACK:
|
||||||
case static_cast<uint8_t>(OpenThermMessageType::WRITE_ACK):
|
case (uint8_t) OpenThermMessageType::WRITE_ACK:
|
||||||
case static_cast<uint8_t>(OpenThermMessageType::DATA_INVALID):
|
case (uint8_t) OpenThermMessageType::DATA_INVALID:
|
||||||
case static_cast<uint8_t>(OpenThermMessageType::UNKNOWN_DATA_ID):
|
case (uint8_t) OpenThermMessageType::UNKNOWN_DATA_ID:
|
||||||
return CustomOpenTherm::messageTypeToString(
|
return CustomOpenTherm::messageTypeToString(
|
||||||
static_cast<OpenThermMessageType>(msgType)
|
static_cast<OpenThermMessageType>(msgType)
|
||||||
);
|
);
|
||||||
|
|||||||
63
lib/Equitherm/Equitherm.h
Normal file
63
lib/Equitherm/Equitherm.h
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
#if defined(EQUITHERM_INTEGER)
|
||||||
|
// расчёты с целыми числами
|
||||||
|
typedef int datatype;
|
||||||
|
#else
|
||||||
|
// расчёты с float числами
|
||||||
|
typedef float datatype;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class Equitherm {
|
||||||
|
public:
|
||||||
|
datatype targetTemp = 0;
|
||||||
|
datatype indoorTemp = 0;
|
||||||
|
datatype outdoorTemp = 0;
|
||||||
|
float Kn = 0.0;
|
||||||
|
float Kk = 0.0;
|
||||||
|
float Kt = 0.0;
|
||||||
|
|
||||||
|
Equitherm() = default;
|
||||||
|
|
||||||
|
// kn, kk, kt
|
||||||
|
Equitherm(float new_kn, float new_kk, float new_kt) {
|
||||||
|
Kn = new_kn;
|
||||||
|
Kk = new_kk;
|
||||||
|
Kt = new_kt;
|
||||||
|
}
|
||||||
|
|
||||||
|
// лимит выходной величины
|
||||||
|
void setLimits(unsigned short min_output, unsigned short max_output) {
|
||||||
|
_minOut = min_output;
|
||||||
|
_maxOut = max_output;
|
||||||
|
}
|
||||||
|
|
||||||
|
// возвращает новое значение при вызове
|
||||||
|
datatype getResult() {
|
||||||
|
datatype output = getResultN() + getResultK() + getResultT();
|
||||||
|
output = constrain(output, _minOut, _maxOut); // ограничиваем выход
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned short _minOut = 20, _maxOut = 90;
|
||||||
|
|
||||||
|
// температура контура отопления в зависимости от наружной температуры
|
||||||
|
datatype getResultN() {
|
||||||
|
float a = (-0.21 * Kn) - 0.06; // a = -0,21k — 0,06
|
||||||
|
float b = (6.04 * Kn) + 1.98; // b = 6,04k + 1,98
|
||||||
|
float c = (-5.06 * Kn) + 18.06; // с = -5,06k + 18,06
|
||||||
|
float x = (-0.2 * outdoorTemp) + 5; // x = -0.2*t1 + 5
|
||||||
|
return (a * x * x) + (b * x) + c; // Tn = ax2 + bx + c
|
||||||
|
}
|
||||||
|
|
||||||
|
// поправка на желаемую комнатную температуру
|
||||||
|
datatype getResultK() {
|
||||||
|
return (targetTemp - 20) * Kk;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Расчет поправки (ошибки) термостата
|
||||||
|
datatype getResultT() {
|
||||||
|
return constrain((targetTemp - indoorTemp), -3, 3) * Kt;
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
class UpgradeHandler : public RequestHandler {
|
class UpgradeHandler : public AsyncWebHandler {
|
||||||
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,
|
||||||
ABORTED,
|
SIZE_MISMATCH,
|
||||||
ERROR_ON_START,
|
ERROR_ON_START,
|
||||||
ERROR_ON_WRITE,
|
ERROR_ON_WRITE,
|
||||||
ERROR_ON_FINISH
|
ERROR_ON_FINISH
|
||||||
@@ -22,27 +22,21 @@ 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(HTTPMethod, const String&)> CanHandleCallback;
|
typedef std::function<bool(AsyncWebServerRequest *request, UpgradeType)> BeforeUpgradeCallback;
|
||||||
typedef std::function<bool(const String&)> CanUploadCallback;
|
typedef std::function<void(AsyncWebServerRequest *request, const UpgradeResult&, const UpgradeResult&)> AfterUpgradeCallback;
|
||||||
typedef std::function<bool(UpgradeType)> BeforeUpgradeCallback;
|
|
||||||
typedef std::function<void(const UpgradeResult&, const UpgradeResult&)> AfterUpgradeCallback;
|
|
||||||
|
|
||||||
UpgradeHandler(const char* uri) {
|
UpgradeHandler(AsyncURIMatcher uri) : uri(uri) {}
|
||||||
this->uri = uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
UpgradeHandler* setCanHandleCallback(CanHandleCallback callback = nullptr) {
|
bool canHandle(AsyncWebServerRequest *request) const override final {
|
||||||
this->canHandleCallback = callback;
|
if (!request->isHTTP()) {
|
||||||
|
return false;
|
||||||
return this;
|
}
|
||||||
}
|
|
||||||
|
return this->uri.matches(request);
|
||||||
UpgradeHandler* setCanUploadCallback(CanUploadCallback callback = nullptr) {
|
|
||||||
this->canUploadCallback = callback;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UpgradeHandler* setBeforeUpgradeCallback(BeforeUpgradeCallback callback = nullptr) {
|
UpgradeHandler* setBeforeUpgradeCallback(BeforeUpgradeCallback callback = nullptr) {
|
||||||
@@ -57,29 +51,9 @@ public:
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP32)
|
void handleRequest(AsyncWebServerRequest *request) override final {
|
||||||
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(this->firmwareResult, this->filesystemResult);
|
this->afterUpgradeCallback(request, this->firmwareResult, this->filesystemResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->firmwareResult.status = UpgradeStatus::NONE;
|
this->firmwareResult.status = UpgradeStatus::NONE;
|
||||||
@@ -87,129 +61,147 @@ public:
|
|||||||
|
|
||||||
this->filesystemResult.status = UpgradeStatus::NONE;
|
this->filesystemResult.status = UpgradeStatus::NONE;
|
||||||
this->filesystemResult.error.clear();
|
this->filesystemResult.error.clear();
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void upload(WebServer& server, const String& uri, HTTPUpload& upload) override {
|
void handleUpload(AsyncWebServerRequest *request, const String &fileName, size_t index, uint8_t *data, size_t dataLength, bool isFinal) override final {
|
||||||
UpgradeResult* result;
|
UpgradeResult* result = nullptr;
|
||||||
if (upload.name.equals(F("firmware"))) {
|
|
||||||
result = &this->firmwareResult;
|
|
||||||
|
|
||||||
} else if (upload.name.equals(F("filesystem"))) {
|
if (!request->hasParam(asyncsrv::T_name, true, true)) {
|
||||||
result = &this->filesystemResult;
|
// Missing content-disposition 'name' parameter
|
||||||
|
|
||||||
} else {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto& pName = request->getParam(asyncsrv::T_name, true, true)->value();
|
||||||
|
if (pName.equals("fw")) {
|
||||||
|
result = &this->firmwareResult;
|
||||||
|
|
||||||
|
if (!index) {
|
||||||
|
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;
|
||||||
|
|
||||||
|
if (!index) {
|
||||||
|
result->progress = 0;
|
||||||
|
result->size = request->hasParam("fs_size", true)
|
||||||
|
? request->getParam("fs_size", true)->value().toInt()
|
||||||
|
: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Unknown parameter name
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check result status
|
||||||
if (result->status != UpgradeStatus::NONE) {
|
if (result->status != UpgradeStatus::NONE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->beforeUpgradeCallback && !this->beforeUpgradeCallback(result->type)) {
|
if (this->beforeUpgradeCallback && !this->beforeUpgradeCallback(request, result->type)) {
|
||||||
result->status = UpgradeStatus::PROHIBITED;
|
result->status = UpgradeStatus::PROHIBITED;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!upload.filename.length()) {
|
if (!fileName.length()) {
|
||||||
result->status = UpgradeStatus::NO_FILE;
|
result->status = UpgradeStatus::NO_FILE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (upload.status == UPLOAD_FILE_START) {
|
if (!index) {
|
||||||
// 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), F("File '%s', on start: %s"), upload.filename.c_str(), result->error.c_str());
|
Log.serrorln(FPSTR(L_PORTAL_OTA), "File '%s', on start: %s", fileName.c_str(), result->error.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_PORTAL_OTA), F("File '%s', started"), upload.filename.c_str());
|
Log.sinfoln(FPSTR(L_PORTAL_OTA), "File '%s', started", fileName.c_str());
|
||||||
|
}
|
||||||
} else if (upload.status == UPLOAD_FILE_WRITE) {
|
|
||||||
if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) {
|
if (dataLength) {
|
||||||
|
if (Update.write(data, dataLength) != dataLength) {
|
||||||
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),
|
FPSTR(L_PORTAL_OTA), "File '%s', on write %d bytes, %d of %d bytes",
|
||||||
F("File '%s', on writing %d bytes: %s"),
|
fileName.c_str(),
|
||||||
upload.filename.c_str(), upload.totalSize, result->error.c_str()
|
dataLength,
|
||||||
|
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;
|
||||||
|
Log.sinfoln(
|
||||||
|
FPSTR(L_PORTAL_OTA), "File '%s', write %d bytes, %d of %d bytes",
|
||||||
|
fileName.c_str(),
|
||||||
|
dataLength,
|
||||||
|
result->progress,
|
||||||
|
result->size
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (upload.status == UPLOAD_FILE_END) {
|
if (result->size > 0) {
|
||||||
if (Update.end(true)) {
|
if (result->progress > result->size || (isFinal && result->progress < result->size)) {
|
||||||
result->status = UpgradeStatus::SUCCESS;
|
Update.end(false);
|
||||||
|
result->status = UpgradeStatus::SIZE_MISMATCH;
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_PORTAL_OTA), F("File '%s': finish"), upload.filename.c_str());
|
Log.serrorln(
|
||||||
|
FPSTR(L_PORTAL_OTA), "File '%s', size mismatch: %d of %d bytes",
|
||||||
} else {
|
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), F("File '%s', on finish: %s"), upload.filename.c_str(), result->error);
|
Log.serrorln(FPSTR(L_PORTAL_OTA), "File '%s', on finish: %s", fileName.c_str(), result->error);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (upload.status == UPLOAD_FILE_ABORTED) {
|
result->status = UpgradeStatus::SUCCESS;
|
||||||
Update.end(false);
|
Log.sinfoln(FPSTR(L_PORTAL_OTA), "File '%s': finish", fileName.c_str());
|
||||||
result->status = UpgradeStatus::ABORTED;
|
|
||||||
|
|
||||||
Log.serrorln(FPSTR(L_PORTAL_OTA), F("File '%s': aborted"), upload.filename.c_str());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isRequestHandlerTrivial() const override final {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CanHandleCallback canHandleCallback;
|
|
||||||
CanUploadCallback canUploadCallback;
|
|
||||||
BeforeUpgradeCallback beforeUpgradeCallback;
|
BeforeUpgradeCallback beforeUpgradeCallback;
|
||||||
AfterUpgradeCallback afterUpgradeCallback;
|
AfterUpgradeCallback afterUpgradeCallback;
|
||||||
const char* uri = nullptr;
|
AsyncURIMatcher uri;
|
||||||
|
|
||||||
UpgradeResult firmwareResult{UpgradeType::FIRMWARE, UpgradeStatus::NONE};
|
UpgradeResult firmwareResult{UpgradeType::FIRMWARE, UpgradeStatus::NONE};
|
||||||
UpgradeResult filesystemResult{UpgradeType::FILESYSTEM, UpgradeStatus::NONE};
|
UpgradeResult filesystemResult{UpgradeType::FILESYSTEM, UpgradeStatus::NONE};
|
||||||
|
|||||||
594
platformio.ini
594
platformio.ini
@@ -1,379 +1,275 @@
|
|||||||
; PlatformIO Project Configuration File
|
|
||||||
;
|
|
||||||
; Build options: build flags, source filter
|
|
||||||
; Upload options: custom upload port, speed and extra flags
|
|
||||||
; Library options: dependencies, extra library storages
|
|
||||||
; Advanced options: extra scripting
|
|
||||||
;
|
|
||||||
; Please visit documentation for the other options and examples
|
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
|
||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
;extra_configs = secrets.ini
|
;extra_configs = secrets.ini
|
||||||
extra_configs = secrets.default.ini
|
extra_configs = secrets.default.ini
|
||||||
core_dir = .pio
|
core_dir = .pio
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
version = 1.5.6
|
version = 1.5.7-passiveble
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps = ESP32Async/AsyncTCP
|
||||||
bblanchon/ArduinoJson@^7.4.2
|
;ESP32Async/ESPAsyncWebServer
|
||||||
;ihormelnyk/OpenTherm Library@^1.1.5
|
https://github.com/ESP32Async/ESPAsyncWebServer
|
||||||
https://github.com/Laxilef/opentherm_library#esp32_timer
|
bblanchon/ArduinoJson@^7.4.2
|
||||||
arduino-libraries/ArduinoMqttClient@^0.1.8
|
;ihormelnyk/OpenTherm Library@^1.1.5
|
||||||
lennarthennigs/ESP Telnet@^2.2.3
|
https://github.com/Laxilef/opentherm_library#esp32_timer
|
||||||
gyverlibs/FileData@^1.0.3
|
arduino-libraries/ArduinoMqttClient@^0.1.8
|
||||||
gyverlibs/GyverPID@^3.3.2
|
lennarthennigs/ESP Telnet@^2.2.3
|
||||||
gyverlibs/GyverBlinker@^1.1.1
|
gyverlibs/FileData@^1.0.3
|
||||||
https://github.com/pstolarz/Arduino-Temperature-Control-Library.git#OneWireNg
|
gyverlibs/GyverPID@^3.3.2
|
||||||
laxilef/TinyLogger@^1.1.1
|
gyverlibs/GyverBlinker@^1.1.1
|
||||||
build_type = ${secrets.build_type}
|
https://github.com/pstolarz/Arduino-Temperature-Control-Library.git#OneWireNg
|
||||||
build_flags =
|
laxilef/TinyLogger@^1.1.1
|
||||||
-mtext-section-literals
|
build_type = ${secrets.build_type}
|
||||||
-D MQTT_CLIENT_STD_FUNCTION_CALLBACK=1
|
build_flags = -mtext-section-literals
|
||||||
;-D DEBUG_ESP_CORE -D DEBUG_ESP_WIFI -D DEBUG_ESP_HTTP_SERVER -D DEBUG_ESP_PORT=Serial
|
-Wno-deprecated-declarations
|
||||||
-D BUILD_VERSION='"${this.version}"'
|
-D MQTT_CLIENT_STD_FUNCTION_CALLBACK=1
|
||||||
-D BUILD_ENV='"$PIOENV"'
|
;-D DEBUG_ESP_CORE -D DEBUG_ESP_WIFI -D DEBUG_ESP_HTTP_SERVER -D DEBUG_ESP_PORT=Serial
|
||||||
-D DEFAULT_SERIAL_ENABLED=${secrets.serial_enabled}
|
-D BUILD_VERSION='"${this.version}"'
|
||||||
-D DEFAULT_SERIAL_BAUD=${secrets.serial_baud}
|
-D BUILD_ENV='"$PIOENV"'
|
||||||
-D DEFAULT_TELNET_ENABLED=${secrets.telnet_enabled}
|
-D CONFIG_ASYNC_TCP_STACK_SIZE=4096
|
||||||
-D DEFAULT_TELNET_PORT=${secrets.telnet_port}
|
-D ARDUINOJSON_USE_DOUBLE=0
|
||||||
-D DEFAULT_LOG_LEVEL=${secrets.log_level}
|
-D ARDUINOJSON_USE_LONG_LONG=0
|
||||||
-D DEFAULT_HOSTNAME='"${secrets.hostname}"'
|
-D DEFAULT_SERIAL_ENABLED=${secrets.serial_enabled}
|
||||||
-D DEFAULT_AP_SSID='"${secrets.ap_ssid}"'
|
-D DEFAULT_SERIAL_BAUD=${secrets.serial_baud}
|
||||||
-D DEFAULT_AP_PASSWORD='"${secrets.ap_password}"'
|
-D DEFAULT_TELNET_ENABLED=${secrets.telnet_enabled}
|
||||||
-D DEFAULT_STA_SSID='"${secrets.sta_ssid}"'
|
-D DEFAULT_TELNET_PORT=${secrets.telnet_port}
|
||||||
-D DEFAULT_STA_PASSWORD='"${secrets.sta_password}"'
|
-D DEFAULT_LOG_LEVEL=${secrets.log_level}
|
||||||
-D DEFAULT_PORTAL_LOGIN='"${secrets.portal_login}"'
|
-D DEFAULT_HOSTNAME='"${secrets.hostname}"'
|
||||||
-D DEFAULT_PORTAL_PASSWORD='"${secrets.portal_password}"'
|
-D DEFAULT_AP_SSID='"${secrets.ap_ssid}"'
|
||||||
-D DEFAULT_MQTT_ENABLED=${secrets.mqtt_enabled}
|
-D DEFAULT_AP_PASSWORD='"${secrets.ap_password}"'
|
||||||
-D DEFAULT_MQTT_SERVER='"${secrets.mqtt_server}"'
|
-D DEFAULT_STA_SSID='"${secrets.sta_ssid}"'
|
||||||
-D DEFAULT_MQTT_PORT=${secrets.mqtt_port}
|
-D DEFAULT_STA_PASSWORD='"${secrets.sta_password}"'
|
||||||
-D DEFAULT_MQTT_USER='"${secrets.mqtt_user}"'
|
-D DEFAULT_PORTAL_LOGIN='"${secrets.portal_login}"'
|
||||||
-D DEFAULT_MQTT_PASSWORD='"${secrets.mqtt_password}"'
|
-D DEFAULT_PORTAL_PASSWORD='"${secrets.portal_password}"'
|
||||||
-D DEFAULT_MQTT_PREFIX='"${secrets.mqtt_prefix}"'
|
-D DEFAULT_MQTT_ENABLED=${secrets.mqtt_enabled}
|
||||||
upload_speed = 921600
|
-D DEFAULT_MQTT_SERVER='"${secrets.mqtt_server}"'
|
||||||
monitor_speed = 115200
|
-D DEFAULT_MQTT_PORT=${secrets.mqtt_port}
|
||||||
;monitor_filters = direct
|
-D DEFAULT_MQTT_USER='"${secrets.mqtt_user}"'
|
||||||
monitor_filters =
|
-D DEFAULT_MQTT_PASSWORD='"${secrets.mqtt_password}"'
|
||||||
esp32_exception_decoder
|
-D DEFAULT_MQTT_PREFIX='"${secrets.mqtt_prefix}"'
|
||||||
esp8266_exception_decoder
|
upload_speed = 921600
|
||||||
board_build.flash_mode = dio
|
monitor_speed = 115200
|
||||||
board_build.filesystem = littlefs
|
;monitor_filters = direct
|
||||||
check_tool = ; pvs-studio
|
monitor_filters = esp32_exception_decoder
|
||||||
check_flags =
|
esp8266_exception_decoder
|
||||||
; pvs-studio:
|
board_build.flash_mode = dio
|
||||||
; --analysis-mode=4
|
board_build.filesystem = littlefs
|
||||||
; --exclude-path=./.pio/libdeps
|
check_tool = ;pvs-studio
|
||||||
|
check_flags = ;pvs-studio: --analysis-mode=4 --exclude-path=./.pio/libdeps
|
||||||
|
|
||||||
; Defaults
|
; Defaults
|
||||||
[esp8266_defaults]
|
[esp8266_defaults]
|
||||||
platform = espressif8266@^4.2.1
|
platform = espressif8266@^4.2.1
|
||||||
platform_packages = ${env.platform_packages}
|
platform_packages = ${env.platform_packages}
|
||||||
lib_deps =
|
lib_deps = ${env.lib_deps}
|
||||||
${env.lib_deps}
|
nrwiersma/ESP8266Scheduler@^1.2
|
||||||
nrwiersma/ESP8266Scheduler@^1.2
|
lib_ignore =
|
||||||
lib_ignore =
|
extra_scripts = post:tools/build.py
|
||||||
extra_scripts =
|
build_type = ${env.build_type}
|
||||||
post:tools/build.py
|
build_flags = ${env.build_flags}
|
||||||
build_type = ${env.build_type}
|
-D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
|
||||||
build_flags =
|
;-D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH
|
||||||
${env.build_flags}
|
-D PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK305
|
||||||
-D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
|
board_build.ldscript = eagle.flash.4m1m.ld
|
||||||
;-D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH
|
check_tool = ${env.check_tool}
|
||||||
-D PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK305
|
check_flags = ${env.check_flags}
|
||||||
board_build.ldscript = eagle.flash.4m1m.ld
|
|
||||||
check_tool = ${env.check_tool}
|
|
||||||
check_flags = ${env.check_flags}
|
|
||||||
|
|
||||||
[esp32_defaults]
|
[esp32_defaults]
|
||||||
;platform = espressif32@^6.7
|
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.34/platform-espressif32.zip
|
||||||
;platform = https://github.com/platformio/platform-espressif32.git
|
platform_packages = ${env.platform_packages}
|
||||||
;platform_packages =
|
board_build.partitions = esp32_partitions.csv
|
||||||
; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.5
|
lib_deps = ${env.lib_deps}
|
||||||
; 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
|
laxilef/ESP32Scheduler@^1.0.1
|
||||||
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.34/platform-espressif32.zip
|
nimble_lib = https://github.com/h2zero/NimBLE-Arduino
|
||||||
platform_packages = ${env.platform_packages}
|
lib_ignore = BluetoothSerial
|
||||||
board_build.partitions = esp32_partitions.csv
|
SimpleBLE
|
||||||
lib_deps =
|
ESP RainMaker
|
||||||
${env.lib_deps}
|
RainMaker
|
||||||
laxilef/ESP32Scheduler@^1.0.1
|
ESP Insights
|
||||||
nimble_lib = h2zero/NimBLE-Arduino@2.3.7
|
Insights
|
||||||
lib_ignore =
|
Zigbee
|
||||||
extra_scripts =
|
Matter
|
||||||
post:tools/esp32.py
|
OpenThread
|
||||||
post:tools/build.py
|
dsp
|
||||||
build_type = ${env.build_type}
|
custom_component_remove = espressif/esp_hosted
|
||||||
build_flags =
|
espressif/esp_wifi_remote
|
||||||
${env.build_flags}
|
espressif/esp-dsp
|
||||||
-D CORE_DEBUG_LEVEL=0
|
espressif/esp_modem
|
||||||
-Wl,--wrap=esp_panic_handler
|
espressif/esp_rainmaker
|
||||||
check_tool = ${env.check_tool}
|
espressif/rmaker_common
|
||||||
check_flags = ${env.check_flags}
|
espressif/esp_insights
|
||||||
|
espressif/esp_diag_data_store
|
||||||
|
espressif/esp_diagnostics
|
||||||
|
espressif/libsodium
|
||||||
|
espressif/esp-modbus
|
||||||
|
espressif/esp-cbor
|
||||||
|
espressif/esp-sr
|
||||||
|
espressif/esp32-camera
|
||||||
|
espressif/qrcode
|
||||||
|
espressif/esp-zboss-lib
|
||||||
|
espressif/esp-zigbee-lib
|
||||||
|
chmorgan/esp-libhelix-mp3
|
||||||
|
extra_scripts = post:tools/esp32.py
|
||||||
|
post:tools/build.py
|
||||||
|
build_type = ${env.build_type}
|
||||||
|
build_flags = ${env.build_flags}
|
||||||
|
-D CORE_DEBUG_LEVEL=0
|
||||||
|
-Wl,--wrap=esp_panic_handler
|
||||||
|
check_tool = ${env.check_tool}
|
||||||
|
check_flags = ${env.check_flags}
|
||||||
|
|
||||||
|
|
||||||
; Boards
|
; Boards
|
||||||
[env:d1_mini]
|
[env:d1_mini]
|
||||||
platform = ${esp8266_defaults.platform}
|
extends = esp8266_defaults
|
||||||
platform_packages = ${esp8266_defaults.platform_packages}
|
board = d1_mini
|
||||||
board = d1_mini
|
build_flags = ${esp8266_defaults.build_flags}
|
||||||
lib_deps = ${esp8266_defaults.lib_deps}
|
-D DEFAULT_OT_IN_GPIO=4
|
||||||
lib_ignore = ${esp8266_defaults.lib_ignore}
|
-D DEFAULT_OT_OUT_GPIO=5
|
||||||
extra_scripts = ${esp8266_defaults.extra_scripts}
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
||||||
board_build.ldscript = ${esp8266_defaults.board_build.ldscript}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=14
|
||||||
build_type = ${esp8266_defaults.build_type}
|
-D DEFAULT_STATUS_LED_GPIO=13
|
||||||
build_flags =
|
-D DEFAULT_OT_RX_LED_GPIO=15
|
||||||
${esp8266_defaults.build_flags}
|
|
||||||
-D DEFAULT_OT_IN_GPIO=4
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=5
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=14
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=13
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=15
|
|
||||||
check_tool = ${esp8266_defaults.check_tool}
|
|
||||||
check_flags = ${esp8266_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:d1_mini_lite]
|
[env:d1_mini_lite]
|
||||||
platform = ${esp8266_defaults.platform}
|
extends = esp8266_defaults
|
||||||
platform_packages = ${esp8266_defaults.platform_packages}
|
board = d1_mini_lite
|
||||||
board = d1_mini_lite
|
build_flags = ${esp8266_defaults.build_flags}
|
||||||
lib_deps = ${esp8266_defaults.lib_deps}
|
-D DEFAULT_OT_IN_GPIO=4
|
||||||
lib_ignore = ${esp8266_defaults.lib_ignore}
|
-D DEFAULT_OT_OUT_GPIO=5
|
||||||
extra_scripts = ${esp8266_defaults.extra_scripts}
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
||||||
board_build.ldscript = ${esp8266_defaults.board_build.ldscript}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=14
|
||||||
build_type = ${esp8266_defaults.build_type}
|
-D DEFAULT_STATUS_LED_GPIO=13
|
||||||
build_flags =
|
-D DEFAULT_OT_RX_LED_GPIO=15
|
||||||
${esp8266_defaults.build_flags}
|
|
||||||
-D DEFAULT_OT_IN_GPIO=4
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=5
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=14
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=13
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=15
|
|
||||||
check_tool = ${esp8266_defaults.check_tool}
|
|
||||||
check_flags = ${esp8266_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:d1_mini_pro]
|
[env:d1_mini_pro]
|
||||||
platform = ${esp8266_defaults.platform}
|
extends = esp8266_defaults
|
||||||
platform_packages = ${esp8266_defaults.platform_packages}
|
board = d1_mini_pro
|
||||||
board = d1_mini_pro
|
build_flags = ${esp8266_defaults.build_flags}
|
||||||
lib_deps = ${esp8266_defaults.lib_deps}
|
-D DEFAULT_OT_IN_GPIO=4
|
||||||
lib_ignore = ${esp8266_defaults.lib_ignore}
|
-D DEFAULT_OT_OUT_GPIO=5
|
||||||
extra_scripts = ${esp8266_defaults.extra_scripts}
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
||||||
board_build.ldscript = ${esp8266_defaults.board_build.ldscript}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=14
|
||||||
build_type = ${esp8266_defaults.build_type}
|
-D DEFAULT_STATUS_LED_GPIO=13
|
||||||
build_flags =
|
-D DEFAULT_OT_RX_LED_GPIO=15
|
||||||
${esp8266_defaults.build_flags}
|
|
||||||
-D DEFAULT_OT_IN_GPIO=4
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=5
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=14
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=13
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=15
|
|
||||||
check_tool = ${esp8266_defaults.check_tool}
|
|
||||||
check_flags = ${esp8266_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:nodemcu_8266]
|
[env:nodemcu_8266]
|
||||||
platform = ${esp8266_defaults.platform}
|
extends = esp8266_defaults
|
||||||
platform_packages = ${esp8266_defaults.platform_packages}
|
board = nodemcuv2
|
||||||
board = nodemcuv2
|
build_flags = ${esp8266_defaults.build_flags}
|
||||||
lib_deps = ${esp8266_defaults.lib_deps}
|
-D DEFAULT_OT_IN_GPIO=13
|
||||||
lib_ignore = ${esp8266_defaults.lib_ignore}
|
-D DEFAULT_OT_OUT_GPIO=15
|
||||||
extra_scripts = ${esp8266_defaults.extra_scripts}
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
||||||
board_build.ldscript = ${esp8266_defaults.board_build.ldscript}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=4
|
||||||
build_type = ${esp8266_defaults.build_type}
|
-D DEFAULT_STATUS_LED_GPIO=2
|
||||||
build_flags =
|
-D DEFAULT_OT_RX_LED_GPIO=16
|
||||||
${esp8266_defaults.build_flags}
|
|
||||||
-D DEFAULT_OT_IN_GPIO=13
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=15
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=4
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=2
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=16
|
|
||||||
check_tool = ${esp8266_defaults.check_tool}
|
|
||||||
check_flags = ${esp8266_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:s2_mini]
|
[env:s2_mini]
|
||||||
platform = ${esp32_defaults.platform}
|
extends = esp32_defaults
|
||||||
platform_packages = ${esp32_defaults.platform_packages}
|
board = lolin_s2_mini
|
||||||
board = lolin_s2_mini
|
build_unflags = -DARDUINO_USB_MODE=1
|
||||||
board_build.partitions = ${esp32_defaults.board_build.partitions}
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
lib_deps = ${esp32_defaults.lib_deps}
|
-D ARDUINO_USB_MODE=0
|
||||||
lib_ignore = ${esp32_defaults.lib_ignore}
|
-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||||
extra_scripts = ${esp32_defaults.extra_scripts}
|
-D DEFAULT_OT_IN_GPIO=33
|
||||||
build_unflags =
|
-D DEFAULT_OT_OUT_GPIO=35
|
||||||
-DARDUINO_USB_MODE=1
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=9
|
||||||
build_type = ${esp32_defaults.build_type}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=7
|
||||||
build_flags =
|
-D DEFAULT_STATUS_LED_GPIO=11
|
||||||
${esp32_defaults.build_flags}
|
-D DEFAULT_OT_RX_LED_GPIO=12
|
||||||
-D ARDUINO_USB_MODE=0
|
|
||||||
-D ARDUINO_USB_CDC_ON_BOOT=1
|
|
||||||
-D DEFAULT_OT_IN_GPIO=33
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=35
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=9
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=7
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=11
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=12
|
|
||||||
check_tool = ${esp32_defaults.check_tool}
|
|
||||||
check_flags = ${esp32_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:s3_mini]
|
[env:s3_mini]
|
||||||
platform = ${esp32_defaults.platform}
|
extends = esp32_defaults
|
||||||
platform_packages = ${esp32_defaults.platform_packages}
|
board = lolin_s3_mini
|
||||||
board = lolin_s3_mini
|
lib_deps = ${esp32_defaults.lib_deps}
|
||||||
board_build.partitions = ${esp32_defaults.board_build.partitions}
|
${esp32_defaults.nimble_lib}
|
||||||
lib_deps =
|
build_unflags = -DARDUINO_USB_MODE=1
|
||||||
${esp32_defaults.lib_deps}
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
${esp32_defaults.nimble_lib}
|
-D ARDUINO_USB_MODE=0
|
||||||
lib_ignore = ${esp32_defaults.lib_ignore}
|
-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||||
extra_scripts = ${esp32_defaults.extra_scripts}
|
-D USE_BLE=1
|
||||||
build_unflags =
|
-D MYNEWT_VAL_BLE_EXT_ADV=1
|
||||||
-DARDUINO_USB_MODE=1
|
-D DEFAULT_OT_IN_GPIO=35
|
||||||
build_type = ${esp32_defaults.build_type}
|
-D DEFAULT_OT_OUT_GPIO=36
|
||||||
build_flags =
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=13
|
||||||
${esp32_defaults.build_flags}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=12
|
||||||
-D ARDUINO_USB_MODE=0
|
-D DEFAULT_STATUS_LED_GPIO=11
|
||||||
-D ARDUINO_USB_CDC_ON_BOOT=1
|
-D DEFAULT_OT_RX_LED_GPIO=10
|
||||||
-D MYNEWT_VAL_BLE_EXT_ADV=1
|
|
||||||
-D USE_BLE=1
|
|
||||||
-D DEFAULT_OT_IN_GPIO=35
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=36
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=13
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=12
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=11
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=10
|
|
||||||
check_tool = ${esp32_defaults.check_tool}
|
|
||||||
check_flags = ${esp32_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:c3_mini]
|
[env:c3_mini]
|
||||||
platform = ${esp32_defaults.platform}
|
extends = esp32_defaults
|
||||||
platform_packages = ${esp32_defaults.platform_packages}
|
board = lolin_c3_mini
|
||||||
board = lolin_c3_mini
|
lib_deps = ${esp32_defaults.lib_deps}
|
||||||
board_build.partitions = ${esp32_defaults.board_build.partitions}
|
${esp32_defaults.nimble_lib}
|
||||||
lib_deps =
|
build_unflags = -mtext-section-literals
|
||||||
${esp32_defaults.lib_deps}
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
${esp32_defaults.nimble_lib}
|
-D USE_BLE=1
|
||||||
lib_ignore = ${esp32_defaults.lib_ignore}
|
-D DEFAULT_OT_IN_GPIO=8
|
||||||
extra_scripts = ${esp32_defaults.extra_scripts}
|
-D DEFAULT_OT_OUT_GPIO=10
|
||||||
build_unflags =
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=0
|
||||||
-mtext-section-literals
|
-D DEFAULT_SENSOR_INDOOR_GPIO=1
|
||||||
build_type = ${esp32_defaults.build_type}
|
-D DEFAULT_STATUS_LED_GPIO=4
|
||||||
build_flags =
|
-D DEFAULT_OT_RX_LED_GPIO=5
|
||||||
${esp32_defaults.build_flags}
|
|
||||||
-D MYNEWT_VAL_BLE_EXT_ADV=1
|
|
||||||
-D USE_BLE=1
|
|
||||||
-D DEFAULT_OT_IN_GPIO=8
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=10
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=0
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=1
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=4
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=5
|
|
||||||
check_tool = ${esp32_defaults.check_tool}
|
|
||||||
check_flags = ${esp32_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:nodemcu_32]
|
[env:nodemcu_32]
|
||||||
platform = ${esp32_defaults.platform}
|
extends = esp32_defaults
|
||||||
platform_packages = ${esp32_defaults.platform_packages}
|
board = nodemcu-32s
|
||||||
board = nodemcu-32s
|
lib_deps = ${esp32_defaults.lib_deps}
|
||||||
board_build.partitions = ${esp32_defaults.board_build.partitions}
|
${esp32_defaults.nimble_lib}
|
||||||
lib_deps =
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
${esp32_defaults.lib_deps}
|
-D USE_BLE=1
|
||||||
${esp32_defaults.nimble_lib}
|
-D DEFAULT_OT_IN_GPIO=16
|
||||||
lib_ignore = ${esp32_defaults.lib_ignore}
|
-D DEFAULT_OT_OUT_GPIO=4
|
||||||
extra_scripts = ${esp32_defaults.extra_scripts}
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=15
|
||||||
build_type = ${esp32_defaults.build_type}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=26
|
||||||
build_flags =
|
-D DEFAULT_STATUS_LED_GPIO=2
|
||||||
${esp32_defaults.build_flags}
|
-D DEFAULT_OT_RX_LED_GPIO=19
|
||||||
-D USE_BLE=1
|
|
||||||
-D DEFAULT_OT_IN_GPIO=16
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=4
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=15
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=26
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=2
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=19
|
|
||||||
check_tool = ${esp32_defaults.check_tool}
|
|
||||||
check_flags = ${esp32_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:nodemcu_32_160mhz]
|
[env:nodemcu_32_160mhz]
|
||||||
extends = env:nodemcu_32
|
extends = env:nodemcu_32
|
||||||
board_build.f_cpu = 160000000L ; set frequency to 160MHz
|
board_build.f_cpu = 160000000L ; set frequency to 160MHz
|
||||||
|
|
||||||
[env:d1_mini32]
|
[env:d1_mini32]
|
||||||
platform = ${esp32_defaults.platform}
|
extends = esp32_defaults
|
||||||
platform_packages = ${esp32_defaults.platform_packages}
|
board = wemos_d1_mini32
|
||||||
board = wemos_d1_mini32
|
lib_deps = ${esp32_defaults.lib_deps}
|
||||||
board_build.partitions = ${esp32_defaults.board_build.partitions}
|
${esp32_defaults.nimble_lib}
|
||||||
lib_deps =
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
${esp32_defaults.lib_deps}
|
-D USE_BLE=1
|
||||||
${esp32_defaults.nimble_lib}
|
-D DEFAULT_OT_IN_GPIO=21
|
||||||
lib_ignore = ${esp32_defaults.lib_ignore}
|
-D DEFAULT_OT_OUT_GPIO=22
|
||||||
extra_scripts = ${esp32_defaults.extra_scripts}
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
||||||
build_type = ${esp32_defaults.build_type}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=18
|
||||||
build_flags =
|
-D DEFAULT_STATUS_LED_GPIO=2
|
||||||
${esp32_defaults.build_flags}
|
-D DEFAULT_OT_RX_LED_GPIO=19
|
||||||
-D USE_BLE=1
|
|
||||||
-D DEFAULT_OT_IN_GPIO=21
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=22
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=18
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=2
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=19
|
|
||||||
check_tool = ${esp32_defaults.check_tool}
|
|
||||||
check_flags = ${esp32_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:esp32_c6]
|
[env:esp32_c6]
|
||||||
platform = ${esp32_defaults.platform}
|
extends = esp32_defaults
|
||||||
framework = arduino, espidf
|
board = esp32-c6-devkitc-1
|
||||||
platform_packages = ${esp32_defaults.platform_packages}
|
lib_deps = ${esp32_defaults.lib_deps}
|
||||||
board = esp32-c6-devkitm-1
|
${esp32_defaults.nimble_lib}
|
||||||
board_build.partitions = ${esp32_defaults.board_build.partitions}
|
build_unflags = -mtext-section-literals
|
||||||
board_build.embed_txtfiles =
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
managed_components/espressif__esp_insights/server_certs/https_server.crt
|
-D USE_BLE=1
|
||||||
managed_components/espressif__esp_rainmaker/server_certs/rmaker_mqtt_server.crt
|
-D DEFAULT_OT_IN_GPIO=15
|
||||||
managed_components/espressif__esp_rainmaker/server_certs/rmaker_claim_service_server.crt
|
-D DEFAULT_OT_OUT_GPIO=23
|
||||||
managed_components/espressif__esp_rainmaker/server_certs/rmaker_ota_server.crt
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=0
|
||||||
lib_deps = ${esp32_defaults.lib_deps}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=0
|
||||||
lib_ignore =
|
-D DEFAULT_STATUS_LED_GPIO=11
|
||||||
${esp32_defaults.lib_ignore}
|
-D DEFAULT_OT_RX_LED_GPIO=10
|
||||||
extra_scripts = ${esp32_defaults.extra_scripts}
|
|
||||||
build_unflags =
|
|
||||||
-mtext-section-literals
|
|
||||||
build_type = ${esp32_defaults.build_type}
|
|
||||||
build_flags =
|
|
||||||
${esp32_defaults.build_flags}
|
|
||||||
-D USE_BLE=1
|
|
||||||
-D DEFAULT_OT_IN_GPIO=15
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=23
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=0
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=0
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=11
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=10
|
|
||||||
check_tool = ${esp32_defaults.check_tool}
|
|
||||||
check_flags = ${esp32_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:otthing]
|
[env:otthing]
|
||||||
platform = ${esp32_defaults.platform}
|
extends = esp32_defaults
|
||||||
platform_packages = ${esp32_defaults.platform_packages}
|
board = lolin_c3_mini
|
||||||
board = lolin_c3_mini
|
lib_deps = ${esp32_defaults.lib_deps}
|
||||||
board_build.partitions = ${esp32_defaults.board_build.partitions}
|
${esp32_defaults.nimble_lib}
|
||||||
lib_deps =
|
build_unflags = -mtext-section-literals
|
||||||
${esp32_defaults.lib_deps}
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
${esp32_defaults.nimble_lib}
|
-D USE_BLE=1
|
||||||
lib_ignore = ${esp32_defaults.lib_ignore}
|
-D DEFAULT_OT_IN_GPIO=3
|
||||||
extra_scripts = ${esp32_defaults.extra_scripts}
|
-D DEFAULT_OT_OUT_GPIO=1
|
||||||
build_unflags =
|
;-D DEFAULT_SENSOR_OUTDOOR_GPIO=0
|
||||||
-mtext-section-literals
|
;-D DEFAULT_SENSOR_INDOOR_GPIO=1
|
||||||
build_type = ${esp32_defaults.build_type}
|
-D DEFAULT_STATUS_LED_GPIO=8
|
||||||
build_flags =
|
-D DEFAULT_OT_RX_LED_GPIO=2
|
||||||
${esp32_defaults.build_flags}
|
-D OT_BYPASS_RELAY_GPIO=20
|
||||||
-D MYNEWT_VAL_BLE_EXT_ADV=1
|
|
||||||
-D USE_BLE=1
|
|
||||||
-D DEFAULT_OT_IN_GPIO=3
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=1
|
|
||||||
; -D DEFAULT_SENSOR_OUTDOOR_GPIO=0
|
|
||||||
; -D DEFAULT_SENSOR_INDOOR_GPIO=1
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=8
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=2
|
|
||||||
-D OT_BYPASS_RELAY_GPIO=20
|
|
||||||
check_tool = ${esp32_defaults.check_tool}
|
|
||||||
check_flags = ${esp32_defaults.check_flags}
|
|
||||||
|
|||||||
104
src/HaHelper.h
104
src/HaHelper.h
@@ -443,28 +443,6 @@ 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();
|
||||||
@@ -484,9 +462,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.value|float(0)|round(2) }}");
|
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.heating.hysteresis|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\" : {{ value }}}}}");
|
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"heating\": {\"hysteresis\" : {{ 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;
|
||||||
@@ -866,19 +844,19 @@ public:
|
|||||||
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_SWITCH), F("equitherm")).c_str(), doc);
|
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_SWITCH), F("equitherm")).c_str(), doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool publishInputEquithermSlope(bool enabledByDefault = true) {
|
bool publishInputEquithermFactorN(bool enabledByDefault = true) {
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_slope"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_n"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_slope"));
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_n"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("Equitherm slope");
|
doc[FPSTR(HA_NAME)] = F("Equitherm factor N");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:slope-uphill");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-n-circle-outline");
|
||||||
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
||||||
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.equitherm.slope|float(0)|round(3) }}");
|
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.equitherm.n_factor|float(0)|round(3) }}");
|
||||||
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
||||||
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"equitherm\": {\"slope\" : {{ value }}}}");
|
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"equitherm\": {\"n_factor\" : {{ value }}}}");
|
||||||
doc[FPSTR(HA_MIN)] = 0.001f;
|
doc[FPSTR(HA_MIN)] = 0.001f;
|
||||||
doc[FPSTR(HA_MAX)] = 10;
|
doc[FPSTR(HA_MAX)] = 10;
|
||||||
doc[FPSTR(HA_STEP)] = 0.001f;
|
doc[FPSTR(HA_STEP)] = 0.001f;
|
||||||
@@ -886,80 +864,56 @@ public:
|
|||||||
doc[FPSTR(HA_EXPIRE_AFTER)] = this->expireAfter;
|
doc[FPSTR(HA_EXPIRE_AFTER)] = this->expireAfter;
|
||||||
doc.shrinkToFit();
|
doc.shrinkToFit();
|
||||||
|
|
||||||
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_slope")).c_str(), doc);
|
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_n_factor")).c_str(), doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool publishInputEquithermExponent(bool enabledByDefault = true) {
|
bool publishInputEquithermFactorK(bool enabledByDefault = true) {
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_exponent"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_k"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_exponent"));
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_k"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("Equitherm exponent");
|
doc[FPSTR(HA_NAME)] = F("Equitherm factor K");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:exponent");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-k-circle-outline");
|
||||||
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
||||||
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.equitherm.exponent|float(0)|round(3) }}");
|
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.equitherm.k_factor|float(0)|round(2) }}");
|
||||||
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
||||||
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"equitherm\": {\"exponent\" : {{ value }}}}");
|
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"equitherm\": {\"k_factor\" : {{ value }}}}");
|
||||||
doc[FPSTR(HA_MIN)] = 0.1;
|
doc[FPSTR(HA_MIN)] = 0;
|
||||||
doc[FPSTR(HA_MAX)] = 2;
|
doc[FPSTR(HA_MAX)] = 10;
|
||||||
doc[FPSTR(HA_STEP)] = 0.001f;
|
|
||||||
doc[FPSTR(HA_MODE)] = FPSTR(HA_MODE_BOX);
|
|
||||||
doc[FPSTR(HA_EXPIRE_AFTER)] = this->expireAfter;
|
|
||||||
doc.shrinkToFit();
|
|
||||||
|
|
||||||
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_exponent")).c_str(), doc);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool publishInputEquithermShift(bool enabledByDefault = true) {
|
|
||||||
JsonDocument doc;
|
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_shift"));
|
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_shift"));
|
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
|
||||||
doc[FPSTR(HA_NAME)] = F("Equitherm shift");
|
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:chart-areaspline");
|
|
||||||
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
|
||||||
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.equitherm.shift|float(0)|round(2) }}");
|
|
||||||
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
|
||||||
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"equitherm\": {\"shift\" : {{ value }}}}");
|
|
||||||
doc[FPSTR(HA_MIN)] = -15;
|
|
||||||
doc[FPSTR(HA_MAX)] = 15;
|
|
||||||
doc[FPSTR(HA_STEP)] = 0.01f;
|
doc[FPSTR(HA_STEP)] = 0.01f;
|
||||||
doc[FPSTR(HA_MODE)] = FPSTR(HA_MODE_BOX);
|
doc[FPSTR(HA_MODE)] = FPSTR(HA_MODE_BOX);
|
||||||
doc[FPSTR(HA_EXPIRE_AFTER)] = this->expireAfter;
|
doc[FPSTR(HA_EXPIRE_AFTER)] = this->expireAfter;
|
||||||
doc.shrinkToFit();
|
doc.shrinkToFit();
|
||||||
|
|
||||||
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_shift")).c_str(), doc);
|
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_k_factor")).c_str(), doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool publishInputEquithermTargetDiffFactor(bool enabledByDefault = true) {
|
bool publishInputEquithermFactorT(bool enabledByDefault = true) {
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][0][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][0][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_TOPIC)] = this->settingsTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_TOPIC)] = this->settingsTopic.c_str();
|
||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.pid.enabled, 'offline', 'online') }}");
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.pid.enabled, 'offline', 'online') }}");
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_target_diff_factor"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_t"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_target_diff_factor"));
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_t"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("Equitherm target diff factor");
|
doc[FPSTR(HA_NAME)] = F("Equitherm factor T");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:chart-timeline-variant-shimmer");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-t-circle-outline");
|
||||||
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
||||||
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.equitherm.targetDiffFactor|float(0)|round(3) }}");
|
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.equitherm.t_factor|float(0)|round(2) }}");
|
||||||
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
||||||
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"equitherm\": {\"targetDiffFactor\" : {{ value }}}}");
|
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"equitherm\": {\"t_factor\" : {{ value }}}}");
|
||||||
doc[FPSTR(HA_MIN)] = 0;
|
doc[FPSTR(HA_MIN)] = 0;
|
||||||
doc[FPSTR(HA_MAX)] = 10;
|
doc[FPSTR(HA_MAX)] = 10;
|
||||||
doc[FPSTR(HA_STEP)] = 0.001f;
|
doc[FPSTR(HA_STEP)] = 0.01f;
|
||||||
doc[FPSTR(HA_MODE)] = FPSTR(HA_MODE_BOX);
|
doc[FPSTR(HA_MODE)] = FPSTR(HA_MODE_BOX);
|
||||||
doc[FPSTR(HA_EXPIRE_AFTER)] = this->expireAfter;
|
doc[FPSTR(HA_EXPIRE_AFTER)] = this->expireAfter;
|
||||||
doc.shrinkToFit();
|
doc.shrinkToFit();
|
||||||
|
|
||||||
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_target_diff_factor")).c_str(), doc);
|
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_NUMBER), F("equitherm_t_factor")).c_str(), doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ protected:
|
|||||||
return "Main";
|
return "Main";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t getTaskStackSize() override {
|
||||||
|
return 6000;
|
||||||
|
}
|
||||||
|
|
||||||
/*BaseType_t getTaskCore() override {
|
/*BaseType_t getTaskCore() override {
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
@@ -319,7 +323,7 @@ protected:
|
|||||||
emergencyFlags |= 0b00000010;
|
emergencyFlags |= 0b00000010;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.opentherm.options.nativeOTC) {
|
if (settings.opentherm.options.nativeHeatingControl) {
|
||||||
emergencyFlags |= 0b00000100;
|
emergencyFlags |= 0b00000100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -486,7 +486,6 @@ 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);
|
||||||
@@ -503,10 +502,9 @@ protected:
|
|||||||
|
|
||||||
// equitherm
|
// equitherm
|
||||||
this->haHelper->publishSwitchEquitherm();
|
this->haHelper->publishSwitchEquitherm();
|
||||||
this->haHelper->publishInputEquithermSlope(false);
|
this->haHelper->publishInputEquithermFactorN(false);
|
||||||
this->haHelper->publishInputEquithermExponent(false);
|
this->haHelper->publishInputEquithermFactorK(false);
|
||||||
this->haHelper->publishInputEquithermShift(false);
|
this->haHelper->publishInputEquithermFactorT(false);
|
||||||
this->haHelper->publishInputEquithermTargetDiffFactor(false);
|
|
||||||
|
|
||||||
// states
|
// states
|
||||||
this->haHelper->publishStatusState();
|
this->haHelper->publishStatusState();
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ protected:
|
|||||||
const char* getTaskName() override {
|
const char* getTaskName() override {
|
||||||
return "OpenTherm";
|
return "OpenTherm";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t getTaskStackSize() override {
|
||||||
|
return 7500;
|
||||||
|
}
|
||||||
|
|
||||||
BaseType_t getTaskCore() override {
|
BaseType_t getTaskCore() override {
|
||||||
return 1;
|
return 1;
|
||||||
@@ -186,9 +190,7 @@ protected:
|
|||||||
|| (settings.opentherm.options.dhwToCh2 && settings.opentherm.options.dhwSupport && settings.dhw.enabled);
|
|| (settings.opentherm.options.dhwToCh2 && settings.opentherm.options.dhwSupport && settings.dhw.enabled);
|
||||||
|
|
||||||
if (settings.opentherm.options.heatingToCh2) {
|
if (settings.opentherm.options.heatingToCh2) {
|
||||||
vars.master.ch2.targetTemp = !settings.opentherm.options.nativeOTC
|
vars.master.ch2.targetTemp = vars.master.heating.setpointTemp;
|
||||||
? vars.master.heating.setpointTemp
|
|
||||||
: vars.master.heating.targetTemp;
|
|
||||||
|
|
||||||
} else if (settings.opentherm.options.dhwToCh2) {
|
} else if (settings.opentherm.options.dhwToCh2) {
|
||||||
vars.master.ch2.targetTemp = vars.master.dhw.targetTemp;
|
vars.master.ch2.targetTemp = vars.master.dhw.targetTemp;
|
||||||
@@ -220,7 +222,7 @@ protected:
|
|||||||
vars.master.heating.enabled,
|
vars.master.heating.enabled,
|
||||||
vars.master.dhw.enabled,
|
vars.master.dhw.enabled,
|
||||||
settings.opentherm.options.coolingSupport,
|
settings.opentherm.options.coolingSupport,
|
||||||
settings.opentherm.options.nativeOTC,
|
settings.opentherm.options.nativeHeatingControl,
|
||||||
vars.master.ch2.enabled,
|
vars.master.ch2.enabled,
|
||||||
summerWinterMode,
|
summerWinterMode,
|
||||||
dhwBlocking,
|
dhwBlocking,
|
||||||
@@ -307,7 +309,6 @@ protected:
|
|||||||
Sensors::setConnectionStatusByType(Sensors::Type::OT_DHW_BURNER_HOURS, false);
|
Sensors::setConnectionStatusByType(Sensors::Type::OT_DHW_BURNER_HOURS, false);
|
||||||
Sensors::setConnectionStatusByType(Sensors::Type::OT_HEATING_PUMP_HOURS, false);
|
Sensors::setConnectionStatusByType(Sensors::Type::OT_HEATING_PUMP_HOURS, false);
|
||||||
Sensors::setConnectionStatusByType(Sensors::Type::OT_DHW_PUMP_HOURS, false);
|
Sensors::setConnectionStatusByType(Sensors::Type::OT_DHW_PUMP_HOURS, false);
|
||||||
Sensors::setConnectionStatusByType(Sensors::Type::OT_COOLING_HOURS, false);
|
|
||||||
|
|
||||||
this->initialized = false;
|
this->initialized = false;
|
||||||
this->disconnectedTime = millis();
|
this->disconnectedTime = millis();
|
||||||
@@ -680,21 +681,6 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update cooling hours
|
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_COOLING_HOURS, true)) {
|
|
||||||
if (this->updateCoolingHours()) {
|
|
||||||
Log.snoticeln(FPSTR(L_OT), F("Received cooling hours: %hu"), vars.slave.stats.coolingHours);
|
|
||||||
|
|
||||||
Sensors::setValueByType(
|
|
||||||
Sensors::Type::OT_COOLING_HOURS, vars.slave.stats.coolingHours,
|
|
||||||
Sensors::ValueType::PRIMARY, true, true
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.swarningln(FPSTR(L_OT), F("Failed receive cooling hours"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Auto fault reset
|
// Auto fault reset
|
||||||
if (settings.opentherm.options.autoFaultReset && vars.slave.fault.active && !vars.actions.resetFault) {
|
if (settings.opentherm.options.autoFaultReset && vars.slave.fault.active && !vars.actions.resetFault) {
|
||||||
vars.actions.resetFault = true;
|
vars.actions.resetFault = true;
|
||||||
@@ -810,7 +796,7 @@ protected:
|
|||||||
bool result = this->updateDhwTemp();
|
bool result = this->updateDhwTemp();
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
const float convertedDhwTemp = convertTemp(
|
float convertedDhwTemp = convertTemp(
|
||||||
vars.slave.dhw.currentTemp,
|
vars.slave.dhw.currentTemp,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -834,7 +820,7 @@ protected:
|
|||||||
// Update DHW temp 2
|
// Update DHW temp 2
|
||||||
if (settings.opentherm.options.dhwSupport && Sensors::getAmountByType(Sensors::Type::OT_DHW_TEMP2, true)) {
|
if (settings.opentherm.options.dhwSupport && Sensors::getAmountByType(Sensors::Type::OT_DHW_TEMP2, true)) {
|
||||||
if (this->updateDhwTemp2()) {
|
if (this->updateDhwTemp2()) {
|
||||||
const float convertedDhwTemp2 = convertTemp(
|
float convertedDhwTemp2 = convertTemp(
|
||||||
vars.slave.dhw.currentTemp2,
|
vars.slave.dhw.currentTemp2,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -858,7 +844,7 @@ protected:
|
|||||||
// Update DHW flow rate
|
// Update DHW flow rate
|
||||||
if (settings.opentherm.options.dhwSupport && Sensors::getAmountByType(Sensors::Type::OT_DHW_FLOW_RATE, true)) {
|
if (settings.opentherm.options.dhwSupport && Sensors::getAmountByType(Sensors::Type::OT_DHW_FLOW_RATE, true)) {
|
||||||
if (this->updateDhwFlowRate()) {
|
if (this->updateDhwFlowRate()) {
|
||||||
const float convertedDhwFlowRate = convertVolume(
|
float convertedDhwFlowRate = convertVolume(
|
||||||
vars.slave.dhw.flowRate,
|
vars.slave.dhw.flowRate,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -882,7 +868,7 @@ protected:
|
|||||||
// Update heating temp
|
// Update heating temp
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_HEATING_TEMP, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_HEATING_TEMP, true)) {
|
||||||
if (this->updateHeatingTemp()) {
|
if (this->updateHeatingTemp()) {
|
||||||
const float convertedHeatingTemp = convertTemp(
|
float convertedHeatingTemp = convertTemp(
|
||||||
vars.slave.heating.currentTemp,
|
vars.slave.heating.currentTemp,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -906,7 +892,7 @@ protected:
|
|||||||
// Update heating return temp
|
// Update heating return temp
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_HEATING_RETURN_TEMP, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_HEATING_RETURN_TEMP, true)) {
|
||||||
if (this->updateHeatingReturnTemp()) {
|
if (this->updateHeatingReturnTemp()) {
|
||||||
const float convertedHeatingReturnTemp = convertTemp(
|
float convertedHeatingReturnTemp = convertTemp(
|
||||||
vars.slave.heating.returnTemp,
|
vars.slave.heating.returnTemp,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -929,9 +915,9 @@ protected:
|
|||||||
|
|
||||||
// Update CH2 temp
|
// Update CH2 temp
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_CH2_TEMP, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_CH2_TEMP, true)) {
|
||||||
if (vars.master.ch2.enabled && !settings.opentherm.options.nativeOTC) {
|
if (vars.master.ch2.enabled && !settings.opentherm.options.nativeHeatingControl) {
|
||||||
if (this->updateCh2Temp()) {
|
if (this->updateCh2Temp()) {
|
||||||
const float convertedCh2Temp = convertTemp(
|
float convertedCh2Temp = convertTemp(
|
||||||
vars.slave.ch2.currentTemp,
|
vars.slave.ch2.currentTemp,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -956,7 +942,7 @@ protected:
|
|||||||
// Update exhaust temp
|
// Update exhaust temp
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_EXHAUST_TEMP, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_EXHAUST_TEMP, true)) {
|
||||||
if (this->updateExhaustTemp()) {
|
if (this->updateExhaustTemp()) {
|
||||||
const float convertedExhaustTemp = convertTemp(
|
float convertedExhaustTemp = convertTemp(
|
||||||
vars.slave.exhaust.temp,
|
vars.slave.exhaust.temp,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -980,7 +966,7 @@ protected:
|
|||||||
// Update heat exchanger temp
|
// Update heat exchanger temp
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_HEAT_EXCHANGER_TEMP, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_HEAT_EXCHANGER_TEMP, true)) {
|
||||||
if (this->updateHeatExchangerTemp()) {
|
if (this->updateHeatExchangerTemp()) {
|
||||||
const float convertedHeatExchTemp = convertTemp(
|
float convertedHeatExchTemp = convertTemp(
|
||||||
vars.slave.heatExchangerTemp,
|
vars.slave.heatExchangerTemp,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -1004,7 +990,7 @@ protected:
|
|||||||
// Update outdoor temp
|
// Update outdoor temp
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_OUTDOOR_TEMP, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_OUTDOOR_TEMP, true)) {
|
||||||
if (this->updateOutdoorTemp()) {
|
if (this->updateOutdoorTemp()) {
|
||||||
const float convertedOutdoorTemp = convertTemp(
|
float convertedOutdoorTemp = convertTemp(
|
||||||
vars.slave.heating.outdoorTemp,
|
vars.slave.heating.outdoorTemp,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -1028,7 +1014,7 @@ protected:
|
|||||||
// Update solar storage temp
|
// Update solar storage temp
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_SOLAR_STORAGE_TEMP, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_SOLAR_STORAGE_TEMP, true)) {
|
||||||
if (this->updateSolarStorageTemp()) {
|
if (this->updateSolarStorageTemp()) {
|
||||||
const float convertedSolarStorageTemp = convertTemp(
|
float convertedSolarStorageTemp = convertTemp(
|
||||||
vars.slave.solar.storage,
|
vars.slave.solar.storage,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -1052,7 +1038,7 @@ protected:
|
|||||||
// Update solar collector temp
|
// Update solar collector temp
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_SOLAR_COLLECTOR_TEMP, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_SOLAR_COLLECTOR_TEMP, true)) {
|
||||||
if (this->updateSolarCollectorTemp()) {
|
if (this->updateSolarCollectorTemp()) {
|
||||||
const float convertedSolarCollectorTemp = convertTemp(
|
float convertedSolarCollectorTemp = convertTemp(
|
||||||
vars.slave.solar.collector,
|
vars.slave.solar.collector,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -1098,7 +1084,7 @@ protected:
|
|||||||
// Update pressure
|
// Update pressure
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_PRESSURE, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_PRESSURE, true)) {
|
||||||
if (this->updatePressure()) {
|
if (this->updatePressure()) {
|
||||||
const float convertedPressure = convertPressure(
|
float convertedPressure = convertPressure(
|
||||||
vars.slave.pressure,
|
vars.slave.pressure,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -1204,12 +1190,9 @@ protected:
|
|||||||
|
|
||||||
// Update DHW temp
|
// Update DHW temp
|
||||||
if (vars.master.dhw.enabled) {
|
if (vars.master.dhw.enabled) {
|
||||||
// Target dhw temp
|
|
||||||
const float& targetTemp = vars.master.dhw.targetTemp;
|
|
||||||
|
|
||||||
// Converted target dhw temp
|
// Converted target dhw temp
|
||||||
const float convertedTemp = convertTemp(
|
float convertedTemp = convertTemp(
|
||||||
targetTemp,
|
vars.master.dhw.targetTemp,
|
||||||
settings.system.unitSystem,
|
settings.system.unitSystem,
|
||||||
settings.opentherm.unitSystem
|
settings.opentherm.unitSystem
|
||||||
);
|
);
|
||||||
@@ -1221,7 +1204,7 @@ protected:
|
|||||||
|
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_OT_DHW), F("Set temp: %.2f (converted: %.2f, response: %.2f)"),
|
FPSTR(L_OT_DHW), F("Set temp: %.2f (converted: %.2f, response: %.2f)"),
|
||||||
targetTemp, convertedTemp, vars.slave.dhw.targetTemp
|
vars.master.dhw.targetTemp, convertedTemp, vars.slave.dhw.targetTemp
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1230,19 +1213,16 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send indoor temp if AlwaysSendIndoorTemp option is enabled.
|
// Native heating control
|
||||||
if (settings.opentherm.options.nativeOTC || settings.opentherm.options.alwaysSendIndoorTemp) {
|
if (settings.opentherm.options.nativeHeatingControl) {
|
||||||
// Current indoor temp
|
|
||||||
const float& indoorTemp = vars.master.heating.indoorTemp;
|
|
||||||
|
|
||||||
// Converted current indoor temp
|
// Converted current indoor temp
|
||||||
const float convertedTemp = convertTemp(indoorTemp, settings.system.unitSystem, settings.opentherm.unitSystem);
|
float convertedTemp = convertTemp(vars.master.heating.indoorTemp, settings.system.unitSystem, settings.opentherm.unitSystem);
|
||||||
|
|
||||||
// Set current indoor temp
|
// Set current indoor temp
|
||||||
if (this->setRoomTemp(convertedTemp)) {
|
if (this->setRoomTemp(convertedTemp)) {
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_OT_HEATING), F("Set current indoor temp: %.2f (converted: %.2f, response: %.2f)"),
|
FPSTR(L_OT_HEATING), F("Set current indoor temp: %.2f (converted: %.2f, response: %.2f)"),
|
||||||
indoorTemp, convertedTemp, vars.slave.heating.indoorTemp
|
vars.master.heating.indoorTemp, convertedTemp, vars.slave.heating.indoorTemp
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1254,26 +1234,17 @@ protected:
|
|||||||
if (this->setRoomTempCh2(convertedTemp)) {
|
if (this->setRoomTempCh2(convertedTemp)) {
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_OT_HEATING), F("Set current CH2 indoor temp: %.2f (converted: %.2f, response: %.2f)"),
|
FPSTR(L_OT_HEATING), F("Set current CH2 indoor temp: %.2f (converted: %.2f, response: %.2f)"),
|
||||||
indoorTemp, convertedTemp, vars.slave.ch2.indoorTemp
|
vars.master.heating.indoorTemp, convertedTemp, vars.slave.ch2.indoorTemp
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
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"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// NativeOTC
|
|
||||||
if (settings.opentherm.options.nativeOTC) {
|
|
||||||
// Target indoor temp
|
|
||||||
const float& targetTemp = vars.master.heating.targetTemp;
|
|
||||||
|
|
||||||
// Converted target indoor temp
|
// Converted target indoor temp
|
||||||
const float convertedTemp = convertTemp(
|
convertedTemp = convertTemp(vars.master.heating.targetTemp, settings.system.unitSystem, settings.opentherm.unitSystem);
|
||||||
targetTemp,
|
|
||||||
settings.system.unitSystem,
|
|
||||||
settings.opentherm.unitSystem
|
|
||||||
);
|
|
||||||
|
|
||||||
// Set target indoor temp
|
// Set target indoor temp
|
||||||
if (this->needSetHeatingTemp(convertedTemp)) {
|
if (this->needSetHeatingTemp(convertedTemp)) {
|
||||||
@@ -1282,7 +1253,7 @@ protected:
|
|||||||
|
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_OT_HEATING), F("Set target indoor temp: %.2f (converted: %.2f, response: %.2f)"),
|
FPSTR(L_OT_HEATING), F("Set target indoor temp: %.2f (converted: %.2f, response: %.2f)"),
|
||||||
targetTemp, convertedTemp, vars.slave.heating.targetTemp
|
vars.master.heating.targetTemp, convertedTemp, vars.slave.heating.targetTemp
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1297,7 +1268,7 @@ protected:
|
|||||||
|
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_OT_HEATING), F("Set target CH2 indoor temp: %.2f (converted: %.2f, response: %.2f)"),
|
FPSTR(L_OT_HEATING), F("Set target CH2 indoor temp: %.2f (converted: %.2f, response: %.2f)"),
|
||||||
targetTemp, convertedTemp, vars.slave.ch2.targetTemp
|
vars.master.heating.targetTemp, convertedTemp, vars.slave.ch2.targetTemp
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1306,22 +1277,10 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set heating temp
|
// Normal heating control
|
||||||
{
|
if (!settings.opentherm.options.nativeHeatingControl && vars.master.heating.enabled) {
|
||||||
// Target heating temp
|
|
||||||
float targetTemp = 0.0f;
|
|
||||||
if (vars.master.heating.enabled) {
|
|
||||||
targetTemp = !settings.opentherm.options.nativeOTC
|
|
||||||
? vars.master.heating.setpointTemp
|
|
||||||
: vars.master.heating.targetTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Converted target heating temp
|
// Converted target heating temp
|
||||||
const float convertedTemp = convertTemp(
|
float convertedTemp = convertTemp(vars.master.heating.setpointTemp, settings.system.unitSystem, settings.opentherm.unitSystem);
|
||||||
targetTemp,
|
|
||||||
settings.system.unitSystem,
|
|
||||||
settings.opentherm.unitSystem
|
|
||||||
);
|
|
||||||
|
|
||||||
if (this->needSetHeatingTemp(convertedTemp)) {
|
if (this->needSetHeatingTemp(convertedTemp)) {
|
||||||
// Set max heating temp
|
// Set max heating temp
|
||||||
@@ -1329,13 +1288,13 @@ protected:
|
|||||||
if (this->setMaxHeatingTemp(convertedTemp)) {
|
if (this->setMaxHeatingTemp(convertedTemp)) {
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_OT_HEATING), F("Set max heating temp: %.2f (converted: %.2f)"),
|
FPSTR(L_OT_HEATING), F("Set max heating temp: %.2f (converted: %.2f)"),
|
||||||
targetTemp, convertedTemp
|
vars.master.heating.setpointTemp, convertedTemp
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.swarningln(
|
Log.swarningln(
|
||||||
FPSTR(L_OT_HEATING), F("Failed set max heating temp: %.2f (converted: %.2f)"),
|
FPSTR(L_OT_HEATING), F("Failed set max heating temp: %.2f (converted: %.2f)"),
|
||||||
targetTemp, convertedTemp
|
vars.master.heating.setpointTemp, convertedTemp
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1346,7 +1305,7 @@ protected:
|
|||||||
|
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_OT_HEATING), F("Set target temp: %.2f (converted: %.2f, response: %.2f)"),
|
FPSTR(L_OT_HEATING), F("Set target temp: %.2f (converted: %.2f, response: %.2f)"),
|
||||||
targetTemp, convertedTemp, vars.slave.heating.targetTemp
|
vars.master.heating.setpointTemp, convertedTemp, vars.slave.heating.targetTemp
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1356,30 +1315,27 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set CH2 temp
|
// Set CH2 temp
|
||||||
if (settings.opentherm.options.heatingToCh2 || settings.opentherm.options.dhwToCh2) {
|
if (!settings.opentherm.options.nativeHeatingControl && vars.master.ch2.enabled) {
|
||||||
// Target CH2 heating temp
|
if (settings.opentherm.options.heatingToCh2 || settings.opentherm.options.dhwToCh2) {
|
||||||
const float targetTemp = vars.master.ch2.enabled
|
// Converted target CH2 temp
|
||||||
? vars.master.ch2.targetTemp
|
float convertedTemp = convertTemp(
|
||||||
: 0.0f;
|
vars.master.ch2.targetTemp,
|
||||||
|
settings.system.unitSystem,
|
||||||
|
settings.opentherm.unitSystem
|
||||||
|
);
|
||||||
|
|
||||||
// Converted target CH2 temp
|
if (this->needSetCh2Temp(convertedTemp)) {
|
||||||
const float convertedTemp = convertTemp(
|
if (this->setCh2Temp(convertedTemp)) {
|
||||||
targetTemp,
|
this->ch2SetTempTime = millis();
|
||||||
settings.system.unitSystem,
|
|
||||||
settings.opentherm.unitSystem
|
|
||||||
);
|
|
||||||
|
|
||||||
if (this->needSetCh2Temp(convertedTemp)) {
|
Log.sinfoln(
|
||||||
if (this->setCh2Temp(convertedTemp)) {
|
FPSTR(L_OT_CH2), F("Set temp: %.2f (converted: %.2f, response: %.2f)"),
|
||||||
this->ch2SetTempTime = millis();
|
vars.master.ch2.targetTemp, convertedTemp, vars.slave.ch2.targetTemp
|
||||||
|
);
|
||||||
|
|
||||||
Log.sinfoln(
|
} else {
|
||||||
FPSTR(L_OT_CH2), F("Set temp: %.2f (converted: %.2f, response: %.2f)"),
|
Log.swarningln(FPSTR(L_OT_CH2), F("Failed set temp"));
|
||||||
targetTemp, convertedTemp, vars.slave.ch2.targetTemp
|
}
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.swarningln(FPSTR(L_OT_CH2), F("Failed set temp"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1387,7 +1343,7 @@ protected:
|
|||||||
|
|
||||||
// Heating overheat control
|
// Heating overheat control
|
||||||
if (settings.heating.overheatProtection.highTemp > 0 && settings.heating.overheatProtection.lowTemp > 0) {
|
if (settings.heating.overheatProtection.highTemp > 0 && settings.heating.overheatProtection.lowTemp > 0) {
|
||||||
const float highTemp = convertTemp(
|
float highTemp = convertTemp(
|
||||||
max({
|
max({
|
||||||
vars.slave.heating.currentTemp,
|
vars.slave.heating.currentTemp,
|
||||||
vars.slave.heating.returnTemp,
|
vars.slave.heating.returnTemp,
|
||||||
@@ -1424,7 +1380,7 @@ protected:
|
|||||||
|
|
||||||
// DHW overheat control
|
// DHW overheat control
|
||||||
if (settings.dhw.overheatProtection.highTemp > 0 && settings.dhw.overheatProtection.lowTemp > 0) {
|
if (settings.dhw.overheatProtection.highTemp > 0 && settings.dhw.overheatProtection.lowTemp > 0) {
|
||||||
const float highTemp = convertTemp(
|
float highTemp = convertTemp(
|
||||||
max({
|
max({
|
||||||
vars.slave.heating.currentTemp,
|
vars.slave.heating.currentTemp,
|
||||||
vars.slave.heating.returnTemp,
|
vars.slave.heating.returnTemp,
|
||||||
@@ -1518,19 +1474,6 @@ protected:
|
|||||||
} else {
|
} else {
|
||||||
Log.swarningln(FPSTR(L_OT), F("Failed set master config"));
|
Log.swarningln(FPSTR(L_OT), F("Failed set master config"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*char buf[100];
|
|
||||||
if (this->instance->getStr(OpenThermMessageID::Brand, buf, sizeof(buf) - 1)) {
|
|
||||||
Log.snoticeln(FPSTR(L_OT), F("Slave brand: %s"), buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->instance->getStr(OpenThermMessageID::BrandVersion, buf, sizeof(buf) - 1)) {
|
|
||||||
Log.snoticeln(FPSTR(L_OT), F("Slave brand version: %s"), buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->instance->getStr(OpenThermMessageID::BrandSerialNumber, buf, sizeof(buf) - 1)) {
|
|
||||||
Log.snoticeln(FPSTR(L_OT), F("Slave brand s/n: %s"), buf);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isReady() {
|
bool isReady() {
|
||||||
@@ -1708,7 +1651,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool setRoomTemp(const float temperature) {
|
bool setRoomTemp(float temperature) {
|
||||||
const unsigned int request = CustomOpenTherm::temperatureToData(temperature);
|
const unsigned int request = CustomOpenTherm::temperatureToData(temperature);
|
||||||
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
||||||
OpenThermMessageType::WRITE_DATA,
|
OpenThermMessageType::WRITE_DATA,
|
||||||
@@ -1728,7 +1671,7 @@ protected:
|
|||||||
return CustomOpenTherm::getUInt(response) == request;
|
return CustomOpenTherm::getUInt(response) == request;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool setRoomTempCh2(const float temperature) {
|
bool setRoomTempCh2(float temperature) {
|
||||||
const unsigned int request = CustomOpenTherm::temperatureToData(temperature);
|
const unsigned int request = CustomOpenTherm::temperatureToData(temperature);
|
||||||
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
||||||
OpenThermMessageType::WRITE_DATA,
|
OpenThermMessageType::WRITE_DATA,
|
||||||
@@ -2230,25 +2173,6 @@ protected:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool updateCoolingHours() {
|
|
||||||
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
|
||||||
OpenThermRequestType::READ_DATA,
|
|
||||||
OpenThermMessageID::CoolingOperationHours,
|
|
||||||
0
|
|
||||||
));
|
|
||||||
|
|
||||||
if (!CustomOpenTherm::isValidResponse(response)) {
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} else if (!CustomOpenTherm::isValidResponseId(response, OpenThermMessageID::CoolingOperationHours)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
vars.slave.stats.coolingHours = CustomOpenTherm::getUInt(response);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool updateModulationLevel() {
|
bool updateModulationLevel() {
|
||||||
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
||||||
OpenThermRequestType::READ_DATA,
|
OpenThermRequestType::READ_DATA,
|
||||||
@@ -2263,7 +2187,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float value = CustomOpenTherm::getFloat(response);
|
float value = CustomOpenTherm::getFloat(response);
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2287,7 +2211,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float value = CustomOpenTherm::getFloat(response);
|
float value = CustomOpenTherm::getFloat(response);
|
||||||
if (value <= 0) {
|
if (value <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2311,7 +2235,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float value = CustomOpenTherm::getFloat(response);
|
float value = CustomOpenTherm::getFloat(response);
|
||||||
if (value <= 0) {
|
if (value <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2365,7 +2289,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float value = CustomOpenTherm::getFloat(response);
|
float value = CustomOpenTherm::getFloat(response);
|
||||||
if (value <= 0) {
|
if (value <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2429,7 +2353,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float value = (float) CustomOpenTherm::getInt(response);
|
float value = (float) CustomOpenTherm::getInt(response);
|
||||||
if (!isValidTemp(value, settings.opentherm.unitSystem, -40, 500)) {
|
if (!isValidTemp(value, settings.opentherm.unitSystem, -40, 500)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2453,7 +2377,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float value = (float) CustomOpenTherm::getInt(response);
|
float value = (float) CustomOpenTherm::getInt(response);
|
||||||
if (value <= 0) {
|
if (value <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2554,7 +2478,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float value = CustomOpenTherm::getFloat(response);
|
float value = CustomOpenTherm::getFloat(response);
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
849
src/PortalTask.h
849
src/PortalTask.h
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,7 @@
|
|||||||
|
#include <Equitherm.h>
|
||||||
#include <GyverPID.h>
|
#include <GyverPID.h>
|
||||||
|
|
||||||
|
Equitherm etRegulator;
|
||||||
GyverPID pidRegulator(0, 0, 0);
|
GyverPID pidRegulator(0, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
@@ -19,6 +21,10 @@ protected:
|
|||||||
const char* getTaskName() override {
|
const char* getTaskName() override {
|
||||||
return "Regulator";
|
return "Regulator";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t getTaskStackSize() override {
|
||||||
|
return 5000;
|
||||||
|
}
|
||||||
|
|
||||||
/*BaseType_t getTaskCore() override {
|
/*BaseType_t getTaskCore() override {
|
||||||
return 1;
|
return 1;
|
||||||
@@ -37,7 +43,7 @@ protected:
|
|||||||
this->indoorSensorsConnected = Sensors::existsConnectedSensorsByPurpose(Sensors::Purpose::INDOOR_TEMP);
|
this->indoorSensorsConnected = Sensors::existsConnectedSensorsByPurpose(Sensors::Purpose::INDOOR_TEMP);
|
||||||
//this->outdoorSensorsConnected = Sensors::existsConnectedSensorsByPurpose(Sensors::Purpose::OUTDOOR_TEMP);
|
//this->outdoorSensorsConnected = Sensors::existsConnectedSensorsByPurpose(Sensors::Purpose::OUTDOOR_TEMP);
|
||||||
|
|
||||||
if (settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeOTC) {
|
if (settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeHeatingControl) {
|
||||||
vars.master.heating.indoorTempControl = true;
|
vars.master.heating.indoorTempControl = true;
|
||||||
vars.master.heating.minTemp = THERMOSTAT_INDOOR_MIN_TEMP;
|
vars.master.heating.minTemp = THERMOSTAT_INDOOR_MIN_TEMP;
|
||||||
vars.master.heating.maxTemp = THERMOSTAT_INDOOR_MAX_TEMP;
|
vars.master.heating.maxTemp = THERMOSTAT_INDOOR_MAX_TEMP;
|
||||||
@@ -90,15 +96,15 @@ protected:
|
|||||||
|
|
||||||
void hysteresis() {
|
void hysteresis() {
|
||||||
bool useHyst = false;
|
bool useHyst = false;
|
||||||
if (settings.heating.hysteresis.enabled && this->indoorSensorsConnected) {
|
if (settings.heating.hysteresis > 0.01f && this->indoorSensorsConnected) {
|
||||||
useHyst = settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeOTC;
|
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.value) {
|
if (!vars.master.heating.blocking && vars.master.heating.indoorTemp - settings.heating.target + 0.0001f >= settings.heating.hysteresis) {
|
||||||
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.value)) {
|
} else if (vars.master.heating.blocking && vars.master.heating.indoorTemp - settings.heating.target - 0.0001f <= -(settings.heating.hysteresis)) {
|
||||||
vars.master.heating.blocking = false;
|
vars.master.heating.blocking = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,13 +114,13 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline float getHeatingMinSetpointTemp() {
|
inline float getHeatingMinSetpointTemp() {
|
||||||
return settings.opentherm.options.nativeOTC
|
return settings.opentherm.options.nativeHeatingControl
|
||||||
? vars.master.heating.minTemp
|
? vars.master.heating.minTemp
|
||||||
: settings.heating.minTemp;
|
: settings.heating.minTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline float getHeatingMaxSetpointTemp() {
|
inline float getHeatingMaxSetpointTemp() {
|
||||||
return settings.opentherm.options.nativeOTC
|
return settings.opentherm.options.nativeHeatingControl
|
||||||
? vars.master.heating.maxTemp
|
? vars.master.heating.maxTemp
|
||||||
: settings.heating.maxTemp;
|
: settings.heating.maxTemp;
|
||||||
}
|
}
|
||||||
@@ -135,7 +141,7 @@ protected:
|
|||||||
if (vars.emergency.state) {
|
if (vars.emergency.state) {
|
||||||
return settings.emergency.target;
|
return settings.emergency.target;
|
||||||
|
|
||||||
} else if (settings.opentherm.options.nativeOTC) {
|
} else if (settings.opentherm.options.nativeHeatingControl) {
|
||||||
return settings.heating.target;
|
return settings.heating.target;
|
||||||
|
|
||||||
} else if (!settings.equitherm.enabled && !settings.pid.enabled) {
|
} else if (!settings.equitherm.enabled && !settings.pid.enabled) {
|
||||||
@@ -144,32 +150,39 @@ protected:
|
|||||||
|
|
||||||
// if use equitherm
|
// if use equitherm
|
||||||
if (settings.equitherm.enabled) {
|
if (settings.equitherm.enabled) {
|
||||||
float tempDelta = settings.heating.target - vars.master.heating.outdoorTemp;
|
unsigned short minTemp = settings.heating.minTemp;
|
||||||
float maxPoint = settings.heating.target - (
|
unsigned short maxTemp = settings.heating.maxTemp;
|
||||||
settings.heating.maxTemp - settings.heating.target
|
float targetTemp = settings.heating.target;
|
||||||
) / settings.equitherm.slope;
|
float indoorTemp = vars.master.heating.indoorTemp;
|
||||||
|
float outdoorTemp = vars.master.heating.outdoorTemp;
|
||||||
|
|
||||||
float sf = (settings.heating.maxTemp - settings.heating.target) / pow(
|
if (settings.system.unitSystem == UnitSystem::IMPERIAL) {
|
||||||
settings.heating.target - maxPoint,
|
minTemp = f2c(minTemp);
|
||||||
1.0f / settings.equitherm.exponent
|
maxTemp = f2c(maxTemp);
|
||||||
);
|
targetTemp = f2c(targetTemp);
|
||||||
float etResult = settings.heating.target + settings.equitherm.shift + sf * (
|
indoorTemp = f2c(indoorTemp);
|
||||||
tempDelta >= 0
|
outdoorTemp = f2c(outdoorTemp);
|
||||||
? pow(tempDelta, 1.0f / settings.equitherm.exponent)
|
|
||||||
: -(pow(-(tempDelta), 1.0f / settings.equitherm.exponent))
|
|
||||||
);
|
|
||||||
|
|
||||||
// add diff
|
|
||||||
if (this->indoorSensorsConnected && !settings.pid.enabled && !settings.heating.turbo) {
|
|
||||||
etResult += constrain(
|
|
||||||
settings.heating.target - vars.master.heating.indoorTemp,
|
|
||||||
-3.0f,
|
|
||||||
3.0f
|
|
||||||
) * settings.equitherm.targetDiffFactor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// limit
|
if (!this->indoorSensorsConnected || settings.pid.enabled) {
|
||||||
etResult = constrain(etResult, settings.heating.minTemp, settings.heating.maxTemp);
|
etRegulator.Kt = 0.0f;
|
||||||
|
etRegulator.indoorTemp = 0.0f;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
etRegulator.Kt = settings.heating.turbo ? 0.0f : settings.equitherm.t_factor;
|
||||||
|
etRegulator.indoorTemp = indoorTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
etRegulator.setLimits(minTemp, maxTemp);
|
||||||
|
etRegulator.Kn = settings.equitherm.n_factor;
|
||||||
|
etRegulator.Kk = settings.equitherm.k_factor;
|
||||||
|
etRegulator.targetTemp = targetTemp;
|
||||||
|
etRegulator.outdoorTemp = outdoorTemp;
|
||||||
|
float etResult = etRegulator.getResult();
|
||||||
|
|
||||||
|
if (settings.system.unitSystem == UnitSystem::IMPERIAL) {
|
||||||
|
etResult = c2f(etResult);
|
||||||
|
}
|
||||||
|
|
||||||
if (fabsf(prevEtResult - etResult) > 0.09f) {
|
if (fabsf(prevEtResult - etResult) > 0.09f) {
|
||||||
prevEtResult = etResult;
|
prevEtResult = etResult;
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ public:
|
|||||||
OT_DHW_BURNER_HOURS = 24,
|
OT_DHW_BURNER_HOURS = 24,
|
||||||
OT_HEATING_PUMP_HOURS = 25,
|
OT_HEATING_PUMP_HOURS = 25,
|
||||||
OT_DHW_PUMP_HOURS = 26,
|
OT_DHW_PUMP_HOURS = 26,
|
||||||
OT_COOLING_HOURS = 27,
|
|
||||||
|
|
||||||
NTC_10K_TEMP = 50,
|
NTC_10K_TEMP = 50,
|
||||||
DALLAS_TEMP = 51,
|
DALLAS_TEMP = 51,
|
||||||
@@ -330,12 +329,12 @@ public:
|
|||||||
|
|
||||||
static float getMeanValueByPurpose(Purpose purpose, const ValueType valueType, bool onlyConnected = true) {
|
static float getMeanValueByPurpose(Purpose purpose, const ValueType valueType, bool onlyConnected = true) {
|
||||||
if (settings == nullptr || results == nullptr) {
|
if (settings == nullptr || results == nullptr) {
|
||||||
return 0.0f;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t valueId = (uint8_t) valueType;
|
uint8_t valueId = (uint8_t) valueType;
|
||||||
if (!isValidValueId(valueId)) {
|
if (!isValidValueId(valueId)) {
|
||||||
return 0.0f;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
float value = 0.0f;
|
float value = 0.0f;
|
||||||
@@ -364,7 +363,7 @@ public:
|
|||||||
|
|
||||||
static bool existsConnectedSensorsByPurpose(Purpose purpose) {
|
static bool existsConnectedSensorsByPurpose(Purpose purpose) {
|
||||||
if (settings == nullptr || results == nullptr) {
|
if (settings == nullptr || results == nullptr) {
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t id = 0; id <= getMaxSensorId(); id++) {
|
for (uint8_t id = 0; id <= getMaxSensorId(); id++) {
|
||||||
|
|||||||
@@ -9,41 +9,136 @@
|
|||||||
extern FileData fsSensorsSettings;
|
extern FileData fsSensorsSettings;
|
||||||
|
|
||||||
#if USE_BLE
|
#if USE_BLE
|
||||||
class BluetoothClientCallbacks : public NimBLEClientCallbacks {
|
class BluetoothScanCallbacks : public NimBLEScanCallbacks {
|
||||||
public:
|
public:
|
||||||
BluetoothClientCallbacks(uint8_t sensorId) : sensorId(sensorId) {}
|
void onDiscovered(const NimBLEAdvertisedDevice* device) override {
|
||||||
|
auto& deviceAddress = device->getAddress();
|
||||||
|
|
||||||
void onConnect(NimBLEClient* pClient) {
|
bool found = false;
|
||||||
auto& sSensor = Sensors::settings[this->sensorId];
|
uint8_t sensorId;
|
||||||
|
for (sensorId = 0; sensorId <= Sensors::getMaxSensorId(); sensorId++) {
|
||||||
|
auto& sSensor = Sensors::settings[sensorId];
|
||||||
|
if (!sSensor.enabled || sSensor.type != Sensors::Type::BLUETOOTH || sSensor.purpose == Sensors::Purpose::NOT_CONFIGURED) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Log.sinfoln(
|
const auto sensorAddress = NimBLEAddress(sSensor.address, deviceAddress.getType());
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': connected to %s"),
|
if (sensorAddress.isNull() || sensorAddress != deviceAddress) {
|
||||||
sensorId, sSensor.name, pClient->getPeerAddress().toString().c_str()
|
continue;
|
||||||
);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void onDisconnect(NimBLEClient* pClient, int reason) {
|
found = true;
|
||||||
auto& sSensor = Sensors::settings[this->sensorId];
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
Log.sinfoln(
|
if (!found) {
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': disconnected, reason %i"),
|
return;
|
||||||
sensorId, sSensor.name, reason
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void onConnectFail(NimBLEClient* pClient, int reason) {
|
auto& sSensor = Sensors::settings[sensorId];
|
||||||
auto& sSensor = Sensors::settings[this->sensorId];
|
auto& rSensor = Sensors::results[sensorId];
|
||||||
|
auto deviceName = device->getName();
|
||||||
|
auto deviceRssi = device->getRSSI();
|
||||||
|
|
||||||
Log.sinfoln(
|
Log.straceln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to connect, reason %i"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': discovered device %s, name: %s, RSSI: %hhd"),
|
||||||
sensorId, sSensor.name, reason
|
sensorId, sSensor.name,
|
||||||
|
deviceAddress.toString().c_str(), deviceName.c_str(), deviceRssi
|
||||||
);
|
);
|
||||||
|
|
||||||
pClient->cancelConnect();
|
if (!device->haveServiceData()) {
|
||||||
}
|
Log.straceln(
|
||||||
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found service data"),
|
||||||
|
sensorId, sSensor.name
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
auto serviceDataCount = device->getServiceDataCount();
|
||||||
uint8_t sensorId;
|
Log.straceln(
|
||||||
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found %hhu service data"),
|
||||||
|
sensorId, sSensor.name, serviceDataCount
|
||||||
|
);
|
||||||
|
|
||||||
|
NimBLEUUID serviceUuid((uint16_t) 0x181A);
|
||||||
|
auto serviceData = device->getServiceData(serviceUuid);
|
||||||
|
if (!serviceData.size()) {
|
||||||
|
Log.straceln(
|
||||||
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': NOT found %s env service data"),
|
||||||
|
sensorId, sSensor.name, serviceUuid.toString().c_str()
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.straceln(
|
||||||
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found %s env service data"),
|
||||||
|
sensorId, sSensor.name, serviceUuid.toString().c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
float temperature, humidity;
|
||||||
|
uint16_t batteryMv;
|
||||||
|
uint8_t batteryLevel;
|
||||||
|
|
||||||
|
if (serviceData.size() == 13) {
|
||||||
|
// atc1441 format
|
||||||
|
|
||||||
|
// Temperature (2 bytes, big-endian)
|
||||||
|
temperature = (
|
||||||
|
(static_cast<uint8_t>(serviceData[6]) << 8) | static_cast<uint8_t>(serviceData[7])
|
||||||
|
) * 0.1f;
|
||||||
|
|
||||||
|
// Humidity (1 byte)
|
||||||
|
humidity = static_cast<uint8_t>(serviceData[8]);
|
||||||
|
|
||||||
|
// Battery mV (2 bytes, big-endian)
|
||||||
|
batteryMv = (static_cast<uint8_t>(serviceData[10]) << 8) | static_cast<uint8_t>(serviceData[11]);
|
||||||
|
|
||||||
|
// Battery level (1 byte)
|
||||||
|
batteryLevel = static_cast<uint8_t>(serviceData[9]);
|
||||||
|
|
||||||
|
} else if (serviceData.size() == 15) {
|
||||||
|
// custom pvvx format
|
||||||
|
|
||||||
|
// Temperature (2 bytes, little-endian)
|
||||||
|
temperature = (
|
||||||
|
(static_cast<uint8_t>(serviceData[7]) << 8) | static_cast<uint8_t>(serviceData[6])
|
||||||
|
) * 0.01f;
|
||||||
|
|
||||||
|
// Humidity (2 bytes, little-endian)
|
||||||
|
humidity = (
|
||||||
|
(static_cast<uint8_t>(serviceData[9]) << 8) | static_cast<uint8_t>(serviceData[8])
|
||||||
|
) * 0.01f;
|
||||||
|
|
||||||
|
// Battery mV (2 bytes, little-endian)
|
||||||
|
batteryMv = (static_cast<uint8_t>(serviceData[11]) << 8) | static_cast<uint8_t>(serviceData[10]);
|
||||||
|
|
||||||
|
// Battery level (1 byte)
|
||||||
|
batteryLevel = static_cast<uint8_t>(serviceData[12]);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// unknown format
|
||||||
|
Log.straceln(
|
||||||
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': unknown data format (size: %i)"),
|
||||||
|
sensorId, sSensor.name, serviceData.size()
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.straceln(
|
||||||
|
FPSTR(L_SENSORS_BLE),
|
||||||
|
F("Sensor #%hhu '%s', received temp: %.2f; humidity: %.2f, battery voltage: %hu, battery level: %hhu"),
|
||||||
|
sensorId, sSensor.name,
|
||||||
|
temperature, humidity, batteryMv, batteryLevel
|
||||||
|
);
|
||||||
|
|
||||||
|
// update data
|
||||||
|
Sensors::setValueById(sensorId, temperature, Sensors::ValueType::TEMPERATURE, true, true);
|
||||||
|
Sensors::setValueById(sensorId, humidity, Sensors::ValueType::HUMIDITY, true, true);
|
||||||
|
Sensors::setValueById(sensorId, batteryLevel, Sensors::ValueType::BATTERY, true, true);
|
||||||
|
|
||||||
|
// update rssi
|
||||||
|
Sensors::setValueById(sensorId, deviceRssi, Sensors::ValueType::RSSI, false, false);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -55,6 +150,10 @@ public:
|
|||||||
this->dallasSearchTime.reserve(2);
|
this->dallasSearchTime.reserve(2);
|
||||||
this->dallasPolling.reserve(2);
|
this->dallasPolling.reserve(2);
|
||||||
this->dallasLastPollingTime.reserve(2);
|
this->dallasLastPollingTime.reserve(2);
|
||||||
|
|
||||||
|
#if USE_BLE
|
||||||
|
this->pBLEScanCallbacks = new BluetoothScanCallbacks();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
~SensorsTask() {
|
~SensorsTask() {
|
||||||
@@ -63,16 +162,17 @@ public:
|
|||||||
this->dallasSearchTime.clear();
|
this->dallasSearchTime.clear();
|
||||||
this->dallasPolling.clear();
|
this->dallasPolling.clear();
|
||||||
this->dallasLastPollingTime.clear();
|
this->dallasLastPollingTime.clear();
|
||||||
|
|
||||||
|
#if USE_BLE
|
||||||
|
delete this->pBLEScanCallbacks;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const unsigned int disconnectedTimeout = 120000;
|
const unsigned int disconnectedTimeout = 180000u;
|
||||||
const unsigned short dallasSearchInterval = 60000;
|
const unsigned short dallasSearchInterval = 60000u;
|
||||||
const unsigned short dallasPollingInterval = 10000;
|
const unsigned short dallasPollingInterval = 10000u;
|
||||||
const unsigned short globalPollingInterval = 15000;
|
const unsigned short globalPollingInterval = 15000u;
|
||||||
#if USE_BLE
|
|
||||||
const unsigned int bleSetDtInterval = 7200000;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::unordered_map<uint8_t, OneWire> owInstances;
|
std::unordered_map<uint8_t, OneWire> owInstances;
|
||||||
std::unordered_map<uint8_t, DallasTemperature> dallasInstances;
|
std::unordered_map<uint8_t, DallasTemperature> dallasInstances;
|
||||||
@@ -80,9 +180,9 @@ protected:
|
|||||||
std::unordered_map<uint8_t, bool> dallasPolling;
|
std::unordered_map<uint8_t, bool> dallasPolling;
|
||||||
std::unordered_map<uint8_t, unsigned long> dallasLastPollingTime;
|
std::unordered_map<uint8_t, unsigned long> dallasLastPollingTime;
|
||||||
#if USE_BLE
|
#if USE_BLE
|
||||||
std::unordered_map<uint8_t, NimBLEClient*> bleClients;
|
NimBLEScan* pBLEScan = nullptr;
|
||||||
std::unordered_map<uint8_t, bool> bleSubscribed;
|
BluetoothScanCallbacks* pBLEScanCallbacks = nullptr;
|
||||||
std::unordered_map<uint8_t, unsigned long> bleLastSetDtTime;
|
bool activeScanBle = false;
|
||||||
#endif
|
#endif
|
||||||
unsigned long globalLastPollingTime = 0;
|
unsigned long globalLastPollingTime = 0;
|
||||||
|
|
||||||
@@ -91,6 +191,10 @@ protected:
|
|||||||
return "Sensors";
|
return "Sensors";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t getTaskStackSize() override {
|
||||||
|
return 7500;
|
||||||
|
}
|
||||||
|
|
||||||
BaseType_t getTaskCore() override {
|
BaseType_t getTaskCore() override {
|
||||||
// https://github.com/h2zero/NimBLE-Arduino/issues/676
|
// https://github.com/h2zero/NimBLE-Arduino/issues/676
|
||||||
#if USE_BLE && defined(CONFIG_BT_NIMBLE_PINNED_TO_CORE)
|
#if USE_BLE && defined(CONFIG_BT_NIMBLE_PINNED_TO_CORE)
|
||||||
@@ -131,8 +235,7 @@ protected:
|
|||||||
this->yield();
|
this->yield();
|
||||||
|
|
||||||
#if USE_BLE
|
#if USE_BLE
|
||||||
cleanBleInstances();
|
scanBleSensors();
|
||||||
pollingBleSensors();
|
|
||||||
this->yield();
|
this->yield();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -444,549 +547,71 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if USE_BLE
|
#if USE_BLE
|
||||||
void cleanBleInstances() {
|
void scanBleSensors() {
|
||||||
if (!NimBLEDevice::isInitialized()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto& [sensorId, pClient]: this->bleClients) {
|
|
||||||
if (pClient == nullptr) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
|
||||||
const auto sAddress = NimBLEAddress(sSensor.address, 0);
|
|
||||||
|
|
||||||
if (sAddress.isNull() || !sSensor.enabled || sSensor.type != Sensors::Type::BLUETOOTH || sSensor.purpose == Sensors::Purpose::NOT_CONFIGURED) {
|
|
||||||
Log.sinfoln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s', deleted unused client"),
|
|
||||||
sensorId, sSensor.name
|
|
||||||
);
|
|
||||||
|
|
||||||
NimBLEDevice::deleteClient(pClient);
|
|
||||||
pClient = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void pollingBleSensors() {
|
|
||||||
if (!Sensors::getAmountByType(Sensors::Type::BLUETOOTH, true)) {
|
if (!Sensors::getAmountByType(Sensors::Type::BLUETOOTH, true)) {
|
||||||
|
if (NimBLEDevice::isInitialized()) {
|
||||||
|
if (this->pBLEScan != nullptr) {
|
||||||
|
if (this->pBLEScan->isScanning()) {
|
||||||
|
this->pBLEScan->stop();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this->pBLEScan = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->pBLEScan == nullptr) {
|
||||||
|
if (NimBLEDevice::deinit(true)) {
|
||||||
|
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Deinitialized"));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log.swarningln(FPSTR(L_SENSORS_BLE), F("Unable to deinitialize!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NimBLEDevice::isInitialized() && millis() > 5000) {
|
if (!NimBLEDevice::isInitialized() && millis() > 5000) {
|
||||||
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Initialized"));
|
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Initialized"));
|
||||||
BLEDevice::init("");
|
NimBLEDevice::init("");
|
||||||
NimBLEDevice::setPower(9);
|
|
||||||
|
#ifdef ESP_PWR_LVL_P20
|
||||||
|
NimBLEDevice::setPower(ESP_PWR_LVL_P20);
|
||||||
|
#elifdef ESP_PWR_LVL_P9
|
||||||
|
NimBLEDevice::setPower(ESP_PWR_LVL_P9);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t sensorId = 0; sensorId <= Sensors::getMaxSensorId(); sensorId++) {
|
if (this->pBLEScan == nullptr) {
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
this->pBLEScan = NimBLEDevice::getScan();
|
||||||
auto& rSensor = Sensors::results[sensorId];
|
this->pBLEScan->setScanCallbacks(this->pBLEScanCallbacks);
|
||||||
|
#if MYNEWT_VAL(BLE_EXT_ADV)
|
||||||
if (!sSensor.enabled || sSensor.type != Sensors::Type::BLUETOOTH || sSensor.purpose == Sensors::Purpose::NOT_CONFIGURED) {
|
this->pBLEScan->setPhy(NimBLEScan::Phy::SCAN_ALL);
|
||||||
continue;
|
#endif
|
||||||
}
|
this->pBLEScan->setDuplicateFilter(false);
|
||||||
|
this->pBLEScan->setMaxResults(0);
|
||||||
|
this->pBLEScan->setInterval(10000);
|
||||||
|
this->pBLEScan->setWindow(10000);
|
||||||
|
|
||||||
const auto address = NimBLEAddress(sSensor.address, 0);
|
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Scanning initialized"));
|
||||||
if (address.isNull()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto pClient = this->getBleClient(sensorId);
|
|
||||||
if (pClient == nullptr) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pClient->getPeerAddress() != address) {
|
|
||||||
if (pClient->isConnected()) {
|
|
||||||
if (!pClient->disconnect()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pClient->setPeerAddress(address);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pClient->isConnected()) {
|
|
||||||
this->bleSubscribed[sensorId] = false;
|
|
||||||
this->bleLastSetDtTime[sensorId] = 0;
|
|
||||||
|
|
||||||
if (pClient->connect(false, true, true)) {
|
|
||||||
Log.sinfoln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': trying connecting to %s..."),
|
|
||||||
sensorId, sSensor.name, pClient->getPeerAddress().toString().c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this->bleSubscribed[sensorId]) {
|
|
||||||
if (this->subscribeToBleDevice(sensorId, pClient)) {
|
|
||||||
this->bleSubscribed[sensorId] = true;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this->bleSubscribed[sensorId] = false;
|
|
||||||
pClient->disconnect();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mark connected
|
|
||||||
Sensors::setConnectionStatusById(sensorId, true, true);
|
|
||||||
|
|
||||||
if (!this->bleLastSetDtTime[sensorId] || millis() - this->bleLastSetDtTime[sensorId] > this->bleSetDtInterval) {
|
|
||||||
struct tm ti;
|
|
||||||
|
|
||||||
if (getLocalTime(&ti)) {
|
|
||||||
if (this->setDateOnBleSensor(pClient, &ti)) {
|
|
||||||
Log.sinfoln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s', successfully set date: %02d.%02d.%04d %02d:%02d:%02d"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
ti.tm_mday, ti.tm_mon + 1, ti.tm_year + 1900, ti.tm_hour, ti.tm_min, ti.tm_sec
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s', failed set date: %02d.%02d.%04d %02d:%02d:%02d"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
ti.tm_mday, ti.tm_mon + 1, ti.tm_year + 1900, ti.tm_hour, ti.tm_min, ti.tm_sec
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->bleLastSetDtTime[sensorId] = millis();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NimBLEClient* getBleClient(const uint8_t sensorId) {
|
|
||||||
if (!NimBLEDevice::isInitialized()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
if (!this->pBLEScan->isScanning()) {
|
||||||
auto& rSensor = Sensors::results[sensorId];
|
this->activeScanBle = !this->activeScanBle;
|
||||||
|
this->pBLEScan->setActiveScan(this->activeScanBle);
|
||||||
|
|
||||||
if (!sSensor.enabled || sSensor.type != Sensors::Type::BLUETOOTH || sSensor.purpose == Sensors::Purpose::NOT_CONFIGURED) {
|
if (this->pBLEScan->start(30000, false, false)) {
|
||||||
return nullptr;
|
Log.sinfoln(
|
||||||
}
|
FPSTR(L_SENSORS_BLE),
|
||||||
|
F("%s scanning started"),
|
||||||
if (this->bleClients[sensorId] && this->bleClients[sensorId] != nullptr) {
|
this->activeScanBle ? "Active" : "Passive"
|
||||||
return this->bleClients[sensorId];
|
|
||||||
}
|
|
||||||
|
|
||||||
auto pClient = NimBLEDevice::createClient();
|
|
||||||
if (pClient == nullptr) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
//pClient->setConnectionParams(BLE_GAP_CONN_ITVL_MS(10), BLE_GAP_CONN_ITVL_MS(100), 10, 150);
|
|
||||||
pClient->setConnectTimeout(30000);
|
|
||||||
pClient->setSelfDelete(false, false);
|
|
||||||
pClient->setClientCallbacks(new BluetoothClientCallbacks(sensorId), true);
|
|
||||||
|
|
||||||
this->bleClients[sensorId] = pClient;
|
|
||||||
|
|
||||||
return pClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool subscribeToBleDevice(const uint8_t sensorId, NimBLEClient* pClient) {
|
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
|
||||||
auto pAddress = pClient->getPeerAddress().toString();
|
|
||||||
|
|
||||||
NimBLERemoteService* pService = nullptr;
|
|
||||||
NimBLERemoteCharacteristic* pChar = nullptr;
|
|
||||||
|
|
||||||
// ENV Service (0x181A)
|
|
||||||
NimBLEUUID serviceUuid((uint16_t) 0x181AU);
|
|
||||||
pService = pClient->getService(serviceUuid);
|
|
||||||
if (!pService) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to find env service (%s) on device %s"),
|
|
||||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found env service (%s) on device %s"),
|
|
||||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
// 0x2A6E - Notify temperature x0.01C (pvvx)
|
|
||||||
bool tempNotifyCreated = false;
|
|
||||||
if (!tempNotifyCreated) {
|
|
||||||
NimBLEUUID charUuid((uint16_t) 0x2A6E);
|
|
||||||
pChar = pService->getCharacteristic(charUuid);
|
|
||||||
|
|
||||||
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found temp char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
pChar->unsubscribe();
|
|
||||||
tempNotifyCreated = pChar->subscribe(
|
|
||||||
pChar->canNotify(),
|
|
||||||
[sensorId](NimBLERemoteCharacteristic* pChar, uint8_t* pData, size_t length, bool isNotify) {
|
|
||||||
if (pChar == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const NimBLERemoteService* pService = pChar->getRemoteService();
|
|
||||||
if (pService == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NimBLEClient* pClient = pService->getClient();
|
|
||||||
if (pClient == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
|
||||||
|
|
||||||
if (length != 2) {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE),
|
|
||||||
F("Sensor #%hhu '%s': invalid notification data at temp char (%s) on device %s"),
|
|
||||||
sensorId,
|
|
||||||
sSensor.name,
|
|
||||||
pChar->getUUID().toString().c_str(),
|
|
||||||
pClient->getPeerAddress().toString().c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
float rawTemp = (pChar->getValue<int16_t>() * 0.01f);
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE),
|
|
||||||
F("Sensor #%hhu '%s': received temp: %.2f"),
|
|
||||||
sensorId, sSensor.name, rawTemp
|
|
||||||
);
|
|
||||||
|
|
||||||
// set temp
|
|
||||||
Sensors::setValueById(sensorId, rawTemp, Sensors::ValueType::TEMPERATURE, true, true);
|
|
||||||
|
|
||||||
// update rssi
|
|
||||||
Sensors::setValueById(sensorId, pClient->getRssi(), Sensors::ValueType::RSSI, false, false);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (tempNotifyCreated) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to temp char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to temp char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 0x2A1F - Notify temperature x0.1C (atc1441/pvvx)
|
|
||||||
if (!tempNotifyCreated) {
|
|
||||||
NimBLEUUID charUuid((uint16_t) 0x2A1F);
|
|
||||||
pChar = pService->getCharacteristic(charUuid);
|
|
||||||
|
|
||||||
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found temp char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
pChar->unsubscribe();
|
|
||||||
tempNotifyCreated = pChar->subscribe(
|
|
||||||
pChar->canNotify(),
|
|
||||||
[sensorId](NimBLERemoteCharacteristic* pChar, uint8_t* pData, size_t length, bool isNotify) {
|
|
||||||
if (pChar == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const NimBLERemoteService* pService = pChar->getRemoteService();
|
|
||||||
if (pService == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NimBLEClient* pClient = pService->getClient();
|
|
||||||
if (pClient == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
|
||||||
|
|
||||||
if (length != 2) {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE),
|
|
||||||
F("Sensor #%hhu '%s': invalid notification data at temp char (%s) on device %s"),
|
|
||||||
sensorId,
|
|
||||||
sSensor.name,
|
|
||||||
pChar->getUUID().toString().c_str(),
|
|
||||||
pClient->getPeerAddress().toString().c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
float rawTemp = (pChar->getValue<int16_t>() * 0.1f);
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE),
|
|
||||||
F("Sensor #%hhu '%s': received temp: %.2f"),
|
|
||||||
sensorId, sSensor.name, rawTemp
|
|
||||||
);
|
|
||||||
|
|
||||||
// set temp
|
|
||||||
Sensors::setValueById(sensorId, rawTemp, Sensors::ValueType::TEMPERATURE, true, true);
|
|
||||||
|
|
||||||
// update rssi
|
|
||||||
Sensors::setValueById(sensorId, pClient->getRssi(), Sensors::ValueType::RSSI, false, false);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (tempNotifyCreated) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to temp char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to temp char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tempNotifyCreated) {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported temp chars in env service on device %s"),
|
|
||||||
sensorId, sSensor.name, pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
pClient->disconnect();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 0x2A6F - Notify about humidity x0.01% (pvvx)
|
|
||||||
{
|
|
||||||
bool humidityNotifyCreated = false;
|
|
||||||
if (!humidityNotifyCreated) {
|
|
||||||
NimBLEUUID charUuid((uint16_t) 0x2A6F);
|
|
||||||
pChar = pService->getCharacteristic(charUuid);
|
|
||||||
|
|
||||||
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found humidity char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
pChar->unsubscribe();
|
|
||||||
humidityNotifyCreated = pChar->subscribe(
|
|
||||||
pChar->canNotify(),
|
|
||||||
[sensorId](NimBLERemoteCharacteristic* pChar, uint8_t* pData, size_t length, bool isNotify) {
|
|
||||||
if (pChar == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const NimBLERemoteService* pService = pChar->getRemoteService();
|
|
||||||
if (pService == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NimBLEClient* pClient = pService->getClient();
|
|
||||||
if (pClient == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
|
||||||
|
|
||||||
if (length != 2) {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE),
|
|
||||||
F("Sensor #%hhu '%s': invalid notification data at humidity char (%s) on device %s"),
|
|
||||||
sensorId,
|
|
||||||
sSensor.name,
|
|
||||||
pChar->getUUID().toString().c_str(),
|
|
||||||
pClient->getPeerAddress().toString().c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
float rawHumidity = (pChar->getValue<uint16_t>() * 0.01f);
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE),
|
|
||||||
F("Sensor #%hhu '%s': received humidity: %.2f"),
|
|
||||||
sensorId, sSensor.name, rawHumidity
|
|
||||||
);
|
|
||||||
|
|
||||||
// set humidity
|
|
||||||
Sensors::setValueById(sensorId, rawHumidity, Sensors::ValueType::HUMIDITY, true, true);
|
|
||||||
|
|
||||||
// update rssi
|
|
||||||
Sensors::setValueById(sensorId, pClient->getRssi(), Sensors::ValueType::RSSI, false, false);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (humidityNotifyCreated) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to humidity char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to humidity char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!humidityNotifyCreated) {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported humidity chars in env service on device %s"),
|
|
||||||
sensorId, sSensor.name, pAddress.c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Battery Service (0x180F)
|
|
||||||
{
|
|
||||||
NimBLEUUID serviceUuid((uint16_t) 0x180F);
|
|
||||||
pService = pClient->getService(serviceUuid);
|
|
||||||
if (!pService) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to find battery service (%s) on device %s"),
|
|
||||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.straceln(
|
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Unable to start scanning"));
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found battery service (%s) on device %s"),
|
|
||||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
// 0x2A19 - Notify the battery charge level 0..99% (pvvx)
|
|
||||||
bool batteryNotifyCreated = false;
|
|
||||||
if (!batteryNotifyCreated) {
|
|
||||||
NimBLEUUID charUuid((uint16_t) 0x2A19);
|
|
||||||
pChar = pService->getCharacteristic(charUuid);
|
|
||||||
|
|
||||||
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found battery char (%s) in battery service on device %s"),
|
|
||||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
pChar->unsubscribe();
|
|
||||||
batteryNotifyCreated = pChar->subscribe(
|
|
||||||
pChar->canNotify(),
|
|
||||||
[sensorId](NimBLERemoteCharacteristic* pChar, uint8_t* pData, size_t length, bool isNotify) {
|
|
||||||
if (pChar == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const NimBLERemoteService* pService = pChar->getRemoteService();
|
|
||||||
if (pService == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NimBLEClient* pClient = pService->getClient();
|
|
||||||
if (pClient == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
|
||||||
|
|
||||||
if (length != 1) {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE),
|
|
||||||
F("Sensor #%hhu '%s': invalid notification data at battery char (%s) on device %s"),
|
|
||||||
sensorId,
|
|
||||||
sSensor.name,
|
|
||||||
pChar->getUUID().toString().c_str(),
|
|
||||||
pClient->getPeerAddress().toString().c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto rawBattery = pChar->getValue<uint8_t>();
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE),
|
|
||||||
F("Sensor #%hhu '%s': received battery: %hhu"),
|
|
||||||
sensorId, sSensor.name, rawBattery
|
|
||||||
);
|
|
||||||
|
|
||||||
// set battery
|
|
||||||
Sensors::setValueById(sensorId, rawBattery, Sensors::ValueType::BATTERY, true, true);
|
|
||||||
|
|
||||||
// update rssi
|
|
||||||
Sensors::setValueById(sensorId, pClient->getRssi(), Sensors::ValueType::RSSI, false, false);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (batteryNotifyCreated) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to battery char (%s) in battery service on device %s"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to battery char (%s) in battery service on device %s"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!batteryNotifyCreated) {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported battery chars in battery service on device %s"),
|
|
||||||
sensorId, sSensor.name, pAddress.c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setDateOnBleSensor(NimBLEClient* pClient, const struct tm *ptm) {
|
|
||||||
auto ts = mkgmtime(ptm);
|
|
||||||
|
|
||||||
uint8_t data[5] = {};
|
|
||||||
data[0] = 0x23;
|
|
||||||
data[1] = ts & 0xff;
|
|
||||||
data[2] = (ts >> 8) & 0xff;
|
|
||||||
data[3] = (ts >> 16) & 0xff;
|
|
||||||
data[4] = (ts >> 24) & 0xff;
|
|
||||||
|
|
||||||
return pClient->setValue(
|
|
||||||
NimBLEUUID((uint16_t) 0x1f10),
|
|
||||||
NimBLEUUID((uint16_t) 0x1f1f),
|
|
||||||
NimBLEAttValue(data, sizeof(data))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -78,8 +78,7 @@ struct Settings {
|
|||||||
bool autoFaultReset = false;
|
bool autoFaultReset = false;
|
||||||
bool autoDiagReset = false;
|
bool autoDiagReset = false;
|
||||||
bool setDateAndTime = false;
|
bool setDateAndTime = false;
|
||||||
bool alwaysSendIndoorTemp = true;
|
bool nativeHeatingControl = false;
|
||||||
bool nativeOTC = false;
|
|
||||||
bool immergasFix = false;
|
bool immergasFix = false;
|
||||||
} options;
|
} options;
|
||||||
} opentherm;
|
} opentherm;
|
||||||
@@ -104,17 +103,12 @@ 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;
|
||||||
@@ -160,10 +154,9 @@ struct Settings {
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
float slope = 0.7f;
|
float n_factor = 0.7f;
|
||||||
float exponent = 1.3f;
|
float k_factor = 3.0f;
|
||||||
float shift = 0.0f;
|
float t_factor = 2.0f;
|
||||||
float targetDiffFactor = 2.0f;
|
|
||||||
} equitherm;
|
} equitherm;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@@ -389,7 +382,6 @@ struct Variables {
|
|||||||
uint16_t dhwBurnerStarts = 0;
|
uint16_t dhwBurnerStarts = 0;
|
||||||
uint16_t heatingPumpStarts = 0;
|
uint16_t heatingPumpStarts = 0;
|
||||||
uint16_t dhwPumpStarts = 0;
|
uint16_t dhwPumpStarts = 0;
|
||||||
uint16_t coolingHours = 0;
|
|
||||||
uint16_t burnerHours = 0;
|
uint16_t burnerHours = 0;
|
||||||
uint16_t dhwBurnerHours = 0;
|
uint16_t dhwBurnerHours = 0;
|
||||||
uint16_t heatingPumpHours = 0;
|
uint16_t heatingPumpHours = 0;
|
||||||
|
|||||||
@@ -163,9 +163,4 @@ 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];
|
||||||
@@ -1,6 +1,3 @@
|
|||||||
#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>
|
||||||
@@ -216,7 +213,7 @@ void setup() {
|
|||||||
tRegulator = new RegulatorTask(true, 10000);
|
tRegulator = new RegulatorTask(true, 10000);
|
||||||
Scheduler.start(tRegulator);
|
Scheduler.start(tRegulator);
|
||||||
|
|
||||||
tPortal = new PortalTask(true, 0);
|
tPortal = new PortalTask(true, 10);
|
||||||
Scheduler.start(tPortal);
|
Scheduler.start(tPortal);
|
||||||
|
|
||||||
tMain = new MainTask(true, 100);
|
tMain = new MainTask(true, 100);
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ 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";
|
||||||
@@ -82,7 +81,6 @@ const char S_ENABLED[] PROGMEM = "enabled";
|
|||||||
const char S_ENV[] PROGMEM = "env";
|
const char S_ENV[] PROGMEM = "env";
|
||||||
const char S_EPC[] PROGMEM = "epc";
|
const char S_EPC[] PROGMEM = "epc";
|
||||||
const char S_EQUITHERM[] PROGMEM = "equitherm";
|
const char S_EQUITHERM[] PROGMEM = "equitherm";
|
||||||
const char S_EXPONENT[] PROGMEM = "exponent";
|
|
||||||
const char S_EXTERNAL_PUMP[] PROGMEM = "externalPump";
|
const char S_EXTERNAL_PUMP[] PROGMEM = "externalPump";
|
||||||
const char S_FACTOR[] PROGMEM = "factor";
|
const char S_FACTOR[] PROGMEM = "factor";
|
||||||
const char S_FAULT[] PROGMEM = "fault";
|
const char S_FAULT[] PROGMEM = "fault";
|
||||||
@@ -110,7 +108,6 @@ const char S_HYSTERESIS[] PROGMEM = "hysteresis";
|
|||||||
const char S_ID[] PROGMEM = "id";
|
const char S_ID[] PROGMEM = "id";
|
||||||
const char S_IGNORE_DIAG_STATE[] PROGMEM = "ignoreDiagState";
|
const char S_IGNORE_DIAG_STATE[] PROGMEM = "ignoreDiagState";
|
||||||
const char S_IMMERGAS_FIX[] PROGMEM = "immergasFix";
|
const char S_IMMERGAS_FIX[] PROGMEM = "immergasFix";
|
||||||
const char S_ALWAYS_SEND_INDOOR_TEMP[] PROGMEM = "alwaysSendIndoorTemp";
|
|
||||||
const char S_INDOOR_TEMP[] PROGMEM = "indoorTemp";
|
const char S_INDOOR_TEMP[] PROGMEM = "indoorTemp";
|
||||||
const char S_INDOOR_TEMP_CONTROL[] PROGMEM = "indoorTempControl";
|
const char S_INDOOR_TEMP_CONTROL[] PROGMEM = "indoorTempControl";
|
||||||
const char S_IN_GPIO[] PROGMEM = "inGpio";
|
const char S_IN_GPIO[] PROGMEM = "inGpio";
|
||||||
@@ -120,6 +117,7 @@ const char S_INVERT_STATE[] PROGMEM = "invertState";
|
|||||||
const char S_IP[] PROGMEM = "ip";
|
const char S_IP[] PROGMEM = "ip";
|
||||||
const char S_I_FACTOR[] PROGMEM = "i_factor";
|
const char S_I_FACTOR[] PROGMEM = "i_factor";
|
||||||
const char S_I_MULTIPLIER[] PROGMEM = "i_multiplier";
|
const char S_I_MULTIPLIER[] PROGMEM = "i_multiplier";
|
||||||
|
const char S_K_FACTOR[] PROGMEM = "k_factor";
|
||||||
const char S_LOGIN[] PROGMEM = "login";
|
const char S_LOGIN[] PROGMEM = "login";
|
||||||
const char S_LOG_LEVEL[] PROGMEM = "logLevel";
|
const char S_LOG_LEVEL[] PROGMEM = "logLevel";
|
||||||
const char S_LOW_TEMP[] PROGMEM = "lowTemp";
|
const char S_LOW_TEMP[] PROGMEM = "lowTemp";
|
||||||
@@ -142,9 +140,10 @@ const char S_MODEL[] PROGMEM = "model";
|
|||||||
const char S_MODULATION[] PROGMEM = "modulation";
|
const char S_MODULATION[] PROGMEM = "modulation";
|
||||||
const char S_MQTT[] PROGMEM = "mqtt";
|
const char S_MQTT[] PROGMEM = "mqtt";
|
||||||
const char S_NAME[] PROGMEM = "name";
|
const char S_NAME[] PROGMEM = "name";
|
||||||
const char S_NATIVE_OTC[] PROGMEM = "nativeOTC";
|
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";
|
||||||
@@ -165,6 +164,7 @@ 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,11 +183,9 @@ const char S_SERIAL[] PROGMEM = "serial";
|
|||||||
const char S_SERVER[] PROGMEM = "server";
|
const char S_SERVER[] PROGMEM = "server";
|
||||||
const char S_SETTINGS[] PROGMEM = "settings";
|
const char S_SETTINGS[] PROGMEM = "settings";
|
||||||
const char S_SET_DATE_AND_TIME[] PROGMEM = "setDateAndTime";
|
const char S_SET_DATE_AND_TIME[] PROGMEM = "setDateAndTime";
|
||||||
const char S_SHIFT[] PROGMEM = "shift";
|
|
||||||
const char S_SIGNAL_QUALITY[] PROGMEM = "signalQuality";
|
const char S_SIGNAL_QUALITY[] PROGMEM = "signalQuality";
|
||||||
const char S_SIZE[] PROGMEM = "size";
|
const char S_SIZE[] PROGMEM = "size";
|
||||||
const char S_SLAVE[] PROGMEM = "slave";
|
const char S_SLAVE[] PROGMEM = "slave";
|
||||||
const char S_SLOPE[] PROGMEM = "slope";
|
|
||||||
const char S_SSID[] PROGMEM = "ssid";
|
const char S_SSID[] PROGMEM = "ssid";
|
||||||
const char S_STA[] PROGMEM = "sta";
|
const char S_STA[] PROGMEM = "sta";
|
||||||
const char S_STATE[] PROGMEM = "state";
|
const char S_STATE[] PROGMEM = "state";
|
||||||
@@ -199,7 +197,6 @@ const char S_SUBNET[] PROGMEM = "subnet";
|
|||||||
const char S_SUMMER_WINTER_MODE[] PROGMEM = "summerWinterMode";
|
const char S_SUMMER_WINTER_MODE[] PROGMEM = "summerWinterMode";
|
||||||
const char S_SYSTEM[] PROGMEM = "system";
|
const char S_SYSTEM[] PROGMEM = "system";
|
||||||
const char S_TARGET[] PROGMEM = "target";
|
const char S_TARGET[] PROGMEM = "target";
|
||||||
const char S_TARGET_DIFF_FACTOR[] PROGMEM = "targetDiffFactor";
|
|
||||||
const char S_TARGET_TEMP[] PROGMEM = "targetTemp";
|
const char S_TARGET_TEMP[] PROGMEM = "targetTemp";
|
||||||
const char S_TELNET[] PROGMEM = "telnet";
|
const char S_TELNET[] PROGMEM = "telnet";
|
||||||
const char S_TEMPERATURE[] PROGMEM = "temperature";
|
const char S_TEMPERATURE[] PROGMEM = "temperature";
|
||||||
@@ -212,6 +209,7 @@ const char S_TRESHOLD_TIME[] PROGMEM = "tresholdTime";
|
|||||||
const char S_TURBO[] PROGMEM = "turbo";
|
const char S_TURBO[] PROGMEM = "turbo";
|
||||||
const char S_TURBO_FACTOR[] PROGMEM = "turboFactor";
|
const char S_TURBO_FACTOR[] PROGMEM = "turboFactor";
|
||||||
const char S_TYPE[] PROGMEM = "type";
|
const char S_TYPE[] PROGMEM = "type";
|
||||||
|
const char S_T_FACTOR[] PROGMEM = "t_factor";
|
||||||
const char S_UNIT_SYSTEM[] PROGMEM = "unitSystem";
|
const char S_UNIT_SYSTEM[] PROGMEM = "unitSystem";
|
||||||
const char S_UPTIME[] PROGMEM = "uptime";
|
const char S_UPTIME[] PROGMEM = "uptime";
|
||||||
const char S_USE[] PROGMEM = "use";
|
const char S_USE[] PROGMEM = "use";
|
||||||
|
|||||||
111
src/utils.h
111
src/utils.h
@@ -468,10 +468,8 @@ 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_SEND_INDOOR_TEMP)] = src.opentherm.options.alwaysSendIndoorTemp;
|
otOptions[FPSTR(S_NATIVE_HEATING_CONTROL)] = src.opentherm.options.nativeHeatingControl;
|
||||||
otOptions[FPSTR(S_NATIVE_OTC)] = src.opentherm.options.nativeOTC;
|
|
||||||
otOptions[FPSTR(S_IMMERGAS_FIX)] = src.opentherm.options.immergasFix;
|
otOptions[FPSTR(S_IMMERGAS_FIX)] = src.opentherm.options.immergasFix;
|
||||||
|
|
||||||
|
|
||||||
auto mqtt = dst[FPSTR(S_MQTT)].to<JsonObject>();
|
auto mqtt = dst[FPSTR(S_MQTT)].to<JsonObject>();
|
||||||
mqtt[FPSTR(S_ENABLED)] = src.mqtt.enabled;
|
mqtt[FPSTR(S_ENABLED)] = src.mqtt.enabled;
|
||||||
@@ -492,9 +490,7 @@ 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)][FPSTR(S_ENABLED)] = src.heating.hysteresis.enabled;
|
heating[FPSTR(S_HYSTERESIS)] = roundf(src.heating.hysteresis, 3);
|
||||||
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;
|
||||||
@@ -521,10 +517,9 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
|
|||||||
|
|
||||||
auto equitherm = dst[FPSTR(S_EQUITHERM)].to<JsonObject>();
|
auto equitherm = dst[FPSTR(S_EQUITHERM)].to<JsonObject>();
|
||||||
equitherm[FPSTR(S_ENABLED)] = src.equitherm.enabled;
|
equitherm[FPSTR(S_ENABLED)] = src.equitherm.enabled;
|
||||||
equitherm[FPSTR(S_SLOPE)] = roundf(src.equitherm.slope, 3);
|
equitherm[FPSTR(S_N_FACTOR)] = roundf(src.equitherm.n_factor, 3);
|
||||||
equitherm[FPSTR(S_EXPONENT)] = roundf(src.equitherm.exponent, 3);
|
equitherm[FPSTR(S_K_FACTOR)] = roundf(src.equitherm.k_factor, 3);
|
||||||
equitherm[FPSTR(S_SHIFT)] = roundf(src.equitherm.shift, 2);
|
equitherm[FPSTR(S_T_FACTOR)] = roundf(src.equitherm.t_factor, 3);
|
||||||
equitherm[FPSTR(S_TARGET_DIFF_FACTOR)] = roundf(src.equitherm.targetDiffFactor, 3);
|
|
||||||
|
|
||||||
auto pid = dst[FPSTR(S_PID)].to<JsonObject>();
|
auto pid = dst[FPSTR(S_PID)].to<JsonObject>();
|
||||||
pid[FPSTR(S_ENABLED)] = src.pid.enabled;
|
pid[FPSTR(S_ENABLED)] = src.pid.enabled;
|
||||||
@@ -1005,20 +1000,11 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_ALWAYS_SEND_INDOOR_TEMP)].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_ALWAYS_SEND_INDOOR_TEMP)].as<bool>();
|
bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_NATIVE_HEATING_CONTROL)].as<bool>();
|
||||||
|
|
||||||
if (value != dst.opentherm.options.alwaysSendIndoorTemp) {
|
if (value != dst.opentherm.options.nativeHeatingControl) {
|
||||||
dst.opentherm.options.alwaysSendIndoorTemp = value;
|
dst.opentherm.options.nativeHeatingControl = value;
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_NATIVE_OTC)].is<bool>()) {
|
|
||||||
bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_NATIVE_OTC)].as<bool>();
|
|
||||||
|
|
||||||
if (value != dst.opentherm.options.nativeOTC) {
|
|
||||||
dst.opentherm.options.nativeOTC = value;
|
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
dst.equitherm.enabled = false;
|
dst.equitherm.enabled = false;
|
||||||
@@ -1038,6 +1024,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// mqtt
|
// mqtt
|
||||||
if (src[FPSTR(S_MQTT)][FPSTR(S_ENABLED)].is<bool>()) {
|
if (src[FPSTR(S_MQTT)][FPSTR(S_ENABLED)].is<bool>()) {
|
||||||
bool value = src[FPSTR(S_MQTT)][FPSTR(S_ENABLED)].as<bool>();
|
bool value = src[FPSTR(S_MQTT)][FPSTR(S_ENABLED)].as<bool>();
|
||||||
@@ -1128,7 +1115,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
if (src[FPSTR(S_EQUITHERM)][FPSTR(S_ENABLED)].is<bool>()) {
|
if (src[FPSTR(S_EQUITHERM)][FPSTR(S_ENABLED)].is<bool>()) {
|
||||||
bool value = src[FPSTR(S_EQUITHERM)][FPSTR(S_ENABLED)].as<bool>();
|
bool value = src[FPSTR(S_EQUITHERM)][FPSTR(S_ENABLED)].as<bool>();
|
||||||
|
|
||||||
if (!dst.opentherm.options.nativeOTC) {
|
if (!dst.opentherm.options.nativeHeatingControl) {
|
||||||
if (value != dst.equitherm.enabled) {
|
if (value != dst.equitherm.enabled) {
|
||||||
dst.equitherm.enabled = value;
|
dst.equitherm.enabled = value;
|
||||||
changed = true;
|
changed = true;
|
||||||
@@ -1140,38 +1127,29 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_SLOPE)].isNull()) {
|
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_N_FACTOR)].isNull()) {
|
||||||
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_SLOPE)].as<float>();
|
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_N_FACTOR)].as<float>();
|
||||||
|
|
||||||
if (value > 0.0f && value <= 10.0f && fabsf(value - dst.equitherm.slope) > 0.0001f) {
|
if (value > 0 && value <= 10 && fabsf(value - dst.equitherm.n_factor) > 0.0001f) {
|
||||||
dst.equitherm.slope = roundf(value, 3);
|
dst.equitherm.n_factor = roundf(value, 3);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_EXPONENT)].isNull()) {
|
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_K_FACTOR)].isNull()) {
|
||||||
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_EXPONENT)].as<float>();
|
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_K_FACTOR)].as<float>();
|
||||||
|
|
||||||
if (value > 0.0f && value <= 2.0f && fabsf(value - dst.equitherm.exponent) > 0.0001f) {
|
if (value >= 0 && value <= 10 && fabsf(value - dst.equitherm.k_factor) > 0.0001f) {
|
||||||
dst.equitherm.exponent = roundf(value, 3);
|
dst.equitherm.k_factor = roundf(value, 3);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_SHIFT)].isNull()) {
|
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_T_FACTOR)].isNull()) {
|
||||||
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_SHIFT)].as<float>();
|
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_T_FACTOR)].as<float>();
|
||||||
|
|
||||||
if (value >= -15.0f && value <= 15.0f && fabsf(value - dst.equitherm.shift) > 0.0001f) {
|
if (value >= 0 && value <= 10 && fabsf(value - dst.equitherm.t_factor) > 0.0001f) {
|
||||||
dst.equitherm.shift = roundf(value, 2);
|
dst.equitherm.t_factor = roundf(value, 3);
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!src[FPSTR(S_EQUITHERM)][FPSTR(S_TARGET_DIFF_FACTOR)].isNull()) {
|
|
||||||
float value = src[FPSTR(S_EQUITHERM)][FPSTR(S_TARGET_DIFF_FACTOR)].as<float>();
|
|
||||||
|
|
||||||
if (value >= 0.0f && value <= 10.0f && fabsf(value - dst.equitherm.targetDiffFactor) > 0.0001f) {
|
|
||||||
dst.equitherm.targetDiffFactor = roundf(value, 3);
|
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1181,7 +1159,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
if (src[FPSTR(S_PID)][FPSTR(S_ENABLED)].is<bool>()) {
|
if (src[FPSTR(S_PID)][FPSTR(S_ENABLED)].is<bool>()) {
|
||||||
bool value = src[FPSTR(S_PID)][FPSTR(S_ENABLED)].as<bool>();
|
bool value = src[FPSTR(S_PID)][FPSTR(S_ENABLED)].as<bool>();
|
||||||
|
|
||||||
if (!dst.opentherm.options.nativeOTC) {
|
if (!dst.opentherm.options.nativeHeatingControl) {
|
||||||
if (value != dst.pid.enabled) {
|
if (value != dst.pid.enabled) {
|
||||||
dst.pid.enabled = value;
|
dst.pid.enabled = value;
|
||||||
changed = true;
|
changed = true;
|
||||||
@@ -1326,41 +1304,15 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_ENABLED)].is<bool>()) {
|
if (!src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)].isNull()) {
|
||||||
bool value = src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_ENABLED)].as<bool>();
|
float value = src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)].as<float>();
|
||||||
|
|
||||||
if (value != dst.heating.hysteresis.enabled) {
|
if (value >= 0.0f && value <= 15.0f && fabsf(value - dst.heating.hysteresis) > 0.0001f) {
|
||||||
dst.heating.hysteresis.enabled = value;
|
dst.heating.hysteresis = roundf(value, 2);
|
||||||
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>();
|
||||||
|
|
||||||
@@ -1714,7 +1666,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
// force check emergency target
|
// force check emergency target
|
||||||
{
|
{
|
||||||
float value = !src[FPSTR(S_EMERGENCY)][FPSTR(S_TARGET)].isNull() ? src[FPSTR(S_EMERGENCY)][FPSTR(S_TARGET)].as<float>() : dst.emergency.target;
|
float value = !src[FPSTR(S_EMERGENCY)][FPSTR(S_TARGET)].isNull() ? src[FPSTR(S_EMERGENCY)][FPSTR(S_TARGET)].as<float>() : dst.emergency.target;
|
||||||
bool noRegulators = !dst.opentherm.options.nativeOTC;
|
bool noRegulators = !dst.opentherm.options.nativeHeatingControl;
|
||||||
bool valid = isValidTemp(
|
bool valid = isValidTemp(
|
||||||
value,
|
value,
|
||||||
dst.system.unitSystem,
|
dst.system.unitSystem,
|
||||||
@@ -1739,7 +1691,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
|
|
||||||
// force check heating target
|
// force check heating target
|
||||||
{
|
{
|
||||||
bool indoorTempControl = dst.equitherm.enabled || dst.pid.enabled || dst.opentherm.options.nativeOTC;
|
bool indoorTempControl = dst.equitherm.enabled || dst.pid.enabled || dst.opentherm.options.nativeHeatingControl;
|
||||||
float minTemp = indoorTempControl ? THERMOSTAT_INDOOR_MIN_TEMP : dst.heating.minTemp;
|
float minTemp = indoorTempControl ? THERMOSTAT_INDOOR_MIN_TEMP : dst.heating.minTemp;
|
||||||
float maxTemp = indoorTempControl ? THERMOSTAT_INDOOR_MAX_TEMP : dst.heating.maxTemp;
|
float maxTemp = indoorTempControl ? THERMOSTAT_INDOOR_MAX_TEMP : dst.heating.maxTemp;
|
||||||
|
|
||||||
@@ -1932,7 +1884,6 @@ bool jsonToSensorSettings(const uint8_t sensorId, const JsonVariantConst src, Se
|
|||||||
case static_cast<uint8_t>(Sensors::Type::OT_DHW_BURNER_HOURS):
|
case static_cast<uint8_t>(Sensors::Type::OT_DHW_BURNER_HOURS):
|
||||||
case static_cast<uint8_t>(Sensors::Type::OT_HEATING_PUMP_HOURS):
|
case static_cast<uint8_t>(Sensors::Type::OT_HEATING_PUMP_HOURS):
|
||||||
case static_cast<uint8_t>(Sensors::Type::OT_DHW_PUMP_HOURS):
|
case static_cast<uint8_t>(Sensors::Type::OT_DHW_PUMP_HOURS):
|
||||||
case static_cast<uint8_t>(Sensors::Type::OT_COOLING_HOURS):
|
|
||||||
|
|
||||||
case static_cast<uint8_t>(Sensors::Type::NTC_10K_TEMP):
|
case static_cast<uint8_t>(Sensors::Type::NTC_10K_TEMP):
|
||||||
case static_cast<uint8_t>(Sensors::Type::DALLAS_TEMP):
|
case static_cast<uint8_t>(Sensors::Type::DALLAS_TEMP):
|
||||||
@@ -2132,7 +2083,7 @@ void varsToJson(const Variables& src, JsonVariant dst) {
|
|||||||
slave[FPSTR(S_FLAGS)] = src.slave.flags;
|
slave[FPSTR(S_FLAGS)] = src.slave.flags;
|
||||||
slave[FPSTR(S_TYPE)] = src.slave.type;
|
slave[FPSTR(S_TYPE)] = src.slave.type;
|
||||||
slave[FPSTR(S_APP_VERSION)] = src.slave.appVersion;
|
slave[FPSTR(S_APP_VERSION)] = src.slave.appVersion;
|
||||||
slave[FPSTR(S_PROTOCOL_VERSION)] = src.slave.protocolVersion;
|
slave[FPSTR(S_PROTOCOL_VERSION)] = src.slave.appVersion;
|
||||||
slave[FPSTR(S_CONNECTED)] = src.slave.connected;
|
slave[FPSTR(S_CONNECTED)] = src.slave.connected;
|
||||||
slave[FPSTR(S_FLAME)] = src.slave.flame;
|
slave[FPSTR(S_FLAME)] = src.slave.flame;
|
||||||
|
|
||||||
|
|||||||
@@ -243,7 +243,6 @@
|
|||||||
"otDhwBurnerHours": "OpenTherm, number of burner operating hours (DHW)",
|
"otDhwBurnerHours": "OpenTherm, number of burner operating hours (DHW)",
|
||||||
"otHeatingPumpHours": "OpenTherm, number of pump operating hours (heating)",
|
"otHeatingPumpHours": "OpenTherm, number of pump operating hours (heating)",
|
||||||
"otDhwPumpHours": "OpenTherm, number of pump operating hours (DHW)",
|
"otDhwPumpHours": "OpenTherm, number of pump operating hours (DHW)",
|
||||||
"otCoolingHours": "OpenTherm, number of cooling hours",
|
|
||||||
|
|
||||||
"ntcTemp": "NTC 传感器",
|
"ntcTemp": "NTC 传感器",
|
||||||
"dallasTemp": "DALLAS 传感器",
|
"dallasTemp": "DALLAS 传感器",
|
||||||
@@ -357,16 +356,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"heating": {
|
"heating": {
|
||||||
"hyst": {
|
"hyst": "滞后值<small>(单位:度)</small>",
|
||||||
"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 模式系数"
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -381,26 +371,11 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"equitherm": {
|
"equitherm": {
|
||||||
"slope": {
|
"n": "N 系数",
|
||||||
"title": "斜率",
|
"k": "K 系数",
|
||||||
"note": "热损失补偿。主要调谐参数。"
|
"t": {
|
||||||
},
|
"title": "T 系数",
|
||||||
"exponent": {
|
"note": "启用PID时此参数无效"
|
||||||
"title": "指数",
|
|
||||||
"note": "散热器效率。典型值:<code>1.1</code> - 地板采暖,<code>1.2</code> - 铸铁,<code>1.3</code> - 面板散热器,<code>1.4</code> - 对流器。"
|
|
||||||
},
|
|
||||||
"shift": {
|
|
||||||
"title": "偏移",
|
|
||||||
"note": "补偿额外热损失(例如,在管道中)或额外热源。"
|
|
||||||
},
|
|
||||||
"targetDiffFactor": {
|
|
||||||
"title": "T 因子",
|
|
||||||
"note": "如果启用 PID,则不使用。将目标和当前室内温度之间的差值添加到设定点:<code>setpoint = setpoint + ((target - indoor) * T)</code>。"
|
|
||||||
},
|
|
||||||
"chart": {
|
|
||||||
"targetTemp": "目标室内温度",
|
|
||||||
"setpointTemp": "热载体温度",
|
|
||||||
"outdoorTemp": "室外温度"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -458,13 +433,12 @@
|
|||||||
"autoFaultReset": "自动报警复位 <small>(不推荐!)</small>",
|
"autoFaultReset": "自动报警复位 <small>(不推荐!)</small>",
|
||||||
"autoDiagReset": "自动诊断复位 <small>(不推荐!)</small>",
|
"autoDiagReset": "自动诊断复位 <small>(不推荐!)</small>",
|
||||||
"setDateAndTime": "同步设置锅炉日期与时间",
|
"setDateAndTime": "同步设置锅炉日期与时间",
|
||||||
"immergasFix": "针对Immergas锅炉的兼容性修复",
|
"immergasFix": "针对Immergas锅炉的兼容性修复"
|
||||||
"alwaysSendIndoorTemp": "向锅炉发送当前室内温度"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"nativeOTC": {
|
"nativeHeating": {
|
||||||
"title": "原生热载体温度计算模式",
|
"title": "原生锅炉供暖控制",
|
||||||
"note": "仅在锅炉处于 OTC 模式时<u>才</u>工作:需要并接受目标室内温度,并基于内置曲线模式自行调节热载体温度。与 PID 和 Equitherm 不兼容。"
|
"note": "<u>注意:</u> 仅适用于锅炉需接收目标室温并自主调节载热介质温度的场景,与固件中的PID及Equithermq气候补偿功能不兼容。"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -243,7 +243,6 @@
|
|||||||
"otDhwBurnerHours": "OpenTherm, number of burner operating hours (DHW)",
|
"otDhwBurnerHours": "OpenTherm, number of burner operating hours (DHW)",
|
||||||
"otHeatingPumpHours": "OpenTherm, number of pump operating hours (heating)",
|
"otHeatingPumpHours": "OpenTherm, number of pump operating hours (heating)",
|
||||||
"otDhwPumpHours": "OpenTherm, number of pump operating hours (DHW)",
|
"otDhwPumpHours": "OpenTherm, number of pump operating hours (DHW)",
|
||||||
"otCoolingHours": "OpenTherm, number of cooling hours",
|
|
||||||
|
|
||||||
"ntcTemp": "NTC sensor",
|
"ntcTemp": "NTC sensor",
|
||||||
"dallasTemp": "DALLAS sensor",
|
"dallasTemp": "DALLAS sensor",
|
||||||
@@ -357,16 +356,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"heating": {
|
"heating": {
|
||||||
"hyst": {
|
"hyst": "Hysteresis <small>(in degrees)</small>",
|
||||||
"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."
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -381,26 +371,11 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"equitherm": {
|
"equitherm": {
|
||||||
"slope": {
|
"n": "N factor",
|
||||||
"title": "Slope",
|
"k": "K factor",
|
||||||
"note": "Heat loss compensation. Main tuning parameter."
|
"t": {
|
||||||
},
|
|
||||||
"exponent": {
|
|
||||||
"title": "Exponent",
|
|
||||||
"note": "Radiator efficiency. Typical values: <code>1.1</code> - Floor heating, <code>1.2</code> - Cast iron, <code>1.3</code> - Panel radiators, <code>1.4</code> - Convectors."
|
|
||||||
},
|
|
||||||
"shift": {
|
|
||||||
"title": "Shift",
|
|
||||||
"note": "Compensates for additional heat losses (e.g., in pipes) or extra heat sources."
|
|
||||||
},
|
|
||||||
"targetDiffFactor": {
|
|
||||||
"title": "T factor",
|
"title": "T factor",
|
||||||
"note": "Not used if PID is enabled. Adds to the setpoint the difference between the target and current indoor temp: <code>setpoint = setpoint + ((target - indoor) * T)</code>."
|
"note": "Not used if PID is enabled"
|
||||||
},
|
|
||||||
"chart": {
|
|
||||||
"targetTemp": "Target indoor temperature",
|
|
||||||
"setpointTemp": "Heat carrier temperature",
|
|
||||||
"outdoorTemp": "Outdoor temperature"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -458,13 +433,12 @@
|
|||||||
"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",
|
||||||
"immergasFix": "Fix for Immergas boilers",
|
"immergasFix": "Fix for Immergas boilers"
|
||||||
"alwaysSendIndoorTemp": "Send current indoor temp to boiler"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"nativeOTC": {
|
"nativeHeating": {
|
||||||
"title": "Native OTC mode",
|
"title": "Native heating control (boiler)",
|
||||||
"note": "Works <u>ONLY</u> if the boiler is in OTC mode: requires and accepts the target indoor temperature and self-regulates the heat carrier temperature based on the built-in curves mode. Incompatible with PID and Equitherm."
|
"note": "Works <u>ONLY</u> if the boiler requires the desired room temperature and regulates the temperature of the coolant itself. Not compatible with PID and Equitherm regulators in firmware."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -243,7 +243,6 @@
|
|||||||
"otDhwBurnerHours": "OpenTherm, numero di ore di funzionamento del bruciatore (ACS)",
|
"otDhwBurnerHours": "OpenTherm, numero di ore di funzionamento del bruciatore (ACS)",
|
||||||
"otHeatingPumpHours": "OpenTherm, numero di ore di funzionamento della pompa (riscaldamento)",
|
"otHeatingPumpHours": "OpenTherm, numero di ore di funzionamento della pompa (riscaldamento)",
|
||||||
"otDhwPumpHours": "OpenTherm, numero di ore di funzionamento della pompa (ACS)",
|
"otDhwPumpHours": "OpenTherm, numero di ore di funzionamento della pompa (ACS)",
|
||||||
"otCoolingHours": "OpenTherm, numero di ore di funzionamento della cooling",
|
|
||||||
|
|
||||||
"ntcTemp": "Sensore NTC",
|
"ntcTemp": "Sensore NTC",
|
||||||
"dallasTemp": "Sensore DALLAS",
|
"dallasTemp": "Sensore DALLAS",
|
||||||
@@ -357,16 +356,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"heating": {
|
"heating": {
|
||||||
"hyst": {
|
"hyst": "Isteresi <small>(in gradi)</small>",
|
||||||
"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."
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -381,26 +371,11 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"equitherm": {
|
"equitherm": {
|
||||||
"slope": {
|
"n": "Fattore N",
|
||||||
"title": "Pendenza",
|
"k": "Fattore K",
|
||||||
"note": "Compensazione della perdita di calore. Parametro di regolazione principale."
|
"t": {
|
||||||
},
|
|
||||||
"exponent": {
|
|
||||||
"title": "Esponente",
|
|
||||||
"note": "Efficienza del radiatore. Valori tipici: <code>1.1</code> - Riscaldamento a pavimento, <code>1.2</code> - Ghisa, <code>1.3</code> - Radiatori a pannello, <code>1.4</code> - Convettori."
|
|
||||||
},
|
|
||||||
"shift": {
|
|
||||||
"title": "Spostamento",
|
|
||||||
"note": "Compensa perdite di calore aggiuntive (ad es., nelle tubature) o fonti di calore extra."
|
|
||||||
},
|
|
||||||
"targetDiffFactor": {
|
|
||||||
"title": "Fattore T",
|
"title": "Fattore T",
|
||||||
"note": "Non utilizzato se PID è abilitato. Aggiunge al setpoint la differenza tra la temperatura target e quella interna attuale: <code>setpoint = setpoint + ((target - indoor) * T)</code>."
|
"note": "Non usato se PID è attivato"
|
||||||
},
|
|
||||||
"chart": {
|
|
||||||
"targetTemp": "Temperatura interna target",
|
|
||||||
"setpointTemp": "Temperatura del vettore termico",
|
|
||||||
"outdoorTemp": "Temperatura esterna"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -458,13 +433,12 @@
|
|||||||
"autoFaultReset": "Ripristino automatico degli errori <small>(sconsigliato!)</small>",
|
"autoFaultReset": "Ripristino automatico degli errori <small>(sconsigliato!)</small>",
|
||||||
"autoDiagReset": "Ripristino diagnostico automatica <small>(sconsigliato!)</small>",
|
"autoDiagReset": "Ripristino diagnostico automatica <small>(sconsigliato!)</small>",
|
||||||
"setDateAndTime": "Imposta data e ora sulla caldaia",
|
"setDateAndTime": "Imposta data e ora sulla caldaia",
|
||||||
"immergasFix": "Fix per caldiaie Immergas",
|
"immergasFix": "Fix per caldiaie Immergas"
|
||||||
"alwaysSendIndoorTemp": "Invia la temp attuale interna alla caldaia"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"nativeOTC": {
|
"nativeHeating": {
|
||||||
"title": "Modalità nativa di calcolo della temperatura del vettore termico",
|
"title": "Controllo del riscaldamento nativo (caldaia)",
|
||||||
"note": "Funziona <u>SOLO</u> se la caldaia è in modalità OTC: richiede e accetta la temperatura interna target e regola autonomamente la temperatura del vettore termico basata sulla modalità curve integrata. Incompatibile con PID e Equitherm."
|
"note": "Lavora <u>SOLO</u> se la caldaia richiede la temperatura ambiente desiderata e regola autonomamente la temperatura del fluido. Non compatiblile con regolazioni PID e Equitherm del sistema."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -222,8 +222,6 @@
|
|||||||
"otDhwBurnerHours": "OpenTherm, aantal branderuren (warm water)",
|
"otDhwBurnerHours": "OpenTherm, aantal branderuren (warm water)",
|
||||||
"otHeatingPumpHours": "OpenTherm, aantal pompuren (verwarming)",
|
"otHeatingPumpHours": "OpenTherm, aantal pompuren (verwarming)",
|
||||||
"otDhwPumpHours": "OpenTherm, aantal pompuren (warm water)",
|
"otDhwPumpHours": "OpenTherm, aantal pompuren (warm water)",
|
||||||
"otCoolingHours": "OpenTherm, aantal cooling",
|
|
||||||
|
|
||||||
"ntcTemp": "NTC-sensor",
|
"ntcTemp": "NTC-sensor",
|
||||||
"dallasTemp": "DALLAS-sensor",
|
"dallasTemp": "DALLAS-sensor",
|
||||||
"bluetooth": "BLE-sensor",
|
"bluetooth": "BLE-sensor",
|
||||||
@@ -329,16 +327,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"heating": {
|
"heating": {
|
||||||
"hyst": {
|
"hyst": "Hysterese <small>(in graden)</small>",
|
||||||
"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": {
|
||||||
@@ -350,26 +339,11 @@
|
|||||||
"treshold": "Drempeltijd <small>(sec)</small>"
|
"treshold": "Drempeltijd <small>(sec)</small>"
|
||||||
},
|
},
|
||||||
"equitherm": {
|
"equitherm": {
|
||||||
"slope": {
|
"n": "N-factor",
|
||||||
"title": "Helling",
|
"k": "K-factor",
|
||||||
"note": "Compensatie voor warmteverlies. Hoofdafstelparameter."
|
"t": {
|
||||||
},
|
"title": "T-factor",
|
||||||
"exponent": {
|
"note": "Niet gebruikt als PID is ingeschakeld"
|
||||||
"title": "Exponent",
|
|
||||||
"note": "Radiator efficiëntie. Typische waarden: <code>1.1</code> - Vloerverwarming, <code>1.2</code> - Gietijzer, <code>1.3</code> - Paneelradiatoren, <code>1.4</code> - Convectors."
|
|
||||||
},
|
|
||||||
"shift": {
|
|
||||||
"title": "Verschuiving",
|
|
||||||
"note": "Compenseert voor extra warmteverliezen (bijv. in leidingen) of extra warmtebronnen."
|
|
||||||
},
|
|
||||||
"targetDiffFactor": {
|
|
||||||
"title": "T factor",
|
|
||||||
"note": "Niet gebruikt als PID is ingeschakeld. Voegt aan de setpoint de verschil tussen de target en huidige binnentemperatuur toe: <code>setpoint = setpoint + ((target - indoor) * T)</code>."
|
|
||||||
},
|
|
||||||
"chart": {
|
|
||||||
"targetTemp": "Doel binnentemperatuur",
|
|
||||||
"setpointTemp": "Warmtedrager temperatuur",
|
|
||||||
"outdoorTemp": "Buitentemperatuur"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pid": {
|
"pid": {
|
||||||
@@ -424,13 +398,11 @@
|
|||||||
"autoFaultReset": "Automatische storingsreset <small>(niet aanbevolen!)</small>",
|
"autoFaultReset": "Automatische storingsreset <small>(niet aanbevolen!)</small>",
|
||||||
"autoDiagReset": "Automatische diagnosereset <small>(niet aanbevolen!)</small>",
|
"autoDiagReset": "Automatische diagnosereset <small>(niet aanbevolen!)</small>",
|
||||||
"setDateAndTime": "Stel datum & tijd in op ketel",
|
"setDateAndTime": "Stel datum & tijd in op ketel",
|
||||||
"immergasFix": "Fix voor Immergas-ketels",
|
"immergasFix": "Fix voor Immergas-ketels"
|
||||||
"alwaysSendIndoorTemp": "Stuur huidige binnentemp naar ketel"
|
|
||||||
},
|
},
|
||||||
|
"nativeHeating": {
|
||||||
"nativeOTC": {
|
"title": "Natuurlijke verwarmingsregeling (ketel)",
|
||||||
"title": "Native warmtedrager temperatuur berekeningsmodus",
|
"note": "Werkt <u>ALLEEN</u> als de ketel de gewenste kamertemperatuur vereist en zelf de temperatuur van de warmtedrager regelt. Niet compatibel met PID- en Equitherm-regelaars in de firmware."
|
||||||
"note": "Werkt <u>ALLEEN</u> als de ketel in OTC-modus is: vereist en accepteert de doel binnentemperatuur en regelt zelf de warmtedrager temperatuur op basis van de ingebouwde curves modus. Incompatibel met PID en Equitherm."
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mqtt": {
|
"mqtt": {
|
||||||
|
|||||||
@@ -243,7 +243,6 @@
|
|||||||
"otDhwBurnerHours": "OpenTherm, кол-во часов работы горелки (ГВС)",
|
"otDhwBurnerHours": "OpenTherm, кол-во часов работы горелки (ГВС)",
|
||||||
"otHeatingPumpHours": "OpenTherm, кол-во часов работы насоса (отопление)",
|
"otHeatingPumpHours": "OpenTherm, кол-во часов работы насоса (отопление)",
|
||||||
"otDhwPumpHours": "OpenTherm, кол-во часов работы насоса (ГВС)",
|
"otDhwPumpHours": "OpenTherm, кол-во часов работы насоса (ГВС)",
|
||||||
"otCoolingHours": "OpenTherm, кол-во часов работы охлаждения",
|
|
||||||
|
|
||||||
"ntcTemp": "NTC датчик",
|
"ntcTemp": "NTC датчик",
|
||||||
"dallasTemp": "DALLAS датчик",
|
"dallasTemp": "DALLAS датчик",
|
||||||
@@ -357,16 +356,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"heating": {
|
"heating": {
|
||||||
"hyst": {
|
"hyst": "Гистерезис <small>(в градусах)</small>",
|
||||||
"title": "Гистерезис",
|
|
||||||
"desc": "Гистерезис полезен для поддержания заданной внутр. темп. (при использовании «ПЗА» и/или «ПИД»). Принудительно откл. отопление, когда <code>current indoor > target + value</code>, и вкл. отопление, когда <code>current indoor < (target - value)</code>.",
|
|
||||||
"value": "Значение <small>(в градусах)</small>",
|
|
||||||
"action": {
|
|
||||||
"title": "Действие",
|
|
||||||
"disableHeating": "Отключить отопление",
|
|
||||||
"set0target": "Установить 0 в качестве целевой темп."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"turboFactor": "Коэфф. турбо режима"
|
"turboFactor": "Коэфф. турбо режима"
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -381,26 +371,11 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"equitherm": {
|
"equitherm": {
|
||||||
"slope": {
|
"n": "Коэффициент N",
|
||||||
"title": "Наклон",
|
"k": "Коэффициент K",
|
||||||
"note": "Компенсация теплопотерь. Основной параметр настройки."
|
"t": {
|
||||||
},
|
|
||||||
"exponent": {
|
|
||||||
"title": "Экспонента",
|
|
||||||
"note": "Эффективность радиатора. Типичные значения: <code>1.1</code> - Тёплый пол, <code>1.2</code> - Чугунные радиаторы, <code>1.3</code> - Панельные радиаторы, <code>1.4</code> - Конвекторы."
|
|
||||||
},
|
|
||||||
"shift": {
|
|
||||||
"title": "Смещение",
|
|
||||||
"note": "Компенсирует дополнительные теплопотери (например, в трубах) или дополнительные источники тепла."
|
|
||||||
},
|
|
||||||
"targetDiffFactor": {
|
|
||||||
"title": "Коэффициент T",
|
"title": "Коэффициент T",
|
||||||
"note": "Не используется, если ПИД включен. Добавляет разницу между целевой и текущей температурой в помещении: <code>setpoint = setpoint + ((target - indoor) * T)</code>."
|
"note": "Не используется, если ПИД включен"
|
||||||
},
|
|
||||||
"chart": {
|
|
||||||
"targetTemp": "Целевая внутренняя температура",
|
|
||||||
"setpointTemp": "Температура теплоносителя",
|
|
||||||
"outdoorTemp": "Наружная температура"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -458,13 +433,12 @@
|
|||||||
"autoFaultReset": "Автоматический сброс ошибок <small>(не рекомендуется!)</small>",
|
"autoFaultReset": "Автоматический сброс ошибок <small>(не рекомендуется!)</small>",
|
||||||
"autoDiagReset": "Автоматический сброс диагностики <small>(не рекомендуется!)</small>",
|
"autoDiagReset": "Автоматический сброс диагностики <small>(не рекомендуется!)</small>",
|
||||||
"setDateAndTime": "Устанавливать время и дату на котле",
|
"setDateAndTime": "Устанавливать время и дату на котле",
|
||||||
"immergasFix": "Фикс для котлов Immergas",
|
"immergasFix": "Фикс для котлов Immergas"
|
||||||
"alwaysSendIndoorTemp": "Передавать текущую темп. в помещении котлу"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"nativeOTC": {
|
"nativeHeating": {
|
||||||
"title": "Нативный режим OTC (расчёт температуры теплоносителя)",
|
"title": "Передать управление отоплением котлу",
|
||||||
"note": "Работает <u>ТОЛЬКО</u> если котел в режиме OTC: требует и принимает целевую температуру в помещении и сам регулирует температуру теплоносителя на основе встроенного режима кривых. Несовместимо с ПИД и ПЗА."
|
"note": "Работает <u>ТОЛЬКО</u> если котел требует и принимает целевую температуру в помещении и сам регулирует температуру теплоносителя на основе встроенного режима кривых. Несовместимо с ПИД и ПЗА."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,6 @@
|
|||||||
<option value="24" data-i18n>sensors.types.otDhwBurnerHours</option>
|
<option value="24" data-i18n>sensors.types.otDhwBurnerHours</option>
|
||||||
<option value="25" data-i18n>sensors.types.otHeatingPumpHours</option>
|
<option value="25" data-i18n>sensors.types.otHeatingPumpHours</option>
|
||||||
<option value="26" data-i18n>sensors.types.otDhwPumpHours</option>
|
<option value="26" data-i18n>sensors.types.otDhwPumpHours</option>
|
||||||
<option value="27" data-i18n>sensors.types.otCoolingHours</option>
|
|
||||||
|
|
||||||
<option value="50" data-i18n>sensors.types.ntcTemp</option>
|
<option value="50" data-i18n>sensors.types.ntcTemp</option>
|
||||||
<option value="51" data-i18n>sensors.types.dallasTemp</option>
|
<option value="51" data-i18n>sensors.types.dallasTemp</option>
|
||||||
@@ -242,9 +241,7 @@
|
|||||||
setCheckboxValue("[name='filtering']", data.filtering, sensorForm);
|
setCheckboxValue("[name='filtering']", data.filtering, sensorForm);
|
||||||
setInputValue("[name='filteringFactor']", data.filteringFactor, {}, sensorForm);
|
setInputValue("[name='filteringFactor']", data.filteringFactor, {}, sensorForm);
|
||||||
|
|
||||||
setTimeout(() => {
|
sensorForm.querySelector("[name='type']").dispatchEvent(new Event("change"));
|
||||||
sensorForm.querySelector("[name='type']").dispatchEvent(new Event("change"));
|
|
||||||
}, 10);
|
|
||||||
|
|
||||||
setBusy(".form-busy", "form", false, sensorNode);
|
setBusy(".form-busy", "form", false, sensorNode);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -106,7 +106,7 @@
|
|||||||
<option disabled selected data-i18n>settings.system.ntp.timezonePresets</option>
|
<option disabled selected data-i18n>settings.system.ntp.timezonePresets</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
@@ -194,47 +194,20 @@
|
|||||||
|
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<label>
|
<label>
|
||||||
<span data-i18n>settings.heating.turboFactor</span>
|
<span data-i18n>settings.heating.hyst</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[hysteresis]" min="0" max="5" step="0.05" required>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<span data-i18n>settings.maxModulation</span>
|
<span data-i18n>settings.heating.turboFactor</span>
|
||||||
<input type="number" inputmode="numeric" name="heating[maxModulation]" min="1" max="100" step="1" required>
|
<input type="number" inputmode="decimal" name="heating[turboFactor]" min="1.5" max="10" step="0.1" required>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr />
|
<label>
|
||||||
|
<span data-i18n>settings.maxModulation</span>
|
||||||
<details>
|
<input type="number" inputmode="numeric" name="heating[maxModulation]" min="1" max="100" step="1" required>
|
||||||
<summary><b data-i18n>settings.heating.hyst.title</b></summary>
|
</label>
|
||||||
|
|
||||||
<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 />
|
||||||
|
|
||||||
@@ -381,44 +354,21 @@
|
|||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<div>
|
|
||||||
<div>
|
|
||||||
<canvas id="etChart"></canvas>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<label>
|
|
||||||
<div>
|
|
||||||
<span data-i18n>settings.equitherm.chart.targetTemp</span>: <b class="etChartTargetTempValue"></b>°
|
|
||||||
</div>
|
|
||||||
<input class="etChartTargetTemp" type="range" value="0" min="0" max="0" step="0.5">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<label>
|
<label>
|
||||||
<span data-i18n>settings.equitherm.slope.title</span>
|
<span data-i18n>settings.equitherm.n</span>
|
||||||
<input type="number" inputmode="decimal" name="equitherm[slope]" min="0.001" max="10" step="0.001" required>
|
<input type="number" inputmode="decimal" name="equitherm[n_factor]" min="0.001" max="10" step="0.001" required>
|
||||||
<small data-i18n>settings.equitherm.slope.note</small>
|
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<span data-i18n>settings.equitherm.exponent.title</span>
|
<span data-i18n>settings.equitherm.k</span>
|
||||||
<input type="number" inputmode="decimal" name="equitherm[exponent]" min="0.1" max="2" step="0.001" required>
|
<input type="number" inputmode="decimal" name="equitherm[k_factor]" min="0" max="10" step="0.01" required>
|
||||||
<small data-i18n>settings.equitherm.exponent.note</small>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid">
|
|
||||||
<label>
|
|
||||||
<span data-i18n>settings.equitherm.shift.title</span>
|
|
||||||
<input type="number" inputmode="decimal" name="equitherm[shift]" min="-15" max="15" step="0.01" required>
|
|
||||||
<small data-i18n>settings.equitherm.shift.note</small>
|
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<span data-i18n>settings.equitherm.targetDiffFactor.title</span>
|
<span data-i18n>settings.equitherm.t.title</span>
|
||||||
<input type="number" inputmode="decimal" name="equitherm[targetDiffFactor]" min="0" max="10" step="0.01" required>
|
<input type="number" inputmode="decimal" name="equitherm[t_factor]" min="0" max="10" step="0.01" required>
|
||||||
<small data-i18n>settings.equitherm.targetDiffFactor.note</small>
|
<small data-i18n>settings.equitherm.t.note</small>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -474,7 +424,7 @@
|
|||||||
<span data-i18n>settings.temp.min</span>
|
<span data-i18n>settings.temp.min</span>
|
||||||
<input type="number" inputmode="decimal" name="pid[minTemp]" min="0" max="0" step="1" required>
|
<input type="number" inputmode="decimal" name="pid[minTemp]" min="0" max="0" step="1" required>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<span data-i18n>settings.temp.max</span>
|
<span data-i18n>settings.temp.max</span>
|
||||||
<input type="number" inputmode="numeric" name="pid[maxTemp]" min="0" max="0" step="1" required>
|
<input type="number" inputmode="numeric" name="pid[maxTemp]" min="0" max="0" step="1" required>
|
||||||
@@ -503,12 +453,12 @@
|
|||||||
<span data-i18n>settings.pid.deadband.p_multiplier</span>
|
<span data-i18n>settings.pid.deadband.p_multiplier</span>
|
||||||
<input type="number" inputmode="decimal" name="pid[deadband][p_multiplier]" min="0" max="5" step="0.001" required>
|
<input type="number" inputmode="decimal" name="pid[deadband][p_multiplier]" min="0" max="5" step="0.001" required>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<span data-i18n>settings.pid.deadband.i_multiplier</span>
|
<span data-i18n>settings.pid.deadband.i_multiplier</span>
|
||||||
<input type="number" inputmode="decimal" name="pid[deadband][i_multiplier]" min="0" max="1" step="0.001" required>
|
<input type="number" inputmode="decimal" name="pid[deadband][i_multiplier]" min="0" max="1" step="0.001" required>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<span data-i18n>settings.pid.deadband.d_multiplier</span>
|
<span data-i18n>settings.pid.deadband.d_multiplier</span>
|
||||||
<input type="number" inputmode="decimal" name="pid[deadband][d_multiplier]" min="0" max="1" step="0.001" required>
|
<input type="number" inputmode="decimal" name="pid[deadband][d_multiplier]" min="0" max="1" step="0.001" required>
|
||||||
@@ -520,7 +470,7 @@
|
|||||||
<span data-i18n>settings.pid.deadband.thresholdHigh</span>
|
<span data-i18n>settings.pid.deadband.thresholdHigh</span>
|
||||||
<input type="number" inputmode="decimal" name="pid[deadband][thresholdHigh]" min="0" max="5" step="0.01" required>
|
<input type="number" inputmode="decimal" name="pid[deadband][thresholdHigh]" min="0" max="5" step="0.01" required>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<span data-i18n>settings.pid.deadband.thresholdLow</span>
|
<span data-i18n>settings.pid.deadband.thresholdLow</span>
|
||||||
<input type="number" inputmode="decimal" name="pid[deadband][thresholdLow]" min="0" max="5" step="0.01" required>
|
<input type="number" inputmode="decimal" name="pid[deadband][thresholdLow]" min="0" max="5" step="0.01" required>
|
||||||
@@ -692,22 +642,17 @@
|
|||||||
<span data-i18n>settings.ot.options.immergasFix</span>
|
<span data-i18n>settings.ot.options.immergasFix</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" name="opentherm[options][alwaysSendIndoorTemp]" value="true">
|
|
||||||
<span data-i18n>settings.ot.options.alwaysSendIndoorTemp</span>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="opentherm[options][nativeOTC]" value="true">
|
<input type="checkbox" name="opentherm[options][nativeHeatingControl]" value="true">
|
||||||
<span data-i18n>settings.ot.nativeOTC.title</span><br />
|
<span data-i18n>settings.ot.nativeHeating.title</span><br />
|
||||||
<small data-i18n>settings.ot.nativeOTC.note</small>
|
<small data-i18n>settings.ot.nativeHeating.note</small>
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<button type="submit" data-i18n>button.save</button>
|
<button type="submit" data-i18n>button.save</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -921,163 +866,11 @@
|
|||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script src="/static/app.js?{BUILD_TIME}"></script>
|
<script src="/static/app.js?{BUILD_TIME}"></script>
|
||||||
<script src="/static/chart.js?{BUILD_TIME}"></script>
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
const lang = new Lang(document.getElementById('lang'));
|
const lang = new Lang(document.getElementById('lang'));
|
||||||
lang.build();
|
lang.build();
|
||||||
|
|
||||||
let etChart = null;
|
|
||||||
let etChartConfig = {
|
|
||||||
slope: null,
|
|
||||||
exponent: null,
|
|
||||||
shift: null,
|
|
||||||
unitSystem: null,
|
|
||||||
targetTemp: null,
|
|
||||||
minTemp: null,
|
|
||||||
maxTemp: null,
|
|
||||||
decimated: false
|
|
||||||
};
|
|
||||||
|
|
||||||
const hasNeedDecimationChart = () => {
|
|
||||||
return window.innerWidth <= 800;
|
|
||||||
}
|
|
||||||
|
|
||||||
const makeEquithermChart = () => {
|
|
||||||
if (etChart == null) {
|
|
||||||
const ctx = document.getElementById('etChart').getContext('2d');
|
|
||||||
|
|
||||||
try {
|
|
||||||
etChart = new Chart(ctx, {
|
|
||||||
type: 'line',
|
|
||||||
data: {
|
|
||||||
datasets: [{
|
|
||||||
borderColor: (context) => {
|
|
||||||
const chart = context.chart;
|
|
||||||
const { ctx, chartArea } = chart;
|
|
||||||
|
|
||||||
if (!chartArea) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const gradient = ctx.createLinearGradient(0, chartArea.bottom, 0, chartArea.top);
|
|
||||||
gradient.addColorStop(0, 'rgba(1, 114, 173, 1)');
|
|
||||||
gradient.addColorStop(0.5, 'rgba(255, 99, 132, 1)');
|
|
||||||
|
|
||||||
return gradient;
|
|
||||||
},
|
|
||||||
borderWidth: 3,
|
|
||||||
fill: false,
|
|
||||||
tension: 0.1,
|
|
||||||
pointRadius: 2,
|
|
||||||
pointHoverRadius: 4,
|
|
||||||
indexAxis: "x",
|
|
||||||
data: []
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
responsive: true,
|
|
||||||
resizeDelay: 500,
|
|
||||||
parsing: false,
|
|
||||||
interaction: {
|
|
||||||
mode: 'nearest',
|
|
||||||
intersect: false
|
|
||||||
},
|
|
||||||
plugins: {
|
|
||||||
tooltip: {
|
|
||||||
enabled: true,
|
|
||||||
position: 'nearest',
|
|
||||||
displayColors: false,
|
|
||||||
callbacks: {
|
|
||||||
title: (items) => {
|
|
||||||
return `${i18n("settings.equitherm.chart.outdoorTemp")}: ${items[0].label}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
display: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
scales: {
|
|
||||||
x: {
|
|
||||||
display: true,
|
|
||||||
type: "linear",
|
|
||||||
reverse: true,
|
|
||||||
title: {
|
|
||||||
display: true
|
|
||||||
},
|
|
||||||
ticks: {
|
|
||||||
stepSize: 1,
|
|
||||||
format: {
|
|
||||||
style: "unit",
|
|
||||||
unit: "degree",
|
|
||||||
unitDisplay: "narrow"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
y: {
|
|
||||||
display: true,
|
|
||||||
title: {
|
|
||||||
display: true
|
|
||||||
},
|
|
||||||
ticks: {
|
|
||||||
format: {
|
|
||||||
style: "unit",
|
|
||||||
unit: "degree",
|
|
||||||
unitDisplay: "narrow"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!etChart) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let data = [];
|
|
||||||
etChartConfig.decimated = hasNeedDecimationChart();
|
|
||||||
for (let value = 30; value >= -30; value -= etChartConfig.decimated ? 2 : 1) {
|
|
||||||
const outdoorTemp = etChartConfig.unitSystem == 0 ? value : c2f(value);
|
|
||||||
|
|
||||||
data.push({
|
|
||||||
x: parseFloat(outdoorTemp.toFixed(1)),
|
|
||||||
y: parseFloat(calculateEquithermTemp(outdoorTemp).toFixed(1))
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
etChart.data.datasets[0].data = data;
|
|
||||||
etChart.data.datasets[0].label = i18n("settings.equitherm.chart.setpointTemp");
|
|
||||||
etChart.options.scales.x.title.text = i18n("settings.equitherm.chart.outdoorTemp");
|
|
||||||
etChart.options.scales.y.title.text = i18n("settings.equitherm.chart.setpointTemp");
|
|
||||||
etChart.update();
|
|
||||||
}
|
|
||||||
|
|
||||||
const calculateEquithermTemp = (outdoorTemp) => {
|
|
||||||
const tempDelta = etChartConfig.targetTemp - outdoorTemp;
|
|
||||||
const maxPoint = etChartConfig.targetTemp - (
|
|
||||||
etChartConfig.maxTemp - etChartConfig.targetTemp
|
|
||||||
) / etChartConfig.slope;
|
|
||||||
|
|
||||||
const sf = (etChartConfig.maxTemp - etChartConfig.targetTemp) / Math.pow(
|
|
||||||
etChartConfig.targetTemp - maxPoint,
|
|
||||||
1 / etChartConfig.exponent
|
|
||||||
);
|
|
||||||
const result = etChartConfig.targetTemp + etChartConfig.shift + sf * (
|
|
||||||
tempDelta >= 0
|
|
||||||
? Math.pow(tempDelta, 1 / etChartConfig.exponent)
|
|
||||||
: -(Math.pow(-(tempDelta), 1 / etChartConfig.exponent))
|
|
||||||
);
|
|
||||||
|
|
||||||
return Math.max(Math.min(result, etChartConfig.maxTemp), etChartConfig.minTemp);
|
|
||||||
}
|
|
||||||
|
|
||||||
const fillData = (data) => {
|
const fillData = (data) => {
|
||||||
// System
|
// System
|
||||||
setSelectValue("[name='system[logLevel]']", data.system.logLevel);
|
setSelectValue("[name='system[logLevel]']", data.system.logLevel);
|
||||||
@@ -1122,9 +915,8 @@
|
|||||||
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][nativeOTC]']", data.opentherm.options.nativeOTC);
|
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);
|
||||||
setCheckboxValue("[name='opentherm[options][alwaysSendIndoorTemp]']", data.opentherm.options.alwaysSendIndoorTemp);
|
|
||||||
setBusy('#ot-settings-busy', '#ot-settings', false);
|
setBusy('#ot-settings-busy', '#ot-settings', false);
|
||||||
|
|
||||||
// MQTT
|
// MQTT
|
||||||
@@ -1171,9 +963,7 @@
|
|||||||
"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
|
||||||
});
|
});
|
||||||
setCheckboxValue("[name='heating[hysteresis][enabled]']", data.heating.hysteresis.enabled);
|
setInputValue("[name='heating[hysteresis]']", data.heating.hysteresis);
|
||||||
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, {
|
||||||
@@ -1212,7 +1002,7 @@
|
|||||||
setBusy('#dhw-settings-busy', '#dhw-settings', false);
|
setBusy('#dhw-settings-busy', '#dhw-settings', false);
|
||||||
|
|
||||||
// Emergency mode
|
// Emergency mode
|
||||||
if (data.opentherm.options.nativeOTC) {
|
if (data.opentherm.options.nativeHeatingControl) {
|
||||||
setInputValue("[name='emergency[target]']", data.emergency.target, {
|
setInputValue("[name='emergency[target]']", data.emergency.target, {
|
||||||
"min": data.system.unitSystem == 0 ? 5 : 41,
|
"min": data.system.unitSystem == 0 ? 5 : 41,
|
||||||
"max": data.system.unitSystem == 0 ? 40 : 104
|
"max": data.system.unitSystem == 0 ? 40 : 104
|
||||||
@@ -1229,10 +1019,9 @@
|
|||||||
|
|
||||||
// Equitherm
|
// Equitherm
|
||||||
setCheckboxValue("[name='equitherm[enabled]']", data.equitherm.enabled);
|
setCheckboxValue("[name='equitherm[enabled]']", data.equitherm.enabled);
|
||||||
setInputValue("[name='equitherm[slope]']", data.equitherm.slope);
|
setInputValue("[name='equitherm[n_factor]']", data.equitherm.n_factor);
|
||||||
setInputValue("[name='equitherm[exponent]']", data.equitherm.exponent);
|
setInputValue("[name='equitherm[k_factor]']", data.equitherm.k_factor);
|
||||||
setInputValue("[name='equitherm[shift]']", data.equitherm.shift);
|
setInputValue("[name='equitherm[t_factor]']", data.equitherm.t_factor);
|
||||||
setInputValue("[name='equitherm[targetDiffFactor]']", data.equitherm.targetDiffFactor);
|
|
||||||
setBusy('#equitherm-settings-busy', '#equitherm-settings', false);
|
setBusy('#equitherm-settings-busy', '#equitherm-settings', false);
|
||||||
|
|
||||||
// PID
|
// PID
|
||||||
@@ -1256,24 +1045,6 @@
|
|||||||
setInputValue("[name='pid[deadband][thresholdHigh]']", data.pid.deadband.thresholdHigh);
|
setInputValue("[name='pid[deadband][thresholdHigh]']", data.pid.deadband.thresholdHigh);
|
||||||
setInputValue("[name='pid[deadband][thresholdLow]']", data.pid.deadband.thresholdLow);
|
setInputValue("[name='pid[deadband][thresholdLow]']", data.pid.deadband.thresholdLow);
|
||||||
setBusy('#pid-settings-busy', '#pid-settings', false);
|
setBusy('#pid-settings-busy', '#pid-settings', false);
|
||||||
|
|
||||||
const etMinTemp = parseInt(data.system.unitSystem == 0 ? 5 : 41);
|
|
||||||
const etMaxTemp = parseInt(data.system.unitSystem == 0 ? 30 : 86);
|
|
||||||
const etTargetTemp = constrain(parseFloat(data.heating.target), etMinTemp, etMaxTemp);
|
|
||||||
|
|
||||||
setInputValue(".etChartTargetTemp", etTargetTemp.toFixed(1), {
|
|
||||||
"min": etMinTemp,
|
|
||||||
"max": etMaxTemp
|
|
||||||
});
|
|
||||||
|
|
||||||
etChartConfig.slope = data.equitherm.slope;
|
|
||||||
etChartConfig.exponent = data.equitherm.exponent;
|
|
||||||
etChartConfig.shift = data.equitherm.shift;
|
|
||||||
etChartConfig.unitSystem = data.system.unitSystem;
|
|
||||||
etChartConfig.minTemp = data.heating.minTemp;
|
|
||||||
etChartConfig.maxTemp = data.heating.maxTemp;
|
|
||||||
|
|
||||||
makeEquithermChart();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -1303,7 +1074,7 @@
|
|||||||
cache: "no-cache",
|
cache: "no-cache",
|
||||||
credentials: "include"
|
credentials: "include"
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error('Response not valid');
|
throw new Error('Response not valid');
|
||||||
}
|
}
|
||||||
@@ -1326,57 +1097,6 @@
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelector(".etChartTargetTemp").addEventListener("input", async (event) => {
|
|
||||||
setValue('.etChartTargetTempValue', parseFloat(event.target.value).toFixed(1));
|
|
||||||
});
|
|
||||||
|
|
||||||
document.querySelector(".etChartTargetTemp").addEventListener("change", async (event) => {
|
|
||||||
if (!event.target.checkValidity()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
etChartConfig.targetTemp = parseFloat(event.target.value);
|
|
||||||
setValue('.etChartTargetTempValue', etChartConfig.targetTemp.toFixed(1));
|
|
||||||
makeEquithermChart();
|
|
||||||
});
|
|
||||||
|
|
||||||
document.querySelector("[name='equitherm[slope]']").addEventListener("change", async (event) => {
|
|
||||||
if (!event.target.checkValidity()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
etChartConfig.slope = parseFloat(event.target.value);
|
|
||||||
makeEquithermChart();
|
|
||||||
});
|
|
||||||
|
|
||||||
document.querySelector("[name='equitherm[exponent]']").addEventListener("change", async (event) => {
|
|
||||||
if (!event.target.checkValidity()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
etChartConfig.exponent = parseFloat(event.target.value);
|
|
||||||
makeEquithermChart();
|
|
||||||
});
|
|
||||||
|
|
||||||
document.querySelector("[name='equitherm[shift]']").addEventListener("change", async (event) => {
|
|
||||||
if (!event.target.checkValidity()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
etChartConfig.shift = parseFloat(event.target.value);
|
|
||||||
makeEquithermChart();
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener('resize', async (event) => {
|
|
||||||
if (etChart) {
|
|
||||||
etChart.resize();
|
|
||||||
|
|
||||||
if (etChartConfig.decimated != hasNeedDecimationChart()) {
|
|
||||||
makeEquithermChart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -62,19 +62,19 @@
|
|||||||
|
|
||||||
<form action="/api/upgrade" id="upgrade">
|
<form action="/api/upgrade" id="upgrade">
|
||||||
<fieldset class="primary">
|
<fieldset class="primary">
|
||||||
<label for="firmware-file">
|
<label>
|
||||||
<span data-i18n>upgrade.fw</span>:
|
<span data-i18n>upgrade.fw</span>:
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<input type="file" name="firmware" id="firmware-file" accept=".bin">
|
<input type="file" name="fw" accept=".bin">
|
||||||
<button type="button" class="upgrade-firmware-result hidden" disabled></button>
|
<button type="button" class="fwResult hidden" disabled></button>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label for="filesystem-file">
|
<label>
|
||||||
<span data-i18n>upgrade.fs</span>:
|
<span data-i18n>upgrade.fs</span>:
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<input type="file" name="filesystem" id="filesystem-file" accept=".bin">
|
<input type="file" name="fs" accept=".bin">
|
||||||
<button type="button" class="upgrade-filesystem-result hidden" disabled></button>
|
<button type="button" class="fsResult hidden" disabled></button>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@@ -108,7 +108,123 @@
|
|||||||
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>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -5,13 +5,8 @@ const setupForm = (formSelector, onResultCallback = null, noCastItems = []) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
form.querySelectorAll('input').forEach(item => {
|
form.querySelectorAll('input').forEach(item => {
|
||||||
item.addEventListener('change', (event) => {
|
item.addEventListener('change', (e) => {
|
||||||
if (!event.target.checkValidity()) {
|
e.target.setAttribute('aria-invalid', !e.target.checkValidity());
|
||||||
event.target.setAttribute('aria-invalid', true);
|
|
||||||
|
|
||||||
} else if (event.target.hasAttribute('aria-invalid')) {
|
|
||||||
event.target.removeAttribute('aria-invalid');
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -635,10 +630,6 @@ const setCheckboxValue = (selector, value, parent = undefined) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
item.checked = value;
|
item.checked = value;
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
item.dispatchEvent(new Event("change"));
|
|
||||||
}, 10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const setRadioValue = (selector, value, parent = undefined) => {
|
const setRadioValue = (selector, value, parent = undefined) => {
|
||||||
@@ -652,14 +643,7 @@ const setRadioValue = (selector, value, parent = undefined) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let item of items) {
|
for (let item of items) {
|
||||||
const checked = item.value == value;
|
item.checked = item.value == value;
|
||||||
if (item.checked != checked) {
|
|
||||||
item.checked = checked;
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
item.dispatchEvent(new Event("change"));
|
|
||||||
}, 10);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -674,17 +658,13 @@ const setInputValue = (selector, value, attrs = {}, parent = undefined) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let item of items) {
|
for (let item of items) {
|
||||||
|
item.value = value;
|
||||||
|
|
||||||
if (attrs instanceof Object) {
|
if (attrs instanceof Object) {
|
||||||
for (let attrKey of Object.keys(attrs)) {
|
for (let attrKey of Object.keys(attrs)) {
|
||||||
item.setAttribute(attrKey, attrs[attrKey]);
|
item.setAttribute(attrKey, attrs[attrKey]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
item.value = value;
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
item.dispatchEvent(new Event("change"));
|
|
||||||
}, 10);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -873,12 +853,4 @@ 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