mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-05-20 08:18:15 +05:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a4ca20f9a9 | |||
| f5e08f20a2 | |||
| 07650b4878 | |||
| ffcacb3d48 | |||
| bdfa793c49 | |||
| 25280bf9b1 | |||
| 9c2e420ec7 | |||
| af2d4624b3 | |||
| 14d2262d2f | |||
| db99746ee9 |
@@ -0,0 +1,152 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
paths-ignore:
|
||||||
|
- "assets/**"
|
||||||
|
- "tools/**"
|
||||||
|
- "**/*.md"
|
||||||
|
- "LICENSE"
|
||||||
|
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- "assets/**"
|
||||||
|
- "tools/**"
|
||||||
|
- "**/*.md"
|
||||||
|
- "LICENSE"
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
prepare:
|
||||||
|
name: Prepare (get envs)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
envs: ${{ steps.envs.outputs.envs }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Python
|
||||||
|
uses: actions/setup-python@v6
|
||||||
|
with:
|
||||||
|
python-version: "3.x"
|
||||||
|
|
||||||
|
- name: Install PlatformIO Core
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install --upgrade platformio
|
||||||
|
pip install --upgrade intelhex
|
||||||
|
|
||||||
|
- name: Get environments
|
||||||
|
id: envs
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
ENVS=$(
|
||||||
|
pio project config --json-output \
|
||||||
|
| jq -c '
|
||||||
|
.[]
|
||||||
|
| select(type == "array")
|
||||||
|
| .[0]
|
||||||
|
| select(startswith("env:"))
|
||||||
|
| sub("^env:"; "")
|
||||||
|
' | jq -s -c '.'
|
||||||
|
)
|
||||||
|
|
||||||
|
echo "envs=$ENVS" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "$ENVS"
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build ${{ matrix.env }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: prepare
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
env: ${{ fromJson(needs.prepare.outputs.envs) }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Python
|
||||||
|
uses: actions/setup-python@v6
|
||||||
|
with:
|
||||||
|
python-version: "3.x"
|
||||||
|
|
||||||
|
- name: Install Node.js
|
||||||
|
uses: actions/setup-node@v5
|
||||||
|
with:
|
||||||
|
node-version: "22"
|
||||||
|
|
||||||
|
- name: Install PlatformIO Core
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install --upgrade platformio
|
||||||
|
pip install --upgrade intelhex
|
||||||
|
|
||||||
|
- name: Full clean
|
||||||
|
run: |
|
||||||
|
pio run -e ${{ matrix.env }} -t fullclean
|
||||||
|
|
||||||
|
- name: Build firmware & filesystem
|
||||||
|
env:
|
||||||
|
PIOENV: ${{ matrix.env }}
|
||||||
|
run: |
|
||||||
|
pio run -e ${{ matrix.env }}
|
||||||
|
|
||||||
|
- name: Upload artifacts
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.env }}
|
||||||
|
if-no-files-found: error
|
||||||
|
path: |
|
||||||
|
build/*.bin
|
||||||
|
build/*.elf
|
||||||
|
|
||||||
|
release:
|
||||||
|
name: Release Dev
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
if: ${{ github.repository_owner == 'Laxilef' && github.ref == 'refs/heads/async' }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v5
|
||||||
|
with:
|
||||||
|
path: artifacts
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- name: Delete old release assets
|
||||||
|
uses: mknejp/delete-release-assets@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
tag: dev
|
||||||
|
fail-if-no-assets: false
|
||||||
|
fail-if-no-release: false
|
||||||
|
assets: |
|
||||||
|
*.bin
|
||||||
|
*.elf
|
||||||
|
|
||||||
|
- name: Publish Dev release
|
||||||
|
uses: softprops/action-gh-release@v3
|
||||||
|
with:
|
||||||
|
tag_name: dev
|
||||||
|
target_commitish: async
|
||||||
|
name: Dev (unstable)
|
||||||
|
prerelease: true
|
||||||
|
make_latest: false
|
||||||
|
generate_release_notes: true
|
||||||
|
files: |
|
||||||
|
artifacts/*.bin
|
||||||
|
artifacts/*.elf
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
name: CI
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validate-json:
|
||||||
|
name: Validate JSON
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Install jq
|
||||||
|
run: sudo apt-get update && sudo apt-get install -y jq
|
||||||
|
|
||||||
|
- name: Validate
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
echo "Searching JSON files in src_data..."
|
||||||
|
|
||||||
|
files=$(find src_data -type f -iname "*.json")
|
||||||
|
|
||||||
|
if [ -z "$files" ]; then
|
||||||
|
echo "No JSON files found."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
for file in $files; do
|
||||||
|
echo "Validating: $file"
|
||||||
|
|
||||||
|
if ! jq empty "$file" >/dev/null 2>&1; then
|
||||||
|
echo "❌ Invalid JSON: $file"
|
||||||
|
failed=1
|
||||||
|
else
|
||||||
|
echo "✅ Valid JSON: $file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$failed" -ne 0 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "JSON validation failed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "All JSON files are valid."
|
||||||
|
|
||||||
|
cpplint:
|
||||||
|
name: cpplint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Cache
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
key: ${{ runner.os }}-cpplint
|
||||||
|
path: ~/.cache/pip
|
||||||
|
|
||||||
|
- name: Python
|
||||||
|
uses: actions/setup-python@v6
|
||||||
|
with:
|
||||||
|
python-version: "3.x"
|
||||||
|
|
||||||
|
- name: Install cpplint
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install --upgrade cpplint
|
||||||
|
|
||||||
|
- name: cpplint
|
||||||
|
run: |
|
||||||
|
FILTERS="-legal/copyright,\
|
||||||
|
-runtime/int,\
|
||||||
|
-runtime/references,\
|
||||||
|
-runtime/indentation_namespace,\
|
||||||
|
-runtime/arrays,\
|
||||||
|
-runtime/printf,\
|
||||||
|
-whitespace/line_length,\
|
||||||
|
-whitespace/braces,\
|
||||||
|
-whitespace/comments,\
|
||||||
|
-whitespace/indent,\
|
||||||
|
-whitespace/newline,\
|
||||||
|
-whitespace/parens,\
|
||||||
|
-whitespace/blank_line,\
|
||||||
|
-readability/braces,\
|
||||||
|
-readability/todo,\
|
||||||
|
-readability/namespace,\
|
||||||
|
-build/header_guard,\
|
||||||
|
-build/include_subdir,\
|
||||||
|
-build/include_what_you_use,\
|
||||||
|
-build/namespaces,\
|
||||||
|
-build/c++11"
|
||||||
|
|
||||||
|
cpplint \
|
||||||
|
--repository=. \
|
||||||
|
--recursive \
|
||||||
|
--quiet \
|
||||||
|
--filter="$FILTERS" \
|
||||||
|
include lib src
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
class BufferedWebServer {
|
class BufferedWebServer {
|
||||||
public:
|
public:
|
||||||
BufferedWebServer(WebServer* webServer, size_t bufferSize = 64) {
|
explicit BufferedWebServer(WebServer* webServer, size_t bufferSize = 64) {
|
||||||
this->webServer = webServer;
|
this->webServer = webServer;
|
||||||
this->bufferSize = bufferSize;
|
this->bufferSize = bufferSize;
|
||||||
this->buffer = (uint8_t*)malloc(bufferSize * sizeof(*this->buffer));
|
this->buffer = static_cast<uint8_t*>(malloc(bufferSize * sizeof(*this->buffer)));
|
||||||
}
|
}
|
||||||
|
|
||||||
~BufferedWebServer() {
|
~BufferedWebServer() {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public:
|
|||||||
typedef std::function<void(unsigned long, uint8_t)> BeforeSendRequestCallback;
|
typedef std::function<void(unsigned long, uint8_t)> BeforeSendRequestCallback;
|
||||||
typedef std::function<void(unsigned long, unsigned long, OpenThermResponseStatus, uint8_t)> AfterSendRequestCallback;
|
typedef std::function<void(unsigned long, unsigned long, OpenThermResponseStatus, uint8_t)> AfterSendRequestCallback;
|
||||||
|
|
||||||
CustomOpenTherm(int inPin = 4, int outPin = 5, bool isSlave = false, bool alwaysReceive = false) : OpenTherm(inPin, outPin, isSlave, alwaysReceive) {}
|
explicit CustomOpenTherm(int inPin = 4, int outPin = 5, bool isSlave = false, bool alwaysReceive = false) : OpenTherm(inPin, outPin, isSlave, alwaysReceive) {}
|
||||||
~CustomOpenTherm() {}
|
~CustomOpenTherm() {}
|
||||||
|
|
||||||
CustomOpenTherm* setDelayCallback(DelayCallback callback = nullptr) {
|
CustomOpenTherm* setDelayCallback(DelayCallback callback = nullptr) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifndef PROGMEM
|
#ifndef PROGMEM
|
||||||
#define PROGMEM
|
#define PROGMEM // NOLINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char HA_ENTITY_BINARY_SENSOR[] PROGMEM = "binary_sensor";
|
const char HA_ENTITY_BINARY_SENSOR[] PROGMEM = "binary_sensor";
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ public:
|
|||||||
typedef std::function<void(const char*, size_t, size_t, bool)> PublishEventCallback;
|
typedef std::function<void(const char*, size_t, size_t, bool)> PublishEventCallback;
|
||||||
typedef std::function<void(size_t, size_t)> FlushEventCallback;
|
typedef std::function<void(size_t, size_t)> FlushEventCallback;
|
||||||
|
|
||||||
MqttWriter(MqttClient* client, size_t bufferSize = 64) {
|
explicit MqttWriter(MqttClient* client, size_t bufferSize = 64) {
|
||||||
this->client = client;
|
this->client = client;
|
||||||
this->bufferSize = bufferSize;
|
this->bufferSize = bufferSize;
|
||||||
this->buffer = (uint8_t*) malloc(bufferSize * sizeof(*this->buffer));
|
this->buffer = static_cast<uint8_t*>(malloc(bufferSize * sizeof(*this->buffer)));
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
this->mutex = new std::mutex();
|
this->mutex = new std::mutex();
|
||||||
|
|||||||
@@ -1,224 +0,0 @@
|
|||||||
#include <FS.h>
|
|
||||||
|
|
||||||
|
|
||||||
class DynamicPage : public RequestHandler {
|
|
||||||
public:
|
|
||||||
typedef std::function<bool(HTTPMethod, const String&)> CanHandleCallback;
|
|
||||||
typedef std::function<bool()> BeforeSendCallback;
|
|
||||||
typedef std::function<String(const char*)> TemplateCallback;
|
|
||||||
|
|
||||||
DynamicPage(const char* uri, FS* fs, const char* path, const char* cacheHeader = nullptr) {
|
|
||||||
this->uri = uri;
|
|
||||||
this->fs = fs;
|
|
||||||
this->path = path;
|
|
||||||
this->cacheHeader = cacheHeader;
|
|
||||||
}
|
|
||||||
|
|
||||||
DynamicPage* setCanHandleCallback(CanHandleCallback callback = nullptr) {
|
|
||||||
this->canHandleCallback = callback;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
DynamicPage* setBeforeSendCallback(BeforeSendCallback callback = nullptr) {
|
|
||||||
this->beforeSendCallback = callback;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
DynamicPage* setTemplateCallback(TemplateCallback callback = nullptr) {
|
|
||||||
this->templateCallback = callback;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP32)
|
|
||||||
bool canHandle(WebServer &server, HTTPMethod method, const String &uri) override {
|
|
||||||
return this->canHandle(method, uri);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool canHandle(HTTPMethod method, const String& uri) override {
|
|
||||||
return uri.equals(this->uri) && (!this->canHandleCallback || this->canHandleCallback(method, uri));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool handle(WebServer& server, HTTPMethod method, const String& uri) override {
|
|
||||||
if (!this->canHandle(method, uri)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->beforeSendCallback && !this->beforeSendCallback()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
File file = this->fs->open(this->path, "r");
|
|
||||||
if (!file) {
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} else if (file.isDirectory()) {
|
|
||||||
file.close();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->cacheHeader != nullptr) {
|
|
||||||
server.sendHeader(F("Cache-Control"), this->cacheHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP8266
|
|
||||||
if (!server.chunkedResponseModeStart(200, F("text/html"))) {
|
|
||||||
server.send(505, F("text/html"), F("HTTP1.1 required"));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
server.setContentLength(CONTENT_LENGTH_UNKNOWN);
|
|
||||||
server.send(200, "text/html", emptyString);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint8_t* argStartPos = nullptr;
|
|
||||||
uint8_t* argEndPos = nullptr;
|
|
||||||
uint8_t argName[16];
|
|
||||||
size_t sizeArgName = 0;
|
|
||||||
bool argNameProcess = false;
|
|
||||||
while (file.available()) {
|
|
||||||
uint8_t buf[64];
|
|
||||||
size_t length = file.read(buf, sizeof(buf));
|
|
||||||
size_t offset = 0;
|
|
||||||
|
|
||||||
if (argNameProcess) {
|
|
||||||
argEndPos = (uint8_t*) memchr(buf, '}', length);
|
|
||||||
|
|
||||||
if (argEndPos != nullptr) {
|
|
||||||
size_t fullSizeArgName = sizeArgName + (argEndPos - buf);
|
|
||||||
if (fullSizeArgName < sizeof(argName)) {
|
|
||||||
// copy full arg name
|
|
||||||
if (argEndPos - buf > 0) {
|
|
||||||
memcpy(argName + sizeArgName, buf, argEndPos - buf);
|
|
||||||
}
|
|
||||||
argName[fullSizeArgName] = '\0';
|
|
||||||
|
|
||||||
// send arg value
|
|
||||||
String argValue = this->templateCallback((const char*) argName);
|
|
||||||
if (argValue.length()) {
|
|
||||||
server.sendContent(argValue.c_str());
|
|
||||||
|
|
||||||
} else if (fullSizeArgName > 0) {
|
|
||||||
server.sendContent("{");
|
|
||||||
server.sendContent((const char*) argName);
|
|
||||||
server.sendContent("}");
|
|
||||||
}
|
|
||||||
|
|
||||||
offset = size_t(argEndPos - buf + 1);
|
|
||||||
sizeArgName = 0;
|
|
||||||
argNameProcess = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argNameProcess) {
|
|
||||||
server.sendContent("{");
|
|
||||||
|
|
||||||
if (sizeArgName > 0) {
|
|
||||||
argName[sizeArgName] = '\0';
|
|
||||||
server.sendContent((const char*) argName);
|
|
||||||
}
|
|
||||||
|
|
||||||
argNameProcess = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
|
||||||
uint8_t* currentBuf = buf + offset;
|
|
||||||
size_t currentLength = length - offset;
|
|
||||||
|
|
||||||
argStartPos = (uint8_t*) memchr(currentBuf, '{', currentLength);
|
|
||||||
|
|
||||||
// send all content
|
|
||||||
if (argStartPos == nullptr) {
|
|
||||||
if (currentLength > 0) {
|
|
||||||
server.sendContent((const char*) currentBuf, currentLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
argEndPos = (uint8_t*) memchr(argStartPos, '}', length - (argStartPos - buf));
|
|
||||||
if (argEndPos != nullptr) {
|
|
||||||
sizeArgName = argEndPos - argStartPos - 1;
|
|
||||||
|
|
||||||
// send all content if arg len > space
|
|
||||||
if (sizeArgName >= sizeof(argName)) {
|
|
||||||
if (currentLength > 0) {
|
|
||||||
server.sendContent((const char*) currentBuf, currentLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// arg name
|
|
||||||
memcpy(argName, argStartPos + 1, sizeArgName);
|
|
||||||
argName[sizeArgName] = '\0';
|
|
||||||
|
|
||||||
// send arg value
|
|
||||||
String argValue = this->templateCallback((const char*) argName);
|
|
||||||
if (argValue.length()) {
|
|
||||||
// send content before var
|
|
||||||
if (argStartPos - buf > 0) {
|
|
||||||
server.sendContent((const char*) currentBuf, argStartPos - buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
server.sendContent(argValue.c_str());
|
|
||||||
|
|
||||||
} else {
|
|
||||||
server.sendContent((const char*) currentBuf, argEndPos - currentBuf + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
offset = size_t(argEndPos - currentBuf + 1);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
sizeArgName = length - size_t(argStartPos - currentBuf) - 1;
|
|
||||||
|
|
||||||
// send all content if arg len > space
|
|
||||||
if (sizeArgName >= sizeof(argName)) {
|
|
||||||
if (currentLength) {
|
|
||||||
server.sendContent((const char*) currentBuf, currentLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// send content before var
|
|
||||||
if (argStartPos - buf > 0) {
|
|
||||||
server.sendContent((const char*) currentBuf, argStartPos - buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy arg name chunk
|
|
||||||
if (sizeArgName > 0) {
|
|
||||||
memcpy(argName, argStartPos + 1, sizeArgName);
|
|
||||||
}
|
|
||||||
|
|
||||||
argNameProcess = true;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP8266
|
|
||||||
server.chunkedResponseFinalize();
|
|
||||||
#else
|
|
||||||
server.sendContent(emptyString);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
FS* fs = nullptr;
|
|
||||||
CanHandleCallback canHandleCallback;
|
|
||||||
BeforeSendCallback beforeSendCallback;
|
|
||||||
TemplateCallback templateCallback;
|
|
||||||
const char* uri = nullptr;
|
|
||||||
const char* path = nullptr;
|
|
||||||
const char* cacheHeader = nullptr;
|
|
||||||
};
|
|
||||||
@@ -29,9 +29,9 @@ public:
|
|||||||
typedef std::function<bool(AsyncWebServerRequest *request, UpgradeType)> BeforeUpgradeCallback;
|
typedef std::function<bool(AsyncWebServerRequest *request, UpgradeType)> BeforeUpgradeCallback;
|
||||||
typedef std::function<void(AsyncWebServerRequest *request, const UpgradeResult&, const UpgradeResult&)> AfterUpgradeCallback;
|
typedef std::function<void(AsyncWebServerRequest *request, const UpgradeResult&, const UpgradeResult&)> AfterUpgradeCallback;
|
||||||
|
|
||||||
UpgradeHandler(AsyncURIMatcher uri) : uri(uri) {}
|
explicit UpgradeHandler(AsyncURIMatcher uri) : uri(uri) {}
|
||||||
|
|
||||||
bool canHandle(AsyncWebServerRequest *request) const override final {
|
bool canHandle(AsyncWebServerRequest *request) const final {
|
||||||
if (!request->isHTTP()) {
|
if (!request->isHTTP()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleRequest(AsyncWebServerRequest *request) override final {
|
void handleRequest(AsyncWebServerRequest *request) final {
|
||||||
if (this->afterUpgradeCallback) {
|
if (this->afterUpgradeCallback) {
|
||||||
this->afterUpgradeCallback(request, this->firmwareResult, this->filesystemResult);
|
this->afterUpgradeCallback(request, this->firmwareResult, this->filesystemResult);
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ public:
|
|||||||
this->filesystemResult.error.clear();
|
this->filesystemResult.error.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleUpload(AsyncWebServerRequest *request, const String &fileName, size_t index, uint8_t *data, size_t dataLength, bool isFinal) override final {
|
void handleUpload(AsyncWebServerRequest *request, const String &fileName, size_t index, uint8_t *data, size_t dataLength, bool isFinal) final {
|
||||||
UpgradeResult* result = nullptr;
|
UpgradeResult* result = nullptr;
|
||||||
|
|
||||||
if (!request->hasParam(asyncsrv::T_name, true, true)) {
|
if (!request->hasParam(asyncsrv::T_name, true, true)) {
|
||||||
@@ -194,7 +194,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isRequestHandlerTrivial() const override final {
|
bool isRequestHandlerTrivial() const final {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -35,9 +35,9 @@ namespace CrashRecorder {
|
|||||||
} ext_t;
|
} ext_t;
|
||||||
|
|
||||||
|
|
||||||
__NOINIT_ATTR volatile static backtrace_t backtrace;
|
__NOINIT_ATTR volatile static backtrace_t backtrace; // NOLINT
|
||||||
__NOINIT_ATTR volatile static epc_t epc;
|
__NOINIT_ATTR volatile static epc_t epc; // NOLINT
|
||||||
__NOINIT_ATTR volatile static ext_t ext;
|
__NOINIT_ATTR volatile static ext_t ext; // NOLINT
|
||||||
|
|
||||||
uint8_t backtraceMaxLength = sizeof(backtrace.data) / sizeof(*backtrace.data);
|
uint8_t backtraceMaxLength = sizeof(backtrace.data) / sizeof(*backtrace.data);
|
||||||
uint8_t epcMaxLength = sizeof(epc.data) / sizeof(*epc.data);
|
uint8_t epcMaxLength = sizeof(epc.data) / sizeof(*epc.data);
|
||||||
@@ -98,7 +98,7 @@ extern "C" void custom_crash_callback(struct rst_info *info, uint32_t stack, uin
|
|||||||
CrashRecorder::backtrace.continues = false;
|
CrashRecorder::backtrace.continues = false;
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
for (uint32_t i = stack; i < stack_end; i += 4) {
|
for (uint32_t i = stack; i < stack_end; i += 4) {
|
||||||
value = *((uint32_t*) i);
|
value = *((uint32_t*) i); // NOLINT
|
||||||
|
|
||||||
// keep only addresses in code area
|
// keep only addresses in code area
|
||||||
if ((value >= 0x40000000) && (value < 0x40300000)) {
|
if ((value >= 0x40000000) && (value < 0x40300000)) {
|
||||||
|
|||||||
+3
-3
@@ -10,7 +10,7 @@ extern FileData fsNetworkSettings, fsSettings, fsSensorsSettings;
|
|||||||
|
|
||||||
class MainTask : public Task {
|
class MainTask : public Task {
|
||||||
public:
|
public:
|
||||||
MainTask(bool _enabled = false, unsigned long _interval = 0) : Task(_enabled, _interval) {
|
explicit MainTask(bool _enabled = false, unsigned long _interval = 0) : Task(_enabled, _interval) {
|
||||||
this->blinker = new Blinker();
|
this->blinker = new Blinker();
|
||||||
|
|
||||||
network->setDelayCallback([this](unsigned int time) {
|
network->setDelayCallback([this](unsigned int time) {
|
||||||
@@ -253,7 +253,7 @@ protected:
|
|||||||
|
|
||||||
if (availableSensors) {
|
if (availableSensors) {
|
||||||
if (vars.master.heating.freezing) {
|
if (vars.master.heating.freezing) {
|
||||||
if (lowTemp - (float) settings.heating.freezeProtection.highTemp + 0.0001f >= 0.0f) {
|
if (lowTemp - static_cast<float>(settings.heating.freezeProtection.highTemp) + 0.0001f >= 0.0f) {
|
||||||
vars.master.heating.freezing = false;
|
vars.master.heating.freezing = false;
|
||||||
|
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
@@ -264,7 +264,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if ((float) settings.heating.freezeProtection.lowTemp - lowTemp + 0.0001f >= 0.0f) {
|
if (static_cast<float>(settings.heating.freezeProtection.lowTemp) - lowTemp + 0.0001f >= 0.0f) {
|
||||||
vars.master.heating.freezing = true;
|
vars.master.heating.freezing = true;
|
||||||
|
|
||||||
if (!settings.heating.enabled) {
|
if (!settings.heating.enabled) {
|
||||||
|
|||||||
+2
-2
@@ -8,7 +8,7 @@ extern FileData fsSettings;
|
|||||||
|
|
||||||
class MqttTask : public Task {
|
class MqttTask : public Task {
|
||||||
public:
|
public:
|
||||||
MqttTask(bool _enabled = false, unsigned long _interval = 0) : Task(_enabled, _interval) {
|
explicit MqttTask(bool _enabled = false, unsigned long _interval = 0) : Task(_enabled, _interval) {
|
||||||
this->wifiClient = new MqttWiFiClient();
|
this->wifiClient = new MqttWiFiClient();
|
||||||
this->client = new MqttClient(this->wifiClient);
|
this->client = new MqttClient(this->wifiClient);
|
||||||
this->writer = new MqttWriter(this->client, 256);
|
this->writer = new MqttWriter(this->client, 256);
|
||||||
@@ -443,7 +443,7 @@ protected:
|
|||||||
} else if (payload[i] == 10) {
|
} else if (payload[i] == 10) {
|
||||||
Log.print(F("\r\n> "));
|
Log.print(F("\r\n> "));
|
||||||
} else {
|
} else {
|
||||||
Log.print((char) payload[i]);
|
Log.print(static_cast<char>(payload[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.print(F("\r\n\n"));
|
Log.print(F("\r\n\n"));
|
||||||
|
|||||||
+7
-7
@@ -3,7 +3,7 @@ extern FileData fsSettings;
|
|||||||
|
|
||||||
class OpenThermTask : public Task {
|
class OpenThermTask : public Task {
|
||||||
public:
|
public:
|
||||||
OpenThermTask(bool _enabled = false, unsigned long _interval = 0) : Task(_enabled, _interval) {}
|
explicit OpenThermTask(bool _enabled = false, unsigned long _interval = 0) : Task(_enabled, _interval) {}
|
||||||
|
|
||||||
~OpenThermTask() {
|
~OpenThermTask() {
|
||||||
delete this->instance;
|
delete this->instance;
|
||||||
@@ -1401,7 +1401,7 @@ protected:
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (vars.master.heating.overheat) {
|
if (vars.master.heating.overheat) {
|
||||||
if ((float) settings.heating.overheatProtection.lowTemp - highTemp + 0.0001f >= 0.0f) {
|
if (static_cast<float>(settings.heating.overheatProtection.lowTemp) - highTemp + 0.0001f >= 0.0f) {
|
||||||
vars.master.heating.overheat = false;
|
vars.master.heating.overheat = false;
|
||||||
|
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
@@ -1411,7 +1411,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (vars.slave.heating.active) {
|
} else if (vars.slave.heating.active) {
|
||||||
if (highTemp - (float) settings.heating.overheatProtection.highTemp + 0.0001f >= 0.0f) {
|
if (highTemp - static_cast<float>(settings.heating.overheatProtection.highTemp) + 0.0001f >= 0.0f) {
|
||||||
vars.master.heating.overheat = true;
|
vars.master.heating.overheat = true;
|
||||||
|
|
||||||
Log.swarningln(
|
Log.swarningln(
|
||||||
@@ -1441,7 +1441,7 @@ protected:
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (vars.master.dhw.overheat) {
|
if (vars.master.dhw.overheat) {
|
||||||
if ((float) settings.dhw.overheatProtection.lowTemp - highTemp + 0.0001f >= 0.0f) {
|
if (static_cast<float>(settings.dhw.overheatProtection.lowTemp) - highTemp + 0.0001f >= 0.0f) {
|
||||||
vars.master.dhw.overheat = false;
|
vars.master.dhw.overheat = false;
|
||||||
|
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
@@ -1451,7 +1451,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (vars.slave.dhw.active) {
|
} else if (vars.slave.dhw.active) {
|
||||||
if (highTemp - (float) settings.dhw.overheatProtection.highTemp + 0.0001f >= 0.0f) {
|
if (highTemp - static_cast<float>(settings.dhw.overheatProtection.highTemp) + 0.0001f >= 0.0f) {
|
||||||
vars.master.dhw.overheat = true;
|
vars.master.dhw.overheat = true;
|
||||||
|
|
||||||
Log.swarningln(
|
Log.swarningln(
|
||||||
@@ -2432,7 +2432,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float value = (float) CustomOpenTherm::getInt(response);
|
const float value = CustomOpenTherm::getInt(response);
|
||||||
if (!isValidTemp(value, settings.opentherm.unitSystem, -40, 500)) {
|
if (!isValidTemp(value, settings.opentherm.unitSystem, -40, 500)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2456,7 +2456,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float value = (float) CustomOpenTherm::getInt(response);
|
const float value = CustomOpenTherm::getInt(response);
|
||||||
if (value <= 0) {
|
if (value <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-3
@@ -18,7 +18,7 @@ extern WebSerial* webSerial;
|
|||||||
|
|
||||||
class PortalTask : public LeanTask {
|
class PortalTask : public LeanTask {
|
||||||
public:
|
public:
|
||||||
PortalTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {
|
explicit PortalTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {
|
||||||
this->webServer = new AsyncWebServer(80);
|
this->webServer = new AsyncWebServer(80);
|
||||||
this->dnsServer = new DNSServer();
|
this->dnsServer = new DNSServer();
|
||||||
}
|
}
|
||||||
@@ -810,9 +810,13 @@ protected:
|
|||||||
|
|
||||||
static void getFilename(char* filename, size_t maxSizeFilename, const char* type) {
|
static void getFilename(char* filename, size_t maxSizeFilename, const char* type) {
|
||||||
const time_t now = time(nullptr);
|
const time_t now = time(nullptr);
|
||||||
const tm* localNow = localtime(&now);
|
|
||||||
|
tm localNow {};
|
||||||
|
localtime_r(&now, &localNow);
|
||||||
|
|
||||||
char localNowValue[20];
|
char localNowValue[20];
|
||||||
strftime(localNowValue, sizeof(localNowValue), PSTR("%Y-%m-%d-%H-%M-%S"), localNow);
|
strftime(localNowValue, sizeof(localNowValue), PSTR("%Y-%m-%d-%H-%M-%S"), &localNow);
|
||||||
|
|
||||||
snprintf_P(filename, maxSizeFilename, PSTR("%s_%s_%s.json"), networkSettings.hostname, localNowValue, type);
|
snprintf_P(filename, maxSizeFilename, PSTR("%s_%s_%s.json"), networkSettings.hostname, localNowValue, type);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
+1
-1
@@ -5,7 +5,7 @@ GyverPID pidRegulator(0, 0, 0);
|
|||||||
|
|
||||||
class RegulatorTask : public LeanTask {
|
class RegulatorTask : public LeanTask {
|
||||||
public:
|
public:
|
||||||
RegulatorTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {}
|
explicit RegulatorTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float prevHeatingTarget = 0.0f;
|
float prevHeatingTarget = 0.0f;
|
||||||
|
|||||||
+5
-5
@@ -74,7 +74,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool parseAtcData(const NimBLEAdvertisedDevice* device, uint8_t sensorId) {
|
static bool parseAtcData(const NimBLEAdvertisedDevice* device, uint8_t sensorId) {
|
||||||
NimBLEUUID serviceUuid((uint16_t) 0x181A);
|
NimBLEUUID serviceUuid(static_cast<uint16_t>(0x181A));
|
||||||
|
|
||||||
auto serviceData = device->getServiceData(serviceUuid);
|
auto serviceData = device->getServiceData(serviceUuid);
|
||||||
if (!serviceData.size()) {
|
if (!serviceData.size()) {
|
||||||
@@ -125,7 +125,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool parsePvvxData(const NimBLEAdvertisedDevice* device, uint8_t sensorId) {
|
static bool parsePvvxData(const NimBLEAdvertisedDevice* device, uint8_t sensorId) {
|
||||||
NimBLEUUID serviceUuid((uint16_t) 0x181A);
|
NimBLEUUID serviceUuid(static_cast<uint16_t>(0x181A));
|
||||||
|
|
||||||
auto serviceData = device->getServiceData(serviceUuid);
|
auto serviceData = device->getServiceData(serviceUuid);
|
||||||
if (!serviceData.size()) {
|
if (!serviceData.size()) {
|
||||||
@@ -178,7 +178,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool parseBTHomeData(const NimBLEAdvertisedDevice* device, uint8_t sensorId) {
|
static bool parseBTHomeData(const NimBLEAdvertisedDevice* device, uint8_t sensorId) {
|
||||||
NimBLEUUID serviceUuid((uint16_t) 0xFCD2);
|
NimBLEUUID serviceUuid(static_cast<uint16_t>(0xFCD2));
|
||||||
|
|
||||||
auto serviceData = device->getServiceData(serviceUuid);
|
auto serviceData = device->getServiceData(serviceUuid);
|
||||||
if (!serviceData.size()) {
|
if (!serviceData.size()) {
|
||||||
@@ -304,7 +304,7 @@ public:
|
|||||||
|
|
||||||
class SensorsTask : public LeanTask {
|
class SensorsTask : public LeanTask {
|
||||||
public:
|
public:
|
||||||
SensorsTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {
|
explicit SensorsTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {
|
||||||
this->gpioLastPollingTime.reserve(2);
|
this->gpioLastPollingTime.reserve(2);
|
||||||
|
|
||||||
// OneWire
|
// OneWire
|
||||||
@@ -830,7 +830,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
const float sensorResistance = value > 1
|
const float sensorResistance = value > 1
|
||||||
? DEFAULT_NTC_REF_RESISTANCE / (DEFAULT_NTC_VREF / (float) value - 1.0f)
|
? DEFAULT_NTC_REF_RESISTANCE / (DEFAULT_NTC_VREF / static_cast<float>(value) - 1.0f)
|
||||||
: 0.0f;
|
: 0.0f;
|
||||||
const float rawTemp = 1.0f / (
|
const float rawTemp = 1.0f / (
|
||||||
1.0f / (DEFAULT_NTC_NOMINAL_TEMP + 273.15f) +
|
1.0f / (DEFAULT_NTC_NOMINAL_TEMP + 273.15f) +
|
||||||
|
|||||||
+1
-1
@@ -147,7 +147,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PROGMEM
|
#ifndef PROGMEM
|
||||||
#define PROGMEM
|
#define PROGMEM // NOLINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifndef PROGMEM
|
#ifndef PROGMEM
|
||||||
#define PROGMEM
|
#define PROGMEM // NOLINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char L_SETTINGS[] PROGMEM = "SETTINGS";
|
const char L_SETTINGS[] PROGMEM = "SETTINGS";
|
||||||
|
|||||||
+2
-2
@@ -139,7 +139,7 @@ inline bool isValidTemp(const float value, UnitSystem unit, const float min = 0.
|
|||||||
|
|
||||||
float roundf(float value, uint8_t decimals = 2) {
|
float roundf(float value, uint8_t decimals = 2) {
|
||||||
if (decimals == 0) {
|
if (decimals == 0) {
|
||||||
return (int)(value + 0.5f);
|
return static_cast<int>(value + 0.5f);
|
||||||
|
|
||||||
} else if (abs(value) < 0.00000001f) {
|
} else if (abs(value) < 0.00000001f) {
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
@@ -147,7 +147,7 @@ float roundf(float value, uint8_t decimals = 2) {
|
|||||||
|
|
||||||
float multiplier = pow10(decimals);
|
float multiplier = pow10(decimals);
|
||||||
value += 0.5f / multiplier * (value < 0.0f ? -1.0f : 1.0f);
|
value += 0.5f / multiplier * (value < 0.0f ? -1.0f : 1.0f);
|
||||||
return (int)(value * multiplier) / multiplier;
|
return static_cast<int>(value * multiplier) / multiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t getTotalHeap() {
|
inline size_t getTotalHeap() {
|
||||||
|
|||||||
@@ -19,7 +19,9 @@
|
|||||||
"rpm": "RPM",
|
"rpm": "RPM",
|
||||||
"ppm": "ppm",
|
"ppm": "ppm",
|
||||||
"byte": "byte",
|
"byte": "byte",
|
||||||
"mbyte": "MB"
|
"mbyte": "MB",
|
||||||
|
"liter": "升",
|
||||||
|
"gallon": "加仑"
|
||||||
},
|
},
|
||||||
"button": {
|
"button": {
|
||||||
"upgrade": "固件升级",
|
"upgrade": "固件升级",
|
||||||
|
|||||||
@@ -19,7 +19,9 @@
|
|||||||
"rpm": "RPM",
|
"rpm": "RPM",
|
||||||
"ppm": "ppm",
|
"ppm": "ppm",
|
||||||
"byte": "byte",
|
"byte": "byte",
|
||||||
"mbyte": "MB"
|
"mbyte": "MB",
|
||||||
|
"liter": "L",
|
||||||
|
"gallon": "gal"
|
||||||
},
|
},
|
||||||
"button": {
|
"button": {
|
||||||
"upgrade": "Upgrade",
|
"upgrade": "Upgrade",
|
||||||
|
|||||||
@@ -0,0 +1,523 @@
|
|||||||
|
{
|
||||||
|
"values": {
|
||||||
|
"logo": "",
|
||||||
|
"nav": {
|
||||||
|
"license": "",
|
||||||
|
"source": "",
|
||||||
|
"help": "",
|
||||||
|
"issues": "",
|
||||||
|
"releases": ""
|
||||||
|
},
|
||||||
|
"units": {
|
||||||
|
"days": "",
|
||||||
|
"hours": "",
|
||||||
|
"min": "",
|
||||||
|
"sec": "",
|
||||||
|
"dbm": "",
|
||||||
|
"mhz": "",
|
||||||
|
"kw": "",
|
||||||
|
"rpm": "",
|
||||||
|
"ppm": "",
|
||||||
|
"byte": "",
|
||||||
|
"mbyte": ""
|
||||||
|
},
|
||||||
|
"button": {
|
||||||
|
"upgrade": "",
|
||||||
|
"restart": "",
|
||||||
|
"save": "",
|
||||||
|
"saved": "",
|
||||||
|
"refresh": "",
|
||||||
|
"restore": "",
|
||||||
|
"restored": "",
|
||||||
|
"backup": "",
|
||||||
|
"wait": "",
|
||||||
|
"uploading": "",
|
||||||
|
"success": "",
|
||||||
|
"error": ""
|
||||||
|
},
|
||||||
|
"index": {
|
||||||
|
"title": "",
|
||||||
|
"section": {
|
||||||
|
"network": "",
|
||||||
|
"system": ""
|
||||||
|
},
|
||||||
|
"system": {
|
||||||
|
"build": {
|
||||||
|
"title": "",
|
||||||
|
"version": "",
|
||||||
|
"commit": "",
|
||||||
|
"date": "",
|
||||||
|
"core": "",
|
||||||
|
"sdk": ""
|
||||||
|
},
|
||||||
|
"uptime": "",
|
||||||
|
"memory": {
|
||||||
|
"heap": "",
|
||||||
|
"psram": "",
|
||||||
|
"maxFreeBlock": "",
|
||||||
|
"min": ""
|
||||||
|
},
|
||||||
|
"board": "",
|
||||||
|
"chip": {
|
||||||
|
"model": "",
|
||||||
|
"cores": "",
|
||||||
|
"freq": ""
|
||||||
|
},
|
||||||
|
"flash": {
|
||||||
|
"size": "",
|
||||||
|
"realSize": ""
|
||||||
|
},
|
||||||
|
"lastResetReason": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dashboard": {
|
||||||
|
"name": "",
|
||||||
|
"title": "",
|
||||||
|
"section": {
|
||||||
|
"control": "",
|
||||||
|
"states": "",
|
||||||
|
"sensors": "",
|
||||||
|
"diag": ""
|
||||||
|
},
|
||||||
|
"thermostat": {
|
||||||
|
"heating": "",
|
||||||
|
"dhw": "",
|
||||||
|
"currentTemp": "",
|
||||||
|
"enable": "",
|
||||||
|
"turbo": ""
|
||||||
|
},
|
||||||
|
"notify": {
|
||||||
|
"fault": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
},
|
||||||
|
"diag": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
},
|
||||||
|
"reset": ""
|
||||||
|
},
|
||||||
|
"states": {
|
||||||
|
"mNetworkConnected": "",
|
||||||
|
"mMqttConnected": "",
|
||||||
|
"mEmergencyState": "",
|
||||||
|
"mExtPumpState": "",
|
||||||
|
"mCascadeControlInput": "",
|
||||||
|
"mCascadeControlOutput": "",
|
||||||
|
"sConnected": "",
|
||||||
|
"sFlame": "",
|
||||||
|
"sCoolingActive": "",
|
||||||
|
"sCoolingSetpoint": "",
|
||||||
|
"sFaultActive": "",
|
||||||
|
"sFaultCode": "",
|
||||||
|
"sDiagActive": "",
|
||||||
|
"sDiagCode": "",
|
||||||
|
"mHeatEnabled": "",
|
||||||
|
"mHeatBlocking": "",
|
||||||
|
"mHeatOverheat": "",
|
||||||
|
"mHeatFreezing": "",
|
||||||
|
"sHeatActive": "",
|
||||||
|
"mHeatSetpointTemp": "",
|
||||||
|
"mHeatTargetTemp": "",
|
||||||
|
"mHeatCurrTemp": "",
|
||||||
|
"mHeatRetTemp": "",
|
||||||
|
"mHeatIndoorTemp": "",
|
||||||
|
"mHeatOutdoorTemp": "",
|
||||||
|
"mDhwEnabled": "",
|
||||||
|
"mDhwOverheat": "",
|
||||||
|
"sDhwActive": "",
|
||||||
|
"mDhwTargetTemp": "",
|
||||||
|
"mDhwCurrTemp": "",
|
||||||
|
"mDhwRetTemp": ""
|
||||||
|
},
|
||||||
|
"sensors": {
|
||||||
|
"values": {
|
||||||
|
"temp": "",
|
||||||
|
"humidity": "",
|
||||||
|
"battery": "",
|
||||||
|
"rssi": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"network": {
|
||||||
|
"title": "",
|
||||||
|
"name": "",
|
||||||
|
"section": {
|
||||||
|
"static": "",
|
||||||
|
"availableNetworks": "",
|
||||||
|
"staSettings": "",
|
||||||
|
"apSettings": ""
|
||||||
|
},
|
||||||
|
"scan": {
|
||||||
|
"pos": "",
|
||||||
|
"info": ""
|
||||||
|
},
|
||||||
|
"wifi": {
|
||||||
|
"ssid": "",
|
||||||
|
"password": "",
|
||||||
|
"channel": "",
|
||||||
|
"signal": "",
|
||||||
|
"connected": ""
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"hostname": "",
|
||||||
|
"dhcp": "",
|
||||||
|
"mac": "",
|
||||||
|
"ip": "",
|
||||||
|
"subnet": "",
|
||||||
|
"gateway": "",
|
||||||
|
"dns": ""
|
||||||
|
},
|
||||||
|
"sta": {
|
||||||
|
"channel": {
|
||||||
|
"note": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sensors": {
|
||||||
|
"title": "",
|
||||||
|
"name": "",
|
||||||
|
"enabled": "",
|
||||||
|
"sensorName": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
},
|
||||||
|
"purpose": "",
|
||||||
|
"purposes": {
|
||||||
|
"outdoorTemp": "",
|
||||||
|
"indoorTemp": "",
|
||||||
|
"heatTemp": "",
|
||||||
|
"heatRetTemp": "",
|
||||||
|
"dhwTemp": "",
|
||||||
|
"dhwRetTemp": "",
|
||||||
|
"dhwFlowRate": "",
|
||||||
|
"exhaustTemp": "",
|
||||||
|
"modLevel": "",
|
||||||
|
"number": "",
|
||||||
|
"powerFactor": "",
|
||||||
|
"power": "",
|
||||||
|
"fanSpeed": "",
|
||||||
|
"co2": "",
|
||||||
|
"pressure": "",
|
||||||
|
"humidity": "",
|
||||||
|
"temperature": "",
|
||||||
|
"notConfigured": ""
|
||||||
|
},
|
||||||
|
"type": "",
|
||||||
|
"types": {
|
||||||
|
"otOutdoorTemp": "",
|
||||||
|
"otHeatTemp": "",
|
||||||
|
"otHeatRetTemp": "",
|
||||||
|
"otDhwTemp": "",
|
||||||
|
"otDhwTemp2": "",
|
||||||
|
"otDhwFlowRate": "",
|
||||||
|
"otCh2Temp": "",
|
||||||
|
"otExhaustTemp": "",
|
||||||
|
"otHeatExchangerTemp": "",
|
||||||
|
"otPressure": "",
|
||||||
|
"otModLevel": "",
|
||||||
|
"otCurrentPower": "",
|
||||||
|
"otExhaustCo2": "",
|
||||||
|
"otExhaustFanSpeed": "",
|
||||||
|
"otSupplyFanSpeed": "",
|
||||||
|
"otSolarStorageTemp": "",
|
||||||
|
"otSolarCollectorTemp": "",
|
||||||
|
"otFanSpeedSetpoint": "",
|
||||||
|
"otFanSpeedCurrent": "",
|
||||||
|
"otBurnerStarts": "",
|
||||||
|
"otDhwBurnerStarts": "",
|
||||||
|
"otHeatingPumpStarts": "",
|
||||||
|
"otDhwPumpStarts": "",
|
||||||
|
"otBurnerHours": "",
|
||||||
|
"otDhwBurnerHours": "",
|
||||||
|
"otHeatingPumpHours": "",
|
||||||
|
"otDhwPumpHours": "",
|
||||||
|
"otCoolingHours": "",
|
||||||
|
"ntcTemp": "",
|
||||||
|
"dallasTemp": "",
|
||||||
|
"bluetooth": "",
|
||||||
|
"dht11": "",
|
||||||
|
"dht22": "",
|
||||||
|
"heatSetpointTemp": "",
|
||||||
|
"manual": "",
|
||||||
|
"notConfigured": ""
|
||||||
|
},
|
||||||
|
"gpio": "",
|
||||||
|
"address": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
},
|
||||||
|
"correction": {
|
||||||
|
"desc": "",
|
||||||
|
"offset": "",
|
||||||
|
"factor": ""
|
||||||
|
},
|
||||||
|
"filtering": {
|
||||||
|
"desc": "",
|
||||||
|
"enabled": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
},
|
||||||
|
"factor": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"title": "",
|
||||||
|
"name": "",
|
||||||
|
"section": {
|
||||||
|
"portal": "",
|
||||||
|
"system": "",
|
||||||
|
"diag": "",
|
||||||
|
"heating": "",
|
||||||
|
"dhw": "",
|
||||||
|
"emergency": "",
|
||||||
|
"equitherm": "",
|
||||||
|
"pid": "",
|
||||||
|
"ot": "",
|
||||||
|
"mqtt": "",
|
||||||
|
"extPump": "",
|
||||||
|
"cascadeControl": ""
|
||||||
|
},
|
||||||
|
"enable": "",
|
||||||
|
"note": {
|
||||||
|
"restart": "",
|
||||||
|
"blankNotUse": "",
|
||||||
|
"bleDevice": ""
|
||||||
|
},
|
||||||
|
"temp": {
|
||||||
|
"min": "",
|
||||||
|
"max": ""
|
||||||
|
},
|
||||||
|
"avgType": {
|
||||||
|
"mean": "",
|
||||||
|
"min": "",
|
||||||
|
"max": ""
|
||||||
|
},
|
||||||
|
"maxModulation": "",
|
||||||
|
"ohProtection": {
|
||||||
|
"title": "",
|
||||||
|
"desc": "",
|
||||||
|
"highTemp": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
},
|
||||||
|
"lowTemp": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"freezeProtection": {
|
||||||
|
"title": "",
|
||||||
|
"desc": "",
|
||||||
|
"highTemp": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
},
|
||||||
|
"lowTemp": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"portal": {
|
||||||
|
"login": "",
|
||||||
|
"password": "",
|
||||||
|
"auth": "",
|
||||||
|
"mdns": ""
|
||||||
|
},
|
||||||
|
"system": {
|
||||||
|
"unit": "",
|
||||||
|
"metric": "",
|
||||||
|
"imperial": "",
|
||||||
|
"statusLedGpio": "",
|
||||||
|
"logLevel": "",
|
||||||
|
"serial": {
|
||||||
|
"enable": "",
|
||||||
|
"baud": ""
|
||||||
|
},
|
||||||
|
"webSerial": {
|
||||||
|
"enable": ""
|
||||||
|
},
|
||||||
|
"ntp": {
|
||||||
|
"server": "",
|
||||||
|
"timezone": "",
|
||||||
|
"timezonePresets": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"heating": {
|
||||||
|
"hyst": {
|
||||||
|
"title": "",
|
||||||
|
"desc": "",
|
||||||
|
"value": "",
|
||||||
|
"action": {
|
||||||
|
"title": "",
|
||||||
|
"disableHeating": "",
|
||||||
|
"set0target": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"turboFactor": "",
|
||||||
|
"indoorTempAvgType": {
|
||||||
|
"title": "",
|
||||||
|
"desc": ""
|
||||||
|
},
|
||||||
|
"outdoorTempAvgType": {
|
||||||
|
"title": "",
|
||||||
|
"desc": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"emergency": {
|
||||||
|
"desc": "",
|
||||||
|
"target": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
},
|
||||||
|
"treshold": ""
|
||||||
|
},
|
||||||
|
"equitherm": {
|
||||||
|
"slope": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
},
|
||||||
|
"exponent": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
},
|
||||||
|
"shift": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
},
|
||||||
|
"targetDiffFactor": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
},
|
||||||
|
"chart": {
|
||||||
|
"targetTemp": "",
|
||||||
|
"setpointTemp": "",
|
||||||
|
"outdoorTemp": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pid": {
|
||||||
|
"p": "",
|
||||||
|
"i": "",
|
||||||
|
"d": "",
|
||||||
|
"dt": "",
|
||||||
|
"limits": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
},
|
||||||
|
"deadband": {
|
||||||
|
"title": "",
|
||||||
|
"note": "",
|
||||||
|
"p_multiplier": "",
|
||||||
|
"i_multiplier": "",
|
||||||
|
"d_multiplier": "",
|
||||||
|
"thresholdHigh": "",
|
||||||
|
"thresholdLow": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ot": {
|
||||||
|
"advanced": "",
|
||||||
|
"inGpio": "",
|
||||||
|
"outGpio": "",
|
||||||
|
"ledGpio": "",
|
||||||
|
"memberId": "",
|
||||||
|
"flags": "",
|
||||||
|
"minPower": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
},
|
||||||
|
"maxPower": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"title": "",
|
||||||
|
"desc": "",
|
||||||
|
"dhwSupport": "",
|
||||||
|
"coolingSupport": "",
|
||||||
|
"summerWinterMode": "",
|
||||||
|
"heatingStateToSummerWinterMode": "",
|
||||||
|
"ch2AlwaysEnabled": "",
|
||||||
|
"heatingToCh2": "",
|
||||||
|
"dhwToCh2": "",
|
||||||
|
"dhwBlocking": "",
|
||||||
|
"dhwStateAsDhwBlocking": "",
|
||||||
|
"maxTempSyncWithTargetTemp": "",
|
||||||
|
"getMinMaxTemp": "",
|
||||||
|
"ignoreDiagState": "",
|
||||||
|
"autoFaultReset": "",
|
||||||
|
"autoDiagReset": "",
|
||||||
|
"setDateAndTime": "",
|
||||||
|
"immergasFix": "",
|
||||||
|
"alwaysSendIndoorTemp": ""
|
||||||
|
},
|
||||||
|
"nativeOTC": {
|
||||||
|
"title": "",
|
||||||
|
"note": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mqtt": {
|
||||||
|
"homeAssistantDiscovery": "",
|
||||||
|
"server": "",
|
||||||
|
"port": "",
|
||||||
|
"user": "",
|
||||||
|
"password": "",
|
||||||
|
"prefix": "",
|
||||||
|
"interval": ""
|
||||||
|
},
|
||||||
|
"extPump": {
|
||||||
|
"use": "",
|
||||||
|
"gpio": "",
|
||||||
|
"invertState": "",
|
||||||
|
"postCirculationTime": "",
|
||||||
|
"antiStuckInterval": "",
|
||||||
|
"antiStuckTime": ""
|
||||||
|
},
|
||||||
|
"cascadeControl": {
|
||||||
|
"input": {
|
||||||
|
"desc": "",
|
||||||
|
"enable": "",
|
||||||
|
"gpio": "",
|
||||||
|
"invertState": "",
|
||||||
|
"thresholdTime": ""
|
||||||
|
},
|
||||||
|
"output": {
|
||||||
|
"desc": "",
|
||||||
|
"enable": "",
|
||||||
|
"gpio": "",
|
||||||
|
"invertState": "",
|
||||||
|
"thresholdTime": "",
|
||||||
|
"events": {
|
||||||
|
"desc": "",
|
||||||
|
"onFault": "",
|
||||||
|
"onLossConnection": "",
|
||||||
|
"onEnabledHeating": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"upgrade": {
|
||||||
|
"title": "",
|
||||||
|
"name": "",
|
||||||
|
"section": {
|
||||||
|
"backupAndRestore": {
|
||||||
|
"title": "",
|
||||||
|
"desc": ""
|
||||||
|
},
|
||||||
|
"upgrade": {
|
||||||
|
"title": "",
|
||||||
|
"desc": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"note": {
|
||||||
|
"disclaimer1": "",
|
||||||
|
"disclaimer2": ""
|
||||||
|
},
|
||||||
|
"settingsFile": "",
|
||||||
|
"fw": "",
|
||||||
|
"fs": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,7 +19,9 @@
|
|||||||
"rpm": "RPM",
|
"rpm": "RPM",
|
||||||
"ppm": "ppm",
|
"ppm": "ppm",
|
||||||
"byte": "byte",
|
"byte": "byte",
|
||||||
"mbyte": "MB"
|
"mbyte": "MB",
|
||||||
|
"liter": "litro",
|
||||||
|
"gallon": "gal"
|
||||||
},
|
},
|
||||||
"button": {
|
"button": {
|
||||||
"upgrade": "Aggiorna",
|
"upgrade": "Aggiorna",
|
||||||
|
|||||||
@@ -19,7 +19,9 @@
|
|||||||
"rpm": "RPM",
|
"rpm": "RPM",
|
||||||
"ppm": "ppm",
|
"ppm": "ppm",
|
||||||
"byte": "byte",
|
"byte": "byte",
|
||||||
"mbyte": "MB"
|
"mbyte": "MB",
|
||||||
|
"liter": "L",
|
||||||
|
"gallon": "gal"
|
||||||
},
|
},
|
||||||
"button": {
|
"button": {
|
||||||
"upgrade": "Upgraden",
|
"upgrade": "Upgraden",
|
||||||
|
|||||||
@@ -19,7 +19,9 @@
|
|||||||
"rpm": "RPM",
|
"rpm": "RPM",
|
||||||
"ppm": "ppm",
|
"ppm": "ppm",
|
||||||
"byte": "байт",
|
"byte": "байт",
|
||||||
"mbyte": "мбайт"
|
"mbyte": "мбайт",
|
||||||
|
"liter": "Л.",
|
||||||
|
"gallon": "гал."
|
||||||
},
|
},
|
||||||
"button": {
|
"button": {
|
||||||
"upgrade": "Обновить",
|
"upgrade": "Обновить",
|
||||||
|
|||||||
@@ -351,9 +351,14 @@
|
|||||||
value = -(step);
|
value = -(step);
|
||||||
}
|
}
|
||||||
|
|
||||||
newSettings[purpose].target = parseFloat(constrain(newSettings[purpose].target + value, minTemp, maxTemp).toFixed(2));
|
const newValue = parseFloat(constrain(newSettings[purpose].target + value, minTemp, maxTemp).toFixed(2));
|
||||||
modifiedTime = Date.now();
|
if (newSettings[purpose].target != newValue) {
|
||||||
setValue('.targetTemp', newSettings[purpose].target, tContainer);
|
newSettings[purpose].target = newValue;
|
||||||
|
modifiedTime = Date.now();
|
||||||
|
|
||||||
|
setValue('.targetTemp', newValue, tContainer);
|
||||||
|
tContainer.querySelector('.thermostat-header').setAttribute("aria-busy", "true");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -383,27 +388,46 @@
|
|||||||
value = -(bigStep);
|
value = -(bigStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
newSettings[purpose].target = parseFloat(constrain(newSettings[purpose].target + value, minTemp, maxTemp).toFixed(2));
|
const newValue = parseFloat(constrain(newSettings[purpose].target + value, minTemp, maxTemp).toFixed(2));
|
||||||
modifiedTime = Date.now();
|
if (newSettings[purpose].target != newValue) {
|
||||||
|
newSettings[purpose].target = newValue;
|
||||||
|
modifiedTime = Date.now();
|
||||||
|
|
||||||
setValue('.targetTemp', newSettings[purpose].target, tContainer);
|
setValue('.targetTemp', newSettings[purpose].target, tContainer);
|
||||||
|
tContainer.querySelector('.thermostat-header').setAttribute("aria-busy", "true");
|
||||||
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
document.querySelector('#tHeatEnabled').addEventListener('change', (event) => {
|
document.querySelector('#tHeatEnabled').addEventListener('change', (event) => {
|
||||||
|
if (newSettings.heating.enabled == event.currentTarget.checked) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
modifiedTime = Date.now();
|
modifiedTime = Date.now();
|
||||||
newSettings.heating.enabled = event.currentTarget.checked;
|
newSettings.heating.enabled = event.currentTarget.checked;
|
||||||
|
document.querySelector('.tHeat .thermostat-header').setAttribute("aria-busy", "true");
|
||||||
});
|
});
|
||||||
|
|
||||||
document.querySelector('#tHeatTurbo').addEventListener('change', (event) => {
|
document.querySelector('#tHeatTurbo').addEventListener('change', (event) => {
|
||||||
|
if (newSettings.heating.turbo == event.currentTarget.checked) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
modifiedTime = Date.now();
|
modifiedTime = Date.now();
|
||||||
newSettings.heating.turbo = event.currentTarget.checked;
|
newSettings.heating.turbo = event.currentTarget.checked;
|
||||||
|
document.querySelector('.tHeat .thermostat-header').setAttribute("aria-busy", "true");
|
||||||
});
|
});
|
||||||
|
|
||||||
document.querySelector('#tDhwEnabled').addEventListener('change', (event) => {
|
document.querySelector('#tDhwEnabled').addEventListener('change', (event) => {
|
||||||
|
if (newSettings.dhw.enabled == event.currentTarget.checked) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
modifiedTime = Date.now();
|
modifiedTime = Date.now();
|
||||||
newSettings.dhw.enabled = event.currentTarget.checked;
|
newSettings.dhw.enabled = event.currentTarget.checked;
|
||||||
|
document.querySelector('.tDhw .thermostat-header').setAttribute("aria-busy", "true");
|
||||||
});
|
});
|
||||||
|
|
||||||
document.querySelector('.notify-fault .reset').addEventListener('click', async (event) => {
|
document.querySelector('.notify-fault .reset').addEventListener('click', async (event) => {
|
||||||
@@ -531,6 +555,10 @@
|
|||||||
setValue('.pressureUnit', pressureUnit(unitSystem));
|
setValue('.pressureUnit', pressureUnit(unitSystem));
|
||||||
setValue('.volumeUnit', volumeUnit(unitSystem));
|
setValue('.volumeUnit', volumeUnit(unitSystem));
|
||||||
|
|
||||||
|
document.querySelectorAll('.thermostat-header').forEach((item) => {
|
||||||
|
item.setAttribute("aria-busy", "false");
|
||||||
|
});
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -807,7 +807,7 @@
|
|||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="externalPump[invertState]" value="true">
|
<input type="checkbox" name="externalPump[invertState]" value="true">
|
||||||
<span data-i18n>settings.externalPump.invertState</span>
|
<span data-i18n>settings.extPump.invertState</span>
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ const setupRestoreBackupForm = (formSelector) => {
|
|||||||
console.log("Backup: ", data);
|
console.log("Backup: ", data);
|
||||||
|
|
||||||
if (data.settings != undefined) {
|
if (data.settings != undefined) {
|
||||||
for (var key in data.settings) {
|
for (const key in data.settings) {
|
||||||
let response = await fetch(url, {
|
let response = await fetch(url, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
cache: "no-cache",
|
cache: "no-cache",
|
||||||
@@ -338,6 +338,41 @@ const setupRestoreBackupForm = (formSelector) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let finalPayload = {};
|
||||||
|
if (data.settings.emergency?.target !== undefined) {
|
||||||
|
finalPayload.emergency ??= {};
|
||||||
|
finalPayload.emergency.target = data.settings.emergency.target;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.settings.heating?.target !== undefined) {
|
||||||
|
finalPayload.heating ??= {};
|
||||||
|
finalPayload.heating.target = data.settings.heating.target;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.settings.dhw?.target !== undefined) {
|
||||||
|
finalPayload.dhw ??= {};
|
||||||
|
finalPayload.dhw.target = data.settings.dhw.target;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Object.keys(finalPayload).length) {
|
||||||
|
let response = await fetch(url, {
|
||||||
|
method: "POST",
|
||||||
|
cache: "no-cache",
|
||||||
|
credentials: "include",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
"settings": finalPayload
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
onFailed();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.sensors != undefined) {
|
if (data.sensors != undefined) {
|
||||||
@@ -765,8 +800,8 @@ const pressureUnit = (unitSystem) => {
|
|||||||
|
|
||||||
const volumeUnit = (unitSystem) => {
|
const volumeUnit = (unitSystem) => {
|
||||||
return unit2str(unitSystem, {
|
return unit2str(unitSystem, {
|
||||||
0: "L",
|
0: i18n('units.liter'),
|
||||||
1: "gal"
|
1: i18n('units.gallon')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -780,7 +815,7 @@ const purposeUnit = (purpose, unitSystem) => {
|
|||||||
3: tUnit,
|
3: tUnit,
|
||||||
4: tUnit,
|
4: tUnit,
|
||||||
5: tUnit,
|
5: tUnit,
|
||||||
6: `${volumeUnit(unitSystem)}/${i18n('time.min')}`,
|
6: `${volumeUnit(unitSystem)}/${i18n('units.min')}`,
|
||||||
7: tUnit,
|
7: tUnit,
|
||||||
8: "%",
|
8: "%",
|
||||||
248: "%",
|
248: "%",
|
||||||
|
|||||||
Reference in New Issue
Block a user