38 Commits
1.4.3 ... 1.4.5

Author SHA1 Message Date
Yurii
05ff426b28 chore: bump version to 1.4.5 2024-10-13 22:39:20 +03:00
Yurii
45af7a30d8 refactor: cosmetic changes; added coeff. setting for filtering numeric values 2024-10-13 21:42:33 +03:00
Yurii
8aab541afa fix: added min DHW flow rate of 0.1 l/min 2024-10-11 01:38:05 +03:00
Yurii
7672c4b927 fix: fix types 2024-10-11 01:33:49 +03:00
Yurii
b0a9460257 feat: added correction coeff. settings for pressure and dhw flow rate 2024-10-11 01:29:50 +03:00
Yurii
3c69f1295e feat: added opentherm option for filtering numeric values 2024-10-10 21:08:13 +03:00
Yurii
282a02ecdb fix: added request for set opentherm version 2024-10-09 12:33:58 +03:00
Yurii
8503ef966f fix: small fix 2024-10-05 10:27:16 +03:00
Yurii
a4ee4c5224 feat: added diagnostic code polling via opentherm, added hex value for fault code and diag code 2024-10-05 10:03:14 +03:00
Yurii
4478e8f204 chore: updated platformio.ini for ESP32 C6 2024-10-01 01:45:57 +03:00
Yurii
a50c13fd8a Merge branch 'master' of https://github.com/Laxilef/OTGateway 2024-10-01 01:39:27 +03:00
Yurii
ee1e7f92b2 fix: added delay before start web server 2024-10-01 01:39:23 +03:00
Yurii
5704075682 chore: switch from PaulStoffregen/OneWire to pstolarz/OneWireNg 2024-10-01 01:38:57 +03:00
Yurii
52e4933923 fix: compatibility with framework-arduinoespressif32 version 3.0.5 2024-10-01 01:36:44 +03:00
Yurii
00a82ca3e5 chore: switch from espressif/arduino-esp32 to pioarduino/platform-espressif32 for new core 2024-10-01 01:35:36 +03:00
Yurii
7658aeaa8c feat: added opentherm option 'immergasFix' 2024-10-01 01:32:35 +03:00
Yurii
790ff5a011 feat: added Radiant to vendor list 2024-09-30 23:56:52 +03:00
dependabot[bot]
935cf27139 chore: bump peterus/platformio_dependabot from 1.1.1 to 1.2.0 (#80)
Bumps [peterus/platformio_dependabot](https://github.com/peterus/platformio_dependabot) from 1.1.1 to 1.2.0.
- [Release notes](https://github.com/peterus/platformio_dependabot/releases)
- [Commits](https://github.com/peterus/platformio_dependabot/compare/v1.1.1...v1.2.0)

---
updated-dependencies:
- dependency-name: peterus/platformio_dependabot
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-14 00:36:24 +03:00
Yurii
503068f6e7 chore: update readme 2024-09-06 20:29:50 +03:00
Yurii
5c868d589d chore: update files for production 2024-09-06 20:25:29 +03:00
Yurii
1cca8ffd5d chore: update assets 2024-09-06 19:40:30 +03:00
Yurii
f291eb33ac chore: added assets 2024-09-03 18:00:12 +03:00
Yurii
f0c505c332 chore: added blueprints 2024-09-03 17:38:59 +03:00
Yurii
7eafe4a90b fix: compatibility with framework-arduinoespressif32 version 3.0.4 2024-08-22 04:57:13 +03:00
Yurii
d23527a48b chore: bump framework-arduinoespressif32 from 3.0.1 to 3.0.4 2024-08-22 03:34:17 +03:00
Yurii
c341f86e5c refactor: cosmetic changes 2024-08-22 03:33:12 +03:00
Yurii
939ed6cdab chore: bump bblanchon/ArduinoJson from 7.0.4 to 7.1.0 2024-08-22 00:46:13 +03:00
Yurii
2da41707a9 chore: bump version to 1.4.4 2024-08-20 23:39:50 +03:00
Yurii
460cb01146 chore: removed wowki support 2024-08-20 23:28:09 +03:00
Yurii
1b2bc8e200 feat: added feat use of BLE external sensor; added events onIndoorSensorDisconnect and onOutdoorSensorDisconnect for emergency mode; added polling of rssi, humidity, battery for BLE sensors 2024-08-20 19:06:18 +03:00
Yurii
d5acb44648 fix: text of action buttons fixed 2024-08-20 19:01:08 +03:00
Yurii
c64cf41757 Merge branch 'master' of https://github.com/Laxilef/OTGateway 2024-08-20 02:13:42 +03:00
Yurii
9250bb26f2 fix: locale detection error fixed 2024-08-19 14:45:06 +03:00
dependabot[bot]
b2c6eca2d5 chore: bump peterus/platformio_dependabot from 1.1.0 to 1.1.1 (#77)
Bumps [peterus/platformio_dependabot](https://github.com/peterus/platformio_dependabot) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/peterus/platformio_dependabot/releases)
- [Commits](https://github.com/peterus/platformio_dependabot/compare/v1.1.0...v1.1.1)

---
updated-dependencies:
- dependency-name: peterus/platformio_dependabot
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-02 17:27:41 +03:00
Yurii
5cec043015 chore: bump platformio_dependabot to 1.1.0 2024-06-22 20:28:44 +03:00
github-actions[bot]
7c9a483677 chore: Bump NimBLE-Arduino to 1.4.2 (#75) 2024-06-21 04:18:17 +03:00
github-actions[bot]
1bfe7a688a chore: Bump TinyLogger to 1.1.1 (#74)
Co-authored-by: root <root@5e361a757fb5>
2024-06-21 04:17:22 +03:00
Yurii
05104aa8eb chore: create dependabot.yml, pio-dependabot.yaml 2024-06-21 03:44:25 +03:00
41 changed files with 11175 additions and 6168 deletions

11
.github/dependabot.yaml vendored Normal file
View File

@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

22
.github/workflows/pio-dependabot.yaml vendored Normal file
View 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@v4
- name: run PlatformIO Dependabot
uses: peterus/platformio_dependabot@v1.2.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -42,7 +42,7 @@ All available information and instructions can be found in the wiki:
* [Quick Start](https://github.com/Laxilef/OTGateway/wiki#quick-start)
* [Build firmware](https://github.com/Laxilef/OTGateway/wiki#build-firmware)
* [Flash firmware via ESP Flash Download Tool](https://github.com/Laxilef/OTGateway/wiki#flash-firmware-via-esp-flash-download-tool)
* [HomeAsssistant settings](https://github.com/Laxilef/OTGateway/wiki#homeasssistant-settings)
* [Settings](https://github.com/Laxilef/OTGateway/wiki#settings)
* [External temperature sensors](https://github.com/Laxilef/OTGateway/wiki#external-temperature-sensors)
* [Reporting indoor/outdoor temperature from any Home Assistant sensor](https://github.com/Laxilef/OTGateway/wiki#reporting-indooroutdoor-temperature-from-any-home-assistant-sensor)
* [Reporting outdoor temperature from Home Assistant weather integration](https://github.com/Laxilef/OTGateway/wiki#reporting-outdoor-temperature-from-home-assistant-weather-integration)

BIN
assets/2D_PCB_bottom.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 KiB

BIN
assets/2D_PCB_top.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

BIN
assets/3D_PCB.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 KiB

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" height="40" aria-label="Import blueprint to My Home Assistant" style="border-radius:24px;width:auto" viewBox="0 0 592 96">
<rect width="592" height="96" fill="#18BCF2" rx="48"/>
<path fill="#fff" d="M42.55 60.2h4.59V36.75h-4.59Zm10.35 0h4.59V43.99l7.23 10.58 7.24-10.62V60.2h4.56V36.75h-4.56v.03l-.4-.03-6.84 10.12-6.83-10.12-.4.03v-.03H52.9Zm29.38 0h4.59v-7.77h4.49c4.72 0 8.07-3.29 8.07-7.87 0-4.59-3.48-7.88-8.44-7.84l-4.66.03h-4.05Zm8.61-19.26c2.27-.04 3.88 1.47 3.88 3.62 0 2.14-1.47 3.65-3.51 3.65h-4.39v-7.27Zm22.98 19.66c6.97 0 11.92-5.02 11.92-12.09 0-7.1-4.95-12.13-12.02-12.13-7.04 0-12 4.99-12 12.13 0 7.07 5 12.09 12.1 12.09m0-4.19c-4.36 0-7.41-3.28-7.41-7.9 0-4.66 3.02-7.94 7.31-7.94 4.32 0 7.33 3.28 7.33 7.94 0 4.62-2.98 7.9-7.23 7.9m16.31 3.79h4.59v-8.31h3.52l4.79 8.31h5.19l-5.42-9.11c2.71-1.21 4.48-3.69 4.48-6.77 0-4.45-3.48-7.64-8.44-7.6l-4.65.03h-4.06Zm8.51-19.26c2.28 0 3.89 1.37 3.89 3.38 0 1.98-1.61 3.38-3.65 3.38h-4.16v-6.76Zm18.33 19.26h4.59V40.94h7v-4.19h-18.63v4.19h7.04Zm23.91 0h9.02c4.69 0 7.77-2.41 7.77-6.7 0-2.65-1.24-4.42-3.42-5.53 1.64-1.17 2.61-2.78 2.61-4.55 0-4.43-3.21-6.7-8.04-6.7l-3.45.03h-4.49Zm7.68-19.8c2.21-.03 3.61 1.07 3.61 2.95s-1.27 2.95-3.25 2.95h-3.55v-5.9Zm.53 9.65c2.41-.03 3.89 1.17 3.89 3.08 0 1.81-1.34 3.02-3.52 3.02h-4.09v-6.1h.24Zm12.97 10.15h14.9v-4.19H206.7V36.75h-4.59Zm18.32-8.74c0 5.62 3.69 9.21 9.51 9.21 5.9 0 9.65-3.59 9.65-9.21V36.75H235v14.71c0 3.01-1.97 4.95-4.99 4.95-3.01 0-4.99-1.94-4.99-4.95V36.75h-4.59Zm24.59 8.74h14.97v-4.19h-10.38v-5.66h8.84v-4.09h-8.84v-5.32h10.25v-4.19h-14.84Zm20.4 0h4.59v-7.77h4.49c4.72 0 8.07-3.29 8.07-7.87 0-4.59-3.48-7.88-8.44-7.84l-4.66.03h-4.05Zm8.61-19.26c2.28-.04 3.89 1.47 3.89 3.62 0 2.14-1.48 3.65-3.52 3.65h-4.39v-7.27Zm12.26 19.26h4.59v-8.31h3.52l4.79 8.31h5.19l-5.43-9.11c2.72-1.21 4.49-3.69 4.49-6.77 0-4.45-3.48-7.64-8.44-7.6l-4.65.03h-4.06Zm8.51-19.26c2.28 0 3.89 1.37 3.89 3.38 0 1.98-1.61 3.38-3.65 3.38h-4.16v-6.76Zm13.77 19.26h4.59V36.75h-4.59Zm10.35 0 4.59.03V44.12l11.66 16.08h4.55V36.75h-4.55v15.81l-11.46-15.81h-4.79Zm31.52 0h4.59V40.94h7.01v-4.19h-18.63v4.19h7.03Zm28.88 0h4.59V40.94h7v-4.19h-18.62v4.19h7.03Zm26 .4c6.97 0 11.92-5.02 11.92-12.09 0-7.1-4.95-12.13-12.02-12.13-7.04 0-12 4.99-12 12.13 0 7.07 5 12.09 12.1 12.09m0-4.19c-4.36 0-7.41-3.28-7.41-7.9 0-4.66 3.02-7.94 7.31-7.94 4.32 0 7.33 3.28 7.33 7.94 0 4.62-2.98 7.9-7.23 7.9"/>
<g style="transform:translate(95px,0)">
<rect width="137" height="64" x="344" y="16" fill="#F2F4F9" rx="32"/>
<path fill="#18BCF2" d="M394.419 37.047V60.5h-4.297V46.797L384.716 60.5h-4.157l-5.343-13.594V60.5h-4.188V37.047h4.188l7.422 18.36 7.484-18.36zm9.365 0 5.344 9.89 5.344-9.89h4.766l-7.969 14.14V60.5h-4.391v-9.312l-8.031-14.141zM457 60c0 1.65-1.35 3-3 3h-24c-1.65 0-3-1.35-3-3v-9c0-1.65.95-3.95 2.12-5.12l10.76-10.76a3 3 0 0 1 4.24 0l10.76 10.76c1.17 1.17 2.12 3.47 2.12 5.12z"/>
<path fill="#F2F4F9" stroke="#F2F4F9" d="M442 45.5a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"/>
<path fill="#F2F4F9" stroke="#F2F4F9" stroke-miterlimit="10" d="M449.5 53.5a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM434.5 57.5a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"/>
<path fill="none" stroke="#F2F4F9" stroke-miterlimit="10" stroke-width="2.25" d="M442 43.48V63l-7.5-7.5M449.5 51.46l-7.41 7.41"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

View File

@@ -1,3 +1,6 @@
# Package for Home Assistant Packages
# More info: https://www.home-assistant.io/docs/configuration/packages/
dhw_meter:
sensor:
- platform: integration

View File

@@ -1,29 +0,0 @@
# Script for reporting outdoor temperature to the controller from home assistant weather integration
# Updated: 07.12.2023
alias: Report outdoor temp to controller from weather
description: ""
variables:
# The source weather from which we take the temperature
source_entity: "weather.home"
# Target entity number where we set the temperature
# If the prefix has not changed, then you do not need to change it
target_entity: "number.opentherm_outdoor_temp"
trigger:
- platform: time_pattern
seconds: /30
condition:
- condition: template
value_template: "{{ states(source_entity) != 'unavailable' and states(target_entity) != 'unavailable' }}"
action:
- if:
- condition: template
value_template: "{{ (state_attr(source_entity, 'temperature')|float(0) - states(target_entity)|float(0)) | abs | round(2) >= 0.1 }}"
then:
- service: number.set_value
data:
value: "{{ state_attr(source_entity, 'temperature')|float(0)|round(2) }}"
target:
entity_id: "{{ target_entity }}"
mode: single

View File

@@ -1,30 +0,0 @@
# Script for reporting indoor/outdoor temperature to the controller from any home assistant sensor
# Updated: 07.12.2023
alias: Report temp to controller
description: ""
variables:
# The source sensor from which we take the temperature
source_entity: "sensor.livingroom_temperature"
# Target entity number where we set the temperature
# To report indoor temperature: number.opentherm_indoor_temp
# To report outdoor temperature: number.opentherm_outdoor_temp
target_entity: "number.opentherm_indoor_temp"
trigger:
- platform: time_pattern
seconds: /30
condition:
- condition: template
value_template: "{{ states(source_entity) != 'unavailable' and states(target_entity) != 'unavailable' }}"
action:
- if:
- condition: template
value_template: "{{ (states(source_entity)|float(0) - states(target_entity)|float(0)) | abs | round(2) >= 0.01 }}"
then:
- service: number.set_value
data:
value: "{{ states(source_entity)|float(0)|round(2) }}"
target:
entity_id: "{{ target_entity }}"
mode: single

View File

@@ -0,0 +1,48 @@
# Blueprint for reporting indoor/outdoor temperature to OpenTherm Gateway from any home assistant sensor
# Updated: 03.09.2024
blueprint:
name: Report temp to OpenTherm Gateway
domain: automation
author: "Laxilef"
input:
source_entity:
name: Source entity
description: "Temperature data source"
selector:
entity:
multiple: false
filter:
- domain: sensor
device_class: temperature
target_entity:
name: Target entity
description: "Usually ``number.opentherm_indoor_temp`` or ``number.opentherm_outdoor_temp``"
default: "number.opentherm_indoor_temp"
selector:
entity:
multiple: false
filter:
- domain: number
mode: single
variables:
source_entity: !input source_entity
target_entity: !input target_entity
trigger:
- platform: time_pattern
seconds: /30
condition:
- condition: template
value_template: "{{ states(source_entity) != 'unavailable' and states(target_entity) != 'unavailable' }}"
action:
- if:
- condition: template
value_template: "{{ (states(source_entity)|float(0) - states(target_entity)|float(0)) | abs | round(2) >= 0.01 }}"
then:
- service: number.set_value
data:
value: "{{ states(source_entity)|float(0)|round(2) }}"
target:
entity_id: "{{ target_entity }}"

View File

@@ -0,0 +1,47 @@
# Blueprint for reporting temperature to OpenTherm Gateway from home assistant weather integration
# Updated: 03.09.2024
blueprint:
name: Report temp to OpenTherm Gateway from Weather
domain: automation
author: "Laxilef"
input:
source_entity:
name: Source entity
description: "Temperature data source"
selector:
entity:
multiple: false
filter:
- domain: weather
target_entity:
name: Target entity
description: "Usually ``number.opentherm_outdoor_temp``"
default: "number.opentherm_outdoor_temp"
selector:
entity:
multiple: false
filter:
- domain: number
mode: single
variables:
source_entity: !input source_entity
target_entity: !input target_entity
trigger:
- platform: time_pattern
seconds: /30
condition:
- condition: template
value_template: "{{ states(source_entity) != 'unavailable' and states(target_entity) != 'unavailable' }}"
action:
- if:
- condition: template
value_template: "{{ (state_attr(source_entity, 'temperature')|float(0) - states(target_entity)|float(0)) | abs | round(2) >= 0.1 }}"
then:
- service: number.set_value
data:
value: "{{ state_attr(source_entity, 'temperature')|float(0)|round(2) }}"
target:
entity_id: "{{ target_entity }}"

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 675 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 KiB

View File

@@ -79,7 +79,7 @@ public:
}
}
unsigned long setBoilerStatus(bool enableCentralHeating, bool enableHotWater, bool enableCooling, bool enableOutsideTemperatureCompensation, bool enableCentralHeating2, bool summerWinterMode, bool dhwBlocking) {
unsigned long setBoilerStatus(bool enableCentralHeating, bool enableHotWater, bool enableCooling, bool enableOutsideTemperatureCompensation, bool enableCentralHeating2, bool summerWinterMode, bool dhwBlocking, uint8_t lb = 0) {
unsigned int data = enableCentralHeating
| (enableHotWater << 1)
| (enableCooling << 2)
@@ -87,7 +87,9 @@ public:
| (enableCentralHeating2 << 4)
| (summerWinterMode << 5)
| (dhwBlocking << 6);
data <<= 8;
data |= lb;
return this->sendRequest(buildRequest(
OpenThermMessageType::READ_DATA,

View File

@@ -33,18 +33,16 @@ public:
}
#if defined(ARDUINO_ARCH_ESP32)
bool canHandle(HTTPMethod method, const String uri) override {
#else
bool canHandle(HTTPMethod method, const String& uri) override {
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));
}
#if defined(ARDUINO_ARCH_ESP32)
bool handle(WebServer& server, HTTPMethod method, const String uri) override {
#else
bool handle(WebServer& server, HTTPMethod method, const String& uri) override {
#endif
if (!this->canHandle(method, uri)) {
return false;
}

View File

@@ -28,18 +28,16 @@ public:
}
#if defined(ARDUINO_ARCH_ESP32)
bool canHandle(HTTPMethod method, const String uri) override {
#else
bool canHandle(HTTPMethod method, const String& uri) override {
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_GET && uri.equals(this->uri) && (!this->canHandleCallback || this->canHandleCallback(method, uri));
}
#if defined(ARDUINO_ARCH_ESP32)
bool handle(WebServer& server, HTTPMethod method, const String uri) override {
#else
bool handle(WebServer& server, HTTPMethod method, const String& uri) override {
#endif
if (!this->canHandle(method, uri)) {
return false;
}

View File

@@ -58,26 +58,26 @@ public:
}
#if defined(ARDUINO_ARCH_ESP32)
bool canHandle(HTTPMethod method, const String uri) override {
#else
bool canHandle(HTTPMethod method, const String& uri) override {
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(const String uri) override {
#else
bool canUpload(const String& uri) override {
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));
}
#if defined(ARDUINO_ARCH_ESP32)
bool handle(WebServer& server, HTTPMethod method, const String uri) override {
#else
bool handle(WebServer& server, HTTPMethod method, const String& uri) override {
#endif
if (this->afterUpgradeCallback) {
this->afterUpgradeCallback(this->firmwareResult, this->filesystemResult);
}
@@ -91,11 +91,7 @@ public:
return true;
}
#if defined(ARDUINO_ARCH_ESP32)
void upload(WebServer& server, const String uri, HTTPUpload& upload) override {
#else
void upload(WebServer& server, const String& uri, HTTPUpload& upload) override {
#endif
UpgradeResult* result;
if (upload.name.equals("firmware")) {
result = &this->firmwareResult;

View File

@@ -13,20 +13,19 @@
extra_configs = secrets.default.ini
[env]
version = 1.4.3
version = 1.4.5
framework = arduino
lib_deps =
bblanchon/ArduinoJson@^7.0.4
bblanchon/ArduinoJson@^7.1.0
;ihormelnyk/OpenTherm Library@^1.1.5
https://github.com/ihormelnyk/opentherm_library#master
arduino-libraries/ArduinoMqttClient@^0.1.8
lennarthennigs/ESP Telnet@^2.2
gyverlibs/FileData@^1.0.2
gyverlibs/GyverPID@^3.3.2
gyverlibs/GyverBlinker@^1.0
https://github.com/PaulStoffregen/OneWire#master
milesburton/DallasTemperature@^3.11.0
laxilef/TinyLogger@^1.1.0
gyverlibs/GyverBlinker@^1.1.1
https://github.com/pstolarz/Arduino-Temperature-Control-Library.git#OneWireNg
laxilef/TinyLogger@^1.1.1
build_flags =
-D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
;-D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH
@@ -71,15 +70,17 @@ board_build.ldscript = eagle.flash.4m1m.ld
[esp32_defaults]
;platform = espressif32@^6.7
platform = https://github.com/platformio/platform-espressif32.git
;platform = https://github.com/platformio/platform-espressif32.git
;platform_packages =
; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.5
; framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.05/platform-espressif32.zip
platform_packages =
;platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32/archive/refs/tags/2.0.17.zip
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.1
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.1/esp32-arduino-libs-3.0.1.zip
board_build.partitions = esp32_partitions.csv
lib_deps =
${env.lib_deps}
laxilef/ESP32Scheduler@^1.0.1
nimble_lib = h2zero/NimBLE-Arduino@^1.4.2
lib_ignore =
extra_scripts =
post:tools/esp32.py
@@ -182,7 +183,7 @@ board = lolin_s3_mini
board_build.partitions = ${esp32_defaults.board_build.partitions}
lib_deps =
${esp32_defaults.lib_deps}
h2zero/NimBLE-Arduino@^1.4.1
${esp32_defaults.nimble_lib}
lib_ignore = ${esp32_defaults.lib_ignore}
extra_scripts = ${esp32_defaults.extra_scripts}
build_unflags =
@@ -206,7 +207,7 @@ board = lolin_c3_mini
board_build.partitions = ${esp32_defaults.board_build.partitions}
lib_deps =
${esp32_defaults.lib_deps}
h2zero/NimBLE-Arduino@^1.4.1
${esp32_defaults.nimble_lib}
lib_ignore = ${esp32_defaults.lib_ignore}
extra_scripts = ${esp32_defaults.extra_scripts}
build_unflags =
@@ -228,7 +229,7 @@ board = nodemcu-32s
board_build.partitions = ${esp32_defaults.board_build.partitions}
lib_deps =
${esp32_defaults.lib_deps}
h2zero/NimBLE-Arduino@^1.4.1
${esp32_defaults.nimble_lib}
lib_ignore = ${esp32_defaults.lib_ignore}
extra_scripts = ${esp32_defaults.extra_scripts}
build_flags =
@@ -240,7 +241,6 @@ build_flags =
-D DEFAULT_SENSOR_INDOOR_GPIO=26
-D DEFAULT_STATUS_LED_GPIO=2
-D DEFAULT_OT_RX_LED_GPIO=19
;-D WOKWI=1
[env:d1_mini32]
platform = ${esp32_defaults.platform}
@@ -249,7 +249,7 @@ board = wemos_d1_mini32
board_build.partitions = ${esp32_defaults.board_build.partitions}
lib_deps =
${esp32_defaults.lib_deps}
h2zero/NimBLE-Arduino@^1.4.1
${esp32_defaults.nimble_lib}
lib_ignore = ${esp32_defaults.lib_ignore}
extra_scripts = ${esp32_defaults.extra_scripts}
build_flags =
@@ -261,3 +261,20 @@ build_flags =
-D DEFAULT_SENSOR_INDOOR_GPIO=18
-D DEFAULT_STATUS_LED_GPIO=2
-D DEFAULT_OT_RX_LED_GPIO=19
[env:esp32_c6]
platform = ${esp32_defaults.platform}
platform_packages = ${esp32_defaults.platform_packages}
board = esp32-c6-devkitm-1
board_build.partitions = ${esp32_defaults.board_build.partitions}
lib_deps =
${esp32_defaults.lib_deps}
;${esp32_defaults.nimble_lib}
lib_ignore = ${esp32_defaults.lib_ignore}
extra_scripts = ${esp32_defaults.extra_scripts}
build_unflags =
-mtext-section-literals
build_flags =
${esp32_defaults.build_flags}
; Currently the NimBLE library is incompatible with ESP32 C6
;-D USE_BLE=1

View File

@@ -885,13 +885,33 @@ public:
doc[FPSTR(HA_NAME)] = F("Fault code");
doc[FPSTR(HA_ICON)] = F("mdi:chat-alert-outline");
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(F("state"));
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ \"E%02d\"|format(value_json.sensors.faultCode) }}");
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ \"%02d (0x%02X)\"|format(value_json.sensors.faultCode, value_json.sensors.faultCode) }}");
doc[FPSTR(HA_EXPIRE_AFTER)] = 120;
doc.shrinkToFit();
return this->publish(this->getTopic(FPSTR(HA_ENTITY_SENSOR), F("fault_code")).c_str(), doc);
}
bool publishSensorDiagnosticCode(bool enabledByDefault = true) {
JsonDocument doc;
doc[FPSTR(HA_AVAILABILITY)][0][FPSTR(HA_TOPIC)] = this->getDeviceTopic(F("status"));
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_TOPIC)] = this->getDeviceTopic(F("state"));
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.states.otStatus and value_json.states.fault or value_json.states.diagnostic, 'online', 'offline') }}");
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectId(F("diagnostic_code"));
doc[FPSTR(HA_OBJECT_ID)] = this->getObjectId(F("diagnostic_code"));
doc[FPSTR(HA_ENTITY_CATEGORY)] = F("diagnostic");
doc[FPSTR(HA_NAME)] = F("Diagnostic code");
doc[FPSTR(HA_ICON)] = F("mdi:chat-alert-outline");
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(F("state"));
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ \"%02d (0x%02X)\"|format(value_json.sensors.diagnosticCode, value_json.sensors.diagnosticCode) }}");
doc[FPSTR(HA_EXPIRE_AFTER)] = 120;
doc.shrinkToFit();
return this->publish(this->getTopic(FPSTR(HA_ENTITY_SENSOR), F("diagnostic_code")).c_str(), doc);
}
bool publishSensorRssi(bool enabledByDefault = true) {
JsonDocument doc;
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->getDeviceTopic(F("status"));

View File

@@ -29,7 +29,6 @@ protected:
enum class PumpStartReason {NONE, HEATING, ANTISTUCK};
Blinker* blinker = nullptr;
unsigned long firstFailConnect = 0;
unsigned long lastHeapInfo = 0;
unsigned int minFreeHeap = 0;
unsigned int minMaxFreeBlockHeap = 0;
@@ -39,6 +38,8 @@ protected:
PumpStartReason extPumpStartReason = PumpStartReason::NONE;
unsigned long externalPumpStartTime = 0;
bool telnetStarted = false;
bool emergencyDetected = false;
unsigned long emergencyFlipTime = 0;
#if defined(ARDUINO_ARCH_ESP32)
const char* getTaskName() override {
@@ -85,10 +86,6 @@ protected:
vars.states.mqtt = tMqtt->isConnected();
vars.sensors.rssi = network->isConnected() ? WiFi.RSSI() : 0;
if (vars.states.emergency && !settings.emergency.enable) {
vars.states.emergency = false;
}
if (network->isConnected()) {
if (!this->telnetStarted && telnetStream != nullptr) {
telnetStream->begin(23, false);
@@ -102,17 +99,6 @@ protected:
tMqtt->disable();
}
if (!vars.states.emergency && settings.emergency.enable && settings.emergency.onMqttFault && !tMqtt->isEnabled()) {
vars.states.emergency = true;
} else if (vars.states.emergency && !settings.emergency.onMqttFault) {
vars.states.emergency = false;
}
if (this->firstFailConnect != 0) {
this->firstFailConnect = 0;
}
if ( Log.getLevel() != TinyLogger::Level::INFO && !settings.system.debug ) {
Log.setLevel(TinyLogger::Level::INFO);
@@ -129,21 +115,10 @@ protected:
if (tMqtt->isEnabled()) {
tMqtt->disable();
}
if (!vars.states.emergency && settings.emergency.enable && settings.emergency.onNetworkFault) {
if (this->firstFailConnect == 0) {
this->firstFailConnect = millis();
}
if (millis() - this->firstFailConnect > (settings.emergency.tresholdTime * 1000)) {
vars.states.emergency = true;
Log.sinfoln(FPSTR(L_MAIN), F("Emergency mode enabled"));
}
}
}
this->yield();
this->emergency();
this->ledStatus();
this->externalPump();
this->yield();
@@ -213,6 +188,76 @@ protected:
}
}
void emergency() {
if (!settings.emergency.enable && vars.states.emergency) {
this->emergencyDetected = false;
vars.states.emergency = false;
Log.sinfoln(FPSTR(L_MAIN), F("Emergency mode disabled"));
}
if (!settings.emergency.enable) {
return;
}
// flags
uint8_t emergencyFlags = 0b00000000;
// set network flag
if (settings.emergency.onNetworkFault && !network->isConnected()) {
emergencyFlags |= 0b00000001;
}
// set mqtt flag
if (settings.emergency.onMqttFault && (!tMqtt->isEnabled() || !tMqtt->isConnected())) {
emergencyFlags |= 0b00000010;
}
// set outdoor sensor flag
if (settings.sensors.outdoor.type == SensorType::DS18B20 || settings.sensors.outdoor.type == SensorType::BLUETOOTH) {
if (settings.emergency.onOutdoorSensorDisconnect && !vars.sensors.outdoor.connected) {
emergencyFlags |= 0b00000100;
}
}
// set indoor sensor flag
if (settings.sensors.indoor.type == SensorType::DS18B20 || settings.sensors.indoor.type == SensorType::BLUETOOTH) {
if (settings.emergency.onIndoorSensorDisconnect && !vars.sensors.indoor.connected) {
emergencyFlags |= 0b00001000;
}
}
// if any flags is true
if ((emergencyFlags & 0b00001111) != 0) {
if (!this->emergencyDetected) {
// flip flag
this->emergencyDetected = true;
this->emergencyFlipTime = millis();
} else if (this->emergencyDetected && !vars.states.emergency) {
// enable emergency
if (millis() - this->emergencyFlipTime > (settings.emergency.tresholdTime * 1000)) {
vars.states.emergency = true;
Log.sinfoln(FPSTR(L_MAIN), F("Emergency mode enabled (%hhu)"), emergencyFlags);
}
}
} else {
if (this->emergencyDetected) {
// flip flag
this->emergencyDetected = false;
this->emergencyFlipTime = millis();
} else if (!this->emergencyDetected && vars.states.emergency) {
// disable emergency
if (millis() - this->emergencyFlipTime > 30000) {
vars.states.emergency = false;
Log.sinfoln(FPSTR(L_MAIN), F("Emergency mode disabled"));
}
}
}
}
void ledStatus() {
uint8_t errors[4];
uint8_t errCount = 0;

View File

@@ -198,17 +198,6 @@ protected:
this->onConnect();
}
if (settings.emergency.enable && settings.emergency.onMqttFault) {
if (!this->connected && !vars.states.emergency && millis() - this->disconnectedTime > (settings.emergency.tresholdTime * 1000)) {
vars.states.emergency = true;
Log.sinfoln(FPSTR(L_MQTT), F("Emergency mode enabled"));
} else if (this->connected && vars.states.emergency && millis() - this->connectedTime > 10000) {
vars.states.emergency = false;
Log.sinfoln(FPSTR(L_MQTT), F("Emergency mode disabled"));
}
}
if (!this->connected) {
return;
}
@@ -369,6 +358,7 @@ protected:
this->haHelper->publishSensorModulation(false);
this->haHelper->publishSensorPressure(settings.system.unitSystem, false);
this->haHelper->publishSensorFaultCode();
this->haHelper->publishSensorDiagnosticCode();
this->haHelper->publishSensorRssi(false);
this->haHelper->publishSensorUptime(false);

View File

@@ -22,8 +22,6 @@ protected:
bool isInitialized = false;
unsigned long initializedTime = 0;
unsigned int initializedMemberIdCode = 0;
byte dhwFlowRateMultiplier = 1;
byte pressureMultiplier = 1;
bool pump = true;
unsigned long lastSuccessResponse = 0;
unsigned long prevUpdateNonEssentialVars = 0;
@@ -165,6 +163,16 @@ protected:
heatingCh2Enabled = settings.opentherm.dhwPresent && settings.dhw.enable;
}
// Set boiler status LB
// Some boilers require this, although this is against protocol
uint8_t statusLb = 0;
// Immergas fix
// https://arduino.ru/forum/programmirovanie/termostat-opentherm-na-esp8266?page=15#comment-649392
if (settings.opentherm.immergasFix) {
statusLb = 0xCA;
}
unsigned long response = this->instance->setBoilerStatus(
heatingEnabled,
settings.opentherm.dhwPresent && settings.dhw.enable,
@@ -172,7 +180,8 @@ protected:
settings.opentherm.nativeHeatingControl,
heatingCh2Enabled,
settings.opentherm.summerWinterMode,
settings.opentherm.dhwBlocking
settings.opentherm.dhwBlocking,
statusLb
);
if (!CustomOpenTherm::isValidResponse(response)) {
@@ -217,8 +226,6 @@ protected:
this->isInitialized = true;
this->initializedTime = millis();
this->initializedMemberIdCode = settings.opentherm.memberIdCode;
this->dhwFlowRateMultiplier = 1;
this->pressureMultiplier = 1;
this->initialize();
}
@@ -247,7 +254,7 @@ protected:
// These parameters will be updated every minute
if (millis() - this->prevUpdateNonEssentialVars > 60000) {
if (!heatingEnabled && settings.opentherm.modulationSyncWithHeating) {
if (setMaxModulationLevel(0)) {
if (this->setMaxModulationLevel(0)) {
Log.snoticeln(FPSTR(L_OT_HEATING), F("Set max modulation 0% (off)"));
} else {
@@ -255,7 +262,7 @@ protected:
}
} else {
if (setMaxModulationLevel(settings.heating.maxModulation)) {
if (this->setMaxModulationLevel(settings.heating.maxModulation)) {
Log.snoticeln(FPSTR(L_OT_HEATING), F("Set max modulation %hhu%%"), settings.heating.maxModulation);
} else {
@@ -266,7 +273,7 @@ protected:
// Get DHW min/max temp (if necessary)
if (settings.opentherm.dhwPresent && settings.opentherm.getMinMaxTemp) {
if (updateMinMaxDhwTemp()) {
if (this->updateMinMaxDhwTemp()) {
if (settings.dhw.minTemp < vars.parameters.dhwMinTemp) {
settings.dhw.minTemp = vars.parameters.dhwMinTemp;
fsSettings.update();
@@ -296,7 +303,7 @@ protected:
// Get heating min/max temp
if (settings.opentherm.getMinMaxTemp) {
if (updateMinMaxHeatingTemp()) {
if (this->updateMinMaxHeatingTemp()) {
if (settings.heating.minTemp < vars.parameters.heatingMinTemp) {
settings.heating.minTemp = vars.parameters.heatingMinTemp;
fsSettings.update();
@@ -323,20 +330,33 @@ protected:
fsSettings.update();
}
// Get outdoor temp (if necessary)
if (settings.sensors.outdoor.type == SensorType::BOILER) {
updateOutsideTemp();
}
// Get fault code (if necessary)
if (vars.states.fault) {
updateFaultCode();
this->updateFaultCode();
} else if (vars.sensors.faultCode != 0) {
vars.sensors.faultCode = 0;
}
updatePressure();
// Get diagnostic code (if necessary)
if (vars.states.fault || vars.states.diagnostic) {
this->updateDiagCode();
} else if (vars.sensors.diagnosticCode != 0) {
vars.sensors.diagnosticCode = 0;
}
// If filtering is disabled, then it is enough to
// update these parameters once a minute
if (!settings.opentherm.filterNumValues.enable) {
// Get outdoor temp (if necessary)
if (settings.sensors.outdoor.type == SensorType::BOILER) {
this->updateOutdoorTemp();
}
// Get pressure
this->updatePressure();
}
this->prevUpdateNonEssentialVars = millis();
}
@@ -344,7 +364,7 @@ protected:
// Get current modulation level (if necessary)
if (vars.states.flame) {
updateModulationLevel();
this->updateModulationLevel();
} else {
vars.sensors.modulation = 0;
@@ -352,8 +372,8 @@ protected:
// Update DHW sensors (if necessary)
if (settings.opentherm.dhwPresent) {
updateDhwTemp();
updateDhwFlowRate();
this->updateDhwTemp();
this->updateDhwFlowRate();
} else {
vars.temperatures.dhw = 0.0f;
@@ -361,13 +381,25 @@ protected:
}
// Get current heating temp
updateHeatingTemp();
this->updateHeatingTemp();
// Get heating return temp
updateHeatingReturnTemp();
this->updateHeatingReturnTemp();
// Get exhaust temp
updateExhaustTemp();
this->updateExhaustTemp();
// If filtering is enabled, these parameters
// must be updated every time.
if (settings.opentherm.filterNumValues.enable) {
// Get outdoor temp (if necessary)
if (settings.sensors.outdoor.type == SensorType::BOILER) {
this->updateOutdoorTemp();
}
// Get pressure
this->updatePressure();
}
// Fault reset action
@@ -538,6 +570,13 @@ protected:
Log.swarningln(FPSTR(L_OT), F("Get slave OT version failed"));
}
if (this->setMasterOtVersion(2.2f)) {
Log.straceln(FPSTR(L_OT), F("Master OT version: %f"), vars.parameters.masterOtVersion);
} else {
Log.swarningln(FPSTR(L_OT), F("Set master OT version failed"));
}
if (this->updateSlaveConfig()) {
Log.straceln(FPSTR(L_OT), F("Slave member id: %u, flags: %u"), vars.parameters.slaveMemberId, vars.parameters.slaveFlags);
@@ -773,7 +812,7 @@ protected:
return CustomOpenTherm::isValidResponse(response);
}
bool updateOutsideTemp() {
bool updateOutdoorTemp() {
unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
OpenThermRequestType::READ_DATA,
OpenThermMessageID::Toutside,
@@ -784,12 +823,19 @@ protected:
return false;
}
vars.temperatures.outdoor = settings.sensors.outdoor.offset + convertTemp(
float value = settings.sensors.outdoor.offset + convertTemp(
CustomOpenTherm::getFloat(response),
settings.opentherm.unitSystem,
settings.system.unitSystem
);
if (settings.opentherm.filterNumValues.enable && fabs(vars.temperatures.outdoor) >= 0.1f) {
vars.temperatures.outdoor += (value - vars.temperatures.outdoor) * settings.opentherm.filterNumValues.factor;
} else {
vars.temperatures.outdoor = value;
}
return true;
}
@@ -809,12 +855,19 @@ protected:
return false;
}
vars.temperatures.exhaust = convertTemp(
value = convertTemp(
value,
settings.opentherm.unitSystem,
settings.system.unitSystem
);
if (settings.opentherm.filterNumValues.enable && fabs(vars.temperatures.exhaust) >= 0.1f) {
vars.temperatures.exhaust += (value - vars.temperatures.exhaust) * settings.opentherm.filterNumValues.factor;
} else {
vars.temperatures.exhaust = value;
}
return true;
}
@@ -834,12 +887,19 @@ protected:
return false;
}
vars.temperatures.heating = convertTemp(
value = convertTemp(
value,
settings.opentherm.unitSystem,
settings.system.unitSystem
);
if (settings.opentherm.filterNumValues.enable && fabs(vars.temperatures.heating) >= 0.1f) {
vars.temperatures.heating += (value - vars.temperatures.heating) * settings.opentherm.filterNumValues.factor;
} else {
vars.temperatures.heating = value;
}
return true;
}
@@ -854,12 +914,20 @@ protected:
return false;
}
vars.temperatures.heatingReturn = convertTemp(
float value = convertTemp(
CustomOpenTherm::getFloat(response),
settings.opentherm.unitSystem,
settings.system.unitSystem
);
if (settings.opentherm.filterNumValues.enable && fabs(vars.temperatures.heatingReturn) >= 0.1f) {
vars.temperatures.heatingReturn += (value - vars.temperatures.heatingReturn) * settings.opentherm.filterNumValues.factor;
} else {
vars.temperatures.heatingReturn = value;
}
return true;
}
@@ -880,12 +948,19 @@ protected:
return false;
}
vars.temperatures.dhw = convertTemp(
value = convertTemp(
value,
settings.opentherm.unitSystem,
settings.system.unitSystem
);
if (settings.opentherm.filterNumValues.enable && fabs(vars.temperatures.dhw) >= 0.1f) {
vars.temperatures.dhw += (value - vars.temperatures.dhw) * settings.opentherm.filterNumValues.factor;
} else {
vars.temperatures.dhw = value;
}
return true;
}
@@ -901,15 +976,17 @@ protected:
}
float value = CustomOpenTherm::getFloat(response);
if (this->dhwFlowRateMultiplier != 10 && value > convertVolume(16, UnitSystem::METRIC, settings.opentherm.unitSystem)) {
this->dhwFlowRateMultiplier = 10;
if (value < 0 || value > convertVolume(16, UnitSystem::METRIC, settings.opentherm.unitSystem)) {
return false;
}
vars.sensors.dhwFlowRate = convertVolume(
value / this->dhwFlowRateMultiplier,
value = convertVolume(
value * settings.opentherm.dhwFlowRateFactor,
settings.opentherm.unitSystem,
settings.system.unitSystem
);
vars.sensors.dhwFlowRate = value > 0.09f ? value : 0.0f;
return true;
}
@@ -922,6 +999,7 @@ protected:
));
if (!CustomOpenTherm::isValidResponse(response)) {
vars.sensors.faultCode = 0;
return false;
}
@@ -929,6 +1007,22 @@ protected:
return true;
}
bool updateDiagCode() {
unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
OpenThermRequestType::READ_DATA,
OpenThermMessageID::OEMDiagnosticCode,
0
));
if (!CustomOpenTherm::isValidResponse(response)) {
vars.sensors.diagnosticCode = 0;
return false;
}
vars.sensors.diagnosticCode = CustomOpenTherm::getUInt(response);
return true;
}
bool updateModulationLevel() {
unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
OpenThermRequestType::READ_DATA,
@@ -940,7 +1034,13 @@ protected:
return false;
}
vars.sensors.modulation = CustomOpenTherm::getFloat(response);
float value = CustomOpenTherm::getFloat(response);
if (settings.opentherm.filterNumValues.enable && fabs(vars.sensors.modulation) >= 0.1f) {
vars.sensors.modulation += (value - vars.sensors.modulation) * settings.opentherm.filterNumValues.factor;
} else {
vars.sensors.modulation = value;
}
return true;
}
@@ -957,16 +1057,23 @@ protected:
}
float value = CustomOpenTherm::getFloat(response);
if (this->pressureMultiplier != 10 && value > convertPressure(5, UnitSystem::METRIC, settings.opentherm.unitSystem)) {
this->pressureMultiplier = 10;
if (value < 0 || value > convertPressure(5, UnitSystem::METRIC, settings.opentherm.unitSystem)) {
return false;
}
vars.sensors.pressure = convertPressure(
value / this->pressureMultiplier,
value = convertPressure(
value * settings.opentherm.pressureFactor,
settings.opentherm.unitSystem,
settings.system.unitSystem
);
if (settings.opentherm.filterNumValues.enable && fabs(vars.sensors.pressure) >= 0.1f) {
vars.sensors.pressure += (value - vars.sensors.pressure) * settings.opentherm.filterNumValues.factor;
} else {
vars.sensors.pressure = value;
}
return true;
}
};

View File

@@ -582,6 +582,10 @@ protected:
void loop() {
// web server
if (!this->stateWebServer() && (network->isApEnabled() || network->isConnected()) && millis() - this->webServerChangeState >= this->changeStateInterval) {
#ifdef ARDUINO_ARCH_ESP32
this->delay(250);
#endif
this->startWebServer();
Log.straceln(FPSTR(L_PORTAL_WEBSERVER), F("Started: AP up or STA connected"));

View File

@@ -139,7 +139,8 @@ protected:
// if use pid
if (settings.pid.enable) {
if (vars.parameters.heatingEnabled) {
//if (vars.parameters.heatingEnabled) {
if (settings.heating.enable) {
float pidResult = getPidTemp(
settings.equitherm.enable ? (settings.pid.maxTemp * -1) : settings.pid.minTemp,
settings.pid.maxTemp
@@ -160,8 +161,8 @@ protected:
}
} else if (fabs(pidRegulator.integral) > 0.0001f) {
pidRegulator.integral = 0;
Log.sinfoln(FPSTR(L_REGULATOR_PID), F("Integral sum has been reset"));
pidRegulator.integral = 0;
Log.sinfoln(FPSTR(L_REGULATOR_PID), F("Integral sum has been reset"));
}
// default temp, manual mode
@@ -198,6 +199,10 @@ protected:
etRegulator.Kt = 0;
etRegulator.indoorTemp = 0;
} else if ((settings.sensors.indoor.type == SensorType::DS18B20 || settings.sensors.indoor.type == SensorType::BLUETOOTH) && !vars.sensors.indoor.connected) {
etRegulator.Kt = 0;
etRegulator.indoorTemp = 0;
} else {
etRegulator.Kt = settings.equitherm.t_factor;
etRegulator.indoorTemp = indoorTemp;
@@ -255,7 +260,7 @@ protected:
pidRegulator.setLimits(minTemp, maxTemp);
pidRegulator.setDt(settings.pid.dt * 1000u);
pidRegulator.input = vars.temperatures.indoor;
pidRegulator.setpoint = settings.heating.target;
pidRegulator.setpoint = vars.states.emergency ? settings.emergency.target : settings.heating.target;
return pidRegulator.getResultTimer();
}

View File

@@ -35,19 +35,18 @@ protected:
unsigned long initOutdoorSensorTime = 0;
unsigned long startOutdoorConversionTime = 0;
float filteredOutdoorTemp = 0;
bool emptyOutdoorTemp = true;
float prevFilteredOutdoorTemp = 0;
bool initIndoorSensor = false;
unsigned long initIndoorSensorTime = 0;
unsigned long startIndoorConversionTime = 0;
float filteredIndoorTemp = 0;
bool emptyIndoorTemp = true;
float prevFilteredIndoorTemp = 0;
#if defined(ARDUINO_ARCH_ESP32)
#if USE_BLE
BLEClient* pBleClient = nullptr;
bool initBleSensor = false;
bool initBleNotify = false;
unsigned long outdoorConnectedTime = 0;
unsigned long indoorConnectedTime = 0;
#endif
const char* getTaskName() override {
@@ -69,26 +68,62 @@ protected:
#endif
void loop() {
bool indoorTempUpdated = false;
bool outdoorTempUpdated = false;
if (settings.sensors.outdoor.type == SensorType::DS18B20 && GPIO_IS_VALID(settings.sensors.outdoor.gpio)) {
outdoorTemperatureSensor();
outdoorTempUpdated = true;
}
if (settings.sensors.indoor.type == SensorType::DS18B20 && GPIO_IS_VALID(settings.sensors.indoor.gpio)) {
indoorTemperatureSensor();
indoorTempUpdated = true;
}
#if USE_BLE
else if (settings.sensors.indoor.type == SensorType::BLUETOOTH) {
indoorTemperatureBluetoothSensor();
indoorTempUpdated = true;
if (!NimBLEDevice::getInitialized() && millis() > 5000) {
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Init BLE"));
BLEDevice::init("");
NimBLEDevice::setPower(ESP_PWR_LVL_P9);
}
#endif
if (outdoorTempUpdated) {
if (settings.sensors.outdoor.type == SensorType::DS18B20 && GPIO_IS_VALID(settings.sensors.outdoor.gpio)) {
outdoorDallasSensor();
}
#if USE_BLE
else if (settings.sensors.outdoor.type == SensorType::BLUETOOTH) {
bool connected = this->bluetoothSensor(
BLEAddress(settings.sensors.outdoor.bleAddress),
&vars.sensors.outdoor.rssi,
&this->filteredOutdoorTemp,
&vars.sensors.outdoor.humidity,
&vars.sensors.outdoor.battery
);
if (connected) {
this->outdoorConnectedTime = millis();
vars.sensors.outdoor.connected = true;
} else if (millis() - this->outdoorConnectedTime > 60000) {
vars.sensors.outdoor.connected = false;
}
}
#endif
if (settings.sensors.indoor.type == SensorType::DS18B20 && GPIO_IS_VALID(settings.sensors.indoor.gpio)) {
indoorDallasSensor();
}
#if USE_BLE
else if (settings.sensors.indoor.type == SensorType::BLUETOOTH) {
bool connected = this->bluetoothSensor(
BLEAddress(settings.sensors.indoor.bleAddress),
&vars.sensors.indoor.rssi,
&this->filteredIndoorTemp,
&vars.sensors.indoor.humidity,
&vars.sensors.indoor.battery
);
if (connected) {
this->indoorConnectedTime = millis();
vars.sensors.indoor.connected = true;
} else if (millis() - this->indoorConnectedTime > 60000) {
vars.sensors.indoor.connected = false;
}
}
#endif
// convert
if (fabs(this->prevFilteredOutdoorTemp - this->filteredOutdoorTemp) >= 0.1f) {
float newTemp = settings.sensors.outdoor.offset;
if (settings.system.unitSystem == UnitSystem::METRIC) {
newTemp += this->filteredOutdoorTemp;
@@ -101,9 +136,11 @@ protected:
vars.temperatures.outdoor = newTemp;
Log.sinfoln(FPSTR(L_SENSORS_OUTDOOR), F("New temp: %f"), vars.temperatures.outdoor);
}
this->prevFilteredOutdoorTemp = this->filteredOutdoorTemp;
}
if (indoorTempUpdated) {
if (fabs(this->prevFilteredIndoorTemp - this->filteredIndoorTemp) > 0.1f) {
float newTemp = settings.sensors.indoor.offset;
if (settings.system.unitSystem == UnitSystem::METRIC) {
newTemp += this->filteredIndoorTemp;
@@ -116,127 +153,378 @@ protected:
vars.temperatures.indoor = newTemp;
Log.sinfoln(FPSTR(L_SENSORS_INDOOR), F("New temp: %f"), vars.temperatures.indoor);
}
this->prevFilteredIndoorTemp = this->filteredIndoorTemp;
}
}
#if USE_BLE
void indoorTemperatureBluetoothSensor() {
static bool initBleNotify = false;
if (!initBleSensor && millis() > 5000) {
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Init BLE"));
BLEDevice::init("");
pBleClient = BLEDevice::createClient();
pBleClient->setConnectTimeout(5);
initBleSensor = true;
bool bluetoothSensor(const BLEAddress& address, int8_t* const pRssi, float* const pTemperature, float* const pHumidity = nullptr, float* const pBattery = nullptr) {
if (!NimBLEDevice::getInitialized()) {
return false;
}
if (!initBleSensor || pBleClient->isConnected()) {
return;
}
// Reset init notify flag
this->initBleNotify = false;
NimBLEClient* pClient = nullptr;
pClient = NimBLEDevice::getClientByPeerAddress(address);
// Connect to the remote BLE Server.
BLEAddress bleServerAddress(settings.sensors.indoor.bleAddress);
if (!pBleClient->connect(bleServerAddress)) {
Log.swarningln(FPSTR(L_SENSORS_BLE), "Failed connecting to device at %s", bleServerAddress.toString().c_str());
return;
if (pClient == nullptr) {
pClient = NimBLEDevice::getDisconnectedClient();
}
Log.sinfoln(FPSTR(L_SENSORS_BLE), "Connected to device at %s", bleServerAddress.toString().c_str());
if (pClient == nullptr) {
if (NimBLEDevice::getClientListSize() >= NIMBLE_MAX_CONNECTIONS) {
return false;
}
NimBLEUUID serviceUUID((uint16_t) 0x181AU);
BLERemoteService* pRemoteService = pBleClient->getService(serviceUUID);
if (!pRemoteService) {
Log.straceln(FPSTR(L_SENSORS_BLE), F("Failed to find service UUID: %s"), serviceUUID.toString().c_str());
return;
pClient = NimBLEDevice::createClient();
pClient->setConnectTimeout(5);
}
Log.straceln(FPSTR(L_SENSORS_BLE), F("Found service UUID: %s"), serviceUUID.toString().c_str());
if(pClient->isConnected()) {
*pRssi = pClient->getRssi();
return true;
}
// 0x2A6E - Notify temperature x0.01C (pvvx)
if (!this->initBleNotify) {
NimBLEUUID charUUID((uint16_t) 0x2A6E);
BLERemoteCharacteristic* pRemoteCharacteristic = pRemoteService->getCharacteristic(charUUID);
if (pRemoteCharacteristic && pRemoteCharacteristic->canNotify()) {
Log.straceln(FPSTR(L_SENSORS_BLE), F("Found characteristic UUID: %s"), charUUID.toString().c_str());
if (!pClient->connect(address)) {
Log.swarningln(FPSTR(L_SENSORS_BLE), "Device %s: failed connecting", address.toString().c_str());
this->initBleNotify = pRemoteCharacteristic->subscribe(true, [this](NimBLERemoteCharacteristic*, uint8_t* pData, size_t length, bool isNotify) {
if (length != 2) {
Log.swarningln(FPSTR(L_SENSORS_BLE), F("Invalid notification data"));
return;
}
NimBLEDevice::deleteClient(pClient);
return false;
}
float rawTemp = ((pData[0] | (pData[1] << 8)) * 0.01f);
Log.straceln(FPSTR(L_SENSORS_INDOOR), F("Raw temp: %f"), rawTemp);
Log.sinfoln(FPSTR(L_SENSORS_BLE), "Device %s: connected", address.toString().c_str());
NimBLERemoteService* pService = nullptr;
NimBLERemoteCharacteristic* pChar = nullptr;
if (this->emptyIndoorTemp) {
this->filteredIndoorTemp = rawTemp;
this->emptyIndoorTemp = false;
// ENV Service (0x181A)
pService = pClient->getService(NimBLEUUID((uint16_t) 0x181AU));
if (!pService) {
Log.straceln(
FPSTR(L_SENSORS_BLE),
F("Device %s: failed to find env service (%s)"),
address.toString().c_str(),
pService->getUUID().toString().c_str()
);
} else {
Log.straceln(
FPSTR(L_SENSORS_BLE),
F("Device %s: found env service (%s)"),
address.toString().c_str(),
pService->getUUID().toString().c_str()
);
// 0x2A6E - Notify temperature x0.01C (pvvx)
bool tempNotifyCreated = false;
if (!tempNotifyCreated) {
pChar = pService->getCharacteristic(NimBLEUUID((uint16_t) 0x2A6E));
if (pChar && pChar->canNotify()) {
Log.straceln(
FPSTR(L_SENSORS_BLE),
F("Device %s: found temperature char (%s) in env service"),
address.toString().c_str(),
pChar->getUUID().toString().c_str()
);
tempNotifyCreated = pChar->subscribe(true, [pTemperature](NimBLERemoteCharacteristic* pChar, uint8_t* pData, size_t length, bool isNotify) {
NimBLEClient* pClient = pChar->getRemoteService()->getClient();
if (length != 2) {
Log.swarningln(
FPSTR(L_SENSORS_BLE),
F("Device %s: invalid notification data at temperature char (%s)"),
pClient->getPeerAddress().toString().c_str(),
pChar->getUUID().toString().c_str()
);
return;
}
float rawTemp = ((pData[0] | (pData[1] << 8)) * 0.01f);
Log.straceln(
FPSTR(L_SENSORS_INDOOR),
F("Device %s: raw temp %f"),
pClient->getPeerAddress().toString().c_str(),
rawTemp
);
if (fabs(*pTemperature) < 0.1f) {
*pTemperature = rawTemp;
} else {
*pTemperature += (rawTemp - (*pTemperature)) * EXT_SENSORS_FILTER_K;
}
*pTemperature = floor((*pTemperature) * 100) / 100;
});
if (tempNotifyCreated) {
Log.straceln(
FPSTR(L_SENSORS_BLE),
F("Device %s: subscribed to temperature char (%s) in env service"),
address.toString().c_str(),
pChar->getUUID().toString().c_str()
);
} else {
this->filteredIndoorTemp += (rawTemp - this->filteredIndoorTemp) * EXT_SENSORS_FILTER_K;
Log.swarningln(
FPSTR(L_SENSORS_BLE),
F("Device %s: failed to subscribe to temperature char (%s) in env service"),
address.toString().c_str(),
pChar->getUUID().toString().c_str()
);
}
}
}
this->filteredIndoorTemp = floor(this->filteredIndoorTemp * 100) / 100;
});
if (this->initBleNotify) {
Log.straceln(FPSTR(L_SENSORS_BLE), F("Subscribed to characteristic UUID: %s"), charUUID.toString().c_str());
// 0x2A1F - Notify temperature x0.1C (atc1441/pvvx)
if (!tempNotifyCreated) {
pChar = pService->getCharacteristic(NimBLEUUID((uint16_t) 0x2A1F));
} else {
Log.swarningln(FPSTR(L_SENSORS_BLE), F("Failed to subscribe to characteristic UUID: %s"), charUUID.toString().c_str());
if (pChar && pChar->canNotify()) {
Log.straceln(
FPSTR(L_SENSORS_BLE),
F("Device %s: found temperature char (%s) in env service"),
address.toString().c_str(),
pChar->getUUID().toString().c_str()
);
tempNotifyCreated = pChar->subscribe(true, [pTemperature](NimBLERemoteCharacteristic* pChar, uint8_t* pData, size_t length, bool isNotify) {
NimBLEClient* pClient = pChar->getRemoteService()->getClient();
if (length != 2) {
Log.swarningln(
FPSTR(L_SENSORS_BLE),
F("Device %s: invalid notification data at temperature char (%s)"),
pClient->getPeerAddress().toString().c_str(),
pChar->getUUID().toString().c_str()
);
return;
}
float rawTemp = ((pData[0] | (pData[1] << 8)) * 0.1f);
Log.straceln(
FPSTR(L_SENSORS_INDOOR),
F("Device %s: raw temp %f"),
pClient->getPeerAddress().toString().c_str(),
rawTemp
);
if (fabs(*pTemperature) < 0.1f) {
*pTemperature = rawTemp;
} else {
*pTemperature += (rawTemp - (*pTemperature)) * EXT_SENSORS_FILTER_K;
}
*pTemperature = floor((*pTemperature) * 100) / 100;
});
if (tempNotifyCreated) {
Log.straceln(
FPSTR(L_SENSORS_BLE),
F("Device %s: subscribed to temperature char (%s) in env service"),
address.toString().c_str(),
pChar->getUUID().toString().c_str()
);
} else {
Log.swarningln(
FPSTR(L_SENSORS_BLE),
F("Device %s: failed to subscribe to temperature char (%s) in env service"),
address.toString().c_str(),
pChar->getUUID().toString().c_str()
);
}
}
}
if (!tempNotifyCreated) {
Log.swarningln(
FPSTR(L_SENSORS_BLE),
F("Device %s: not found supported temperature chars in env service"),
address.toString().c_str()
);
pClient->disconnect();
return false;
}
// 0x2A6F - Notify about humidity x0.01% (pvvx)
if (pHumidity != nullptr) {
bool humidityNotifyCreated = false;
if (!humidityNotifyCreated) {
pChar = pService->getCharacteristic(NimBLEUUID((uint16_t) 0x2A6F));
if (pChar && pChar->canNotify()) {
Log.straceln(
FPSTR(L_SENSORS_BLE),
F("Device %s: found humidity char (%s) in env service"),
address.toString().c_str(),
pChar->getUUID().toString().c_str()
);
humidityNotifyCreated = pChar->subscribe(true, [pHumidity](NimBLERemoteCharacteristic* pChar, uint8_t* pData, size_t length, bool isNotify) {
NimBLEClient* pClient = pChar->getRemoteService()->getClient();
if (length != 2) {
Log.swarningln(
FPSTR(L_SENSORS_BLE),
F("Device %s: invalid notification data at humidity char (%s)"),
pClient->getPeerAddress().toString().c_str(),
pChar->getUUID().toString().c_str()
);
return;
}
float rawHumidity = ((pData[0] | (pData[1] << 8)) * 0.01f);
Log.straceln(
FPSTR(L_SENSORS_INDOOR),
F("Device %s: raw humidity %f"),
pClient->getPeerAddress().toString().c_str(),
rawHumidity
);
if (fabs(*pHumidity) < 0.1f) {
*pHumidity = rawHumidity;
} else {
*pHumidity += (rawHumidity - (*pHumidity)) * EXT_SENSORS_FILTER_K;
}
*pHumidity = floor((*pHumidity) * 100) / 100;
});
if (humidityNotifyCreated) {
Log.straceln(
FPSTR(L_SENSORS_BLE),
F("Device %s: subscribed to humidity char (%s) in env service"),
address.toString().c_str(),
pChar->getUUID().toString().c_str()
);
} else {
Log.swarningln(
FPSTR(L_SENSORS_BLE),
F("Device %s: failed to subscribe to humidity char (%s) in env service"),
address.toString().c_str(),
pChar->getUUID().toString().c_str()
);
}
}
}
if (!humidityNotifyCreated) {
Log.swarningln(
FPSTR(L_SENSORS_BLE),
F("Device %s: not found supported humidity chars in env service"),
address.toString().c_str()
);
}
}
}
// 0x2A1F - Notify temperature x0.1C (atc1441/pvvx)
if (!this->initBleNotify) {
NimBLEUUID charUUID((uint16_t) 0x2A1F);
BLERemoteCharacteristic* pRemoteCharacteristic = pRemoteService->getCharacteristic(charUUID);
if (pRemoteCharacteristic && pRemoteCharacteristic->canNotify()) {
Log.straceln(FPSTR(L_SENSORS_BLE), F("Found characteristic UUID: %s"), charUUID.toString().c_str());
this->initBleNotify = pRemoteCharacteristic->subscribe(true, [this](NimBLERemoteCharacteristic*, uint8_t* pData, size_t length, bool isNotify) {
if (length != 2) {
Log.swarningln(FPSTR(L_SENSORS_BLE), F("Invalid notification data"));
return;
// Battery Service (0x180F)
if (pBattery != nullptr) {
pService = pClient->getService(NimBLEUUID((uint16_t) 0x180F));
if (!pService) {
Log.straceln(
FPSTR(L_SENSORS_BLE),
F("Device %s: failed to find battery service (%s)"),
address.toString().c_str(),
pService->getUUID().toString().c_str()
);
} else {
Log.straceln(
FPSTR(L_SENSORS_BLE),
F("Device %s: found battery service (%s)"),
address.toString().c_str(),
pService->getUUID().toString().c_str()
);
// 0x2A19 - Notify the battery charge level 0..99% (pvvx)
bool batteryNotifyCreated = false;
if (!batteryNotifyCreated) {
pChar = pService->getCharacteristic(NimBLEUUID((uint16_t) 0x2A19));
if (pChar && pChar->canNotify()) {
Log.straceln(
FPSTR(L_SENSORS_BLE),
F("Device %s: found battery char (%s) in battery service"),
address.toString().c_str(),
pChar->getUUID().toString().c_str()
);
batteryNotifyCreated = pChar->subscribe(true, [pBattery](NimBLERemoteCharacteristic* pChar, uint8_t* pData, size_t length, bool isNotify) {
NimBLEClient* pClient = pChar->getRemoteService()->getClient();
if (length != 1) {
Log.swarningln(
FPSTR(L_SENSORS_BLE),
F("Device %s: invalid notification data at battery char (%s)"),
pClient->getPeerAddress().toString().c_str(),
pChar->getUUID().toString().c_str()
);
return;
}
uint8_t rawBattery = pData[0];
Log.straceln(
FPSTR(L_SENSORS_INDOOR),
F("Device %s: raw battery %hhu"),
pClient->getPeerAddress().toString().c_str(),
rawBattery
);
if (fabs(*pBattery) < 0.1f) {
*pBattery = rawBattery;
} else {
*pBattery += (rawBattery - (*pBattery)) * EXT_SENSORS_FILTER_K;
}
*pBattery = floor((*pBattery) * 100) / 100;
});
if (batteryNotifyCreated) {
Log.straceln(
FPSTR(L_SENSORS_BLE),
F("Device %s: subscribed to battery char (%s) in battery service"),
address.toString().c_str(),
pChar->getUUID().toString().c_str()
);
} else {
Log.swarningln(
FPSTR(L_SENSORS_BLE),
F("Device %s: failed to subscribe to battery char (%s) in battery service"),
address.toString().c_str(),
pChar->getUUID().toString().c_str()
);
}
}
}
float rawTemp = ((pData[0] | (pData[1] << 8)) * 0.1);
Log.straceln(FPSTR(L_SENSORS_INDOOR), F("Raw temp: %f"), rawTemp);
if (this->emptyIndoorTemp) {
this->filteredIndoorTemp = rawTemp;
this->emptyIndoorTemp = false;
} else {
this->filteredIndoorTemp += (rawTemp - this->filteredIndoorTemp) * EXT_SENSORS_FILTER_K;
}
this->filteredIndoorTemp = floor(this->filteredIndoorTemp * 100) / 100;
});
if (this->initBleNotify) {
Log.straceln(FPSTR(L_SENSORS_BLE), F("Subscribed to characteristic UUID: %s"), charUUID.toString().c_str());
} else {
Log.swarningln(FPSTR(L_SENSORS_BLE), F("Failed to subscribe to characteristic UUID: %s"), charUUID.toString().c_str());
if (!batteryNotifyCreated) {
Log.swarningln(
FPSTR(L_SENSORS_BLE),
F("Device %s: not found supported battery chars in battery service"),
address.toString().c_str()
);
}
}
}
if (!this->initBleNotify) {
Log.swarningln(FPSTR(L_SENSORS_BLE), F("Not found supported characteristics"));
pBleClient->disconnect();
}
return true;
}
#endif
void outdoorTemperatureSensor() {
void outdoorDallasSensor() {
if (!this->initOutdoorSensor) {
if (this->initOutdoorSensorTime && millis() - this->initOutdoorSensorTime < EXT_SENSORS_INTERVAL * 10) {
return;
@@ -265,6 +553,10 @@ protected:
Log.sinfoln(FPSTR(L_SENSORS_OUTDOOR), F("Started"));
} else {
if (vars.sensors.outdoor.connected) {
vars.sensors.outdoor.connected = false;
}
return;
}
}
@@ -294,9 +586,12 @@ protected:
} else {
Log.straceln(FPSTR(L_SENSORS_OUTDOOR), F("Raw temp: %f"), rawTemp);
if (this->emptyOutdoorTemp) {
if (!vars.sensors.outdoor.connected) {
vars.sensors.outdoor.connected = true;
}
if (fabs(this->filteredOutdoorTemp) < 0.1f) {
this->filteredOutdoorTemp = rawTemp;
this->emptyOutdoorTemp = false;
} else {
this->filteredOutdoorTemp += (rawTemp - this->filteredOutdoorTemp) * EXT_SENSORS_FILTER_K;
@@ -308,7 +603,7 @@ protected:
}
}
void indoorTemperatureSensor() {
void indoorDallasSensor() {
if (!this->initIndoorSensor) {
if (this->initIndoorSensorTime && millis() - this->initIndoorSensorTime < EXT_SENSORS_INTERVAL * 10) {
return;
@@ -337,6 +632,10 @@ protected:
Log.sinfoln(FPSTR(L_SENSORS_INDOOR), F("Started"));
} else {
if (vars.sensors.indoor.connected) {
vars.sensors.indoor.connected = false;
}
return;
}
}
@@ -366,9 +665,12 @@ protected:
} else {
Log.straceln(FPSTR(L_SENSORS_INDOOR), F("Raw temp: %f"), rawTemp);
if (this->emptyIndoorTemp) {
if (!vars.sensors.indoor.connected) {
vars.sensors.indoor.connected = true;
}
if (fabs(this->filteredIndoorTemp) < 0.1f) {
this->filteredIndoorTemp = rawTemp;
this->emptyIndoorTemp = false;
} else {
this->filteredIndoorTemp += (rawTemp - this->filteredIndoorTemp) * EXT_SENSORS_FILTER_K;

View File

@@ -54,6 +54,8 @@ struct Settings {
byte faultStateGpio = DEFAULT_OT_FAULT_STATE_GPIO;
byte invertFaultState = false;
unsigned int memberIdCode = 0;
float pressureFactor = 1.0f;
float dhwFlowRateFactor = 1.0f;
bool dhwPresent = true;
bool summerWinterMode = false;
bool heatingCh2Enabled = true;
@@ -63,6 +65,12 @@ struct Settings {
bool modulationSyncWithHeating = false;
bool getMinMaxTemp = true;
bool nativeHeatingControl = false;
bool immergasFix = false;
struct {
bool enable = false;
float factor = 0.1f;
} filterNumValues;
} opentherm;
struct {
@@ -77,13 +85,15 @@ struct Settings {
} mqtt;
struct {
bool enable = true;
bool enable = false;
float target = DEFAULT_HEATING_TARGET_TEMP;
unsigned short tresholdTime = 120;
bool useEquitherm = false;
bool usePid = false;
bool onNetworkFault = true;
bool onMqttFault = true;
bool onIndoorSensorDisconnect = false;
bool onOutdoorSensorDisconnect = false;
} emergency;
struct {
@@ -124,6 +134,7 @@ struct Settings {
struct {
SensorType type = SensorType::BOILER;
byte gpio = DEFAULT_SENSOR_OUTDOOR_GPIO;
uint8_t bleAddress[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
float offset = 0.0f;
} outdoor;
@@ -164,7 +175,22 @@ struct Variables {
float pressure = 0.0f;
float dhwFlowRate = 0.0f;
byte faultCode = 0;
unsigned short diagnosticCode = 0;
int8_t rssi = 0;
struct {
bool connected = false;
int8_t rssi = 0;
float battery = 0.0f;
float humidity = 0.0f;
} outdoor;
struct {
bool connected = false;
int8_t rssi = 0;
float battery = 0.0f;
float humidity = 0.0f;
} indoor;
} sensors;
struct {

View File

@@ -135,13 +135,9 @@ void setup() {
network = (new NetworkMgr)
->setHostname(networkSettings.hostname)
->setStaCredentials(
#ifdef WOKWI
"Wokwi-GUEST", nullptr, 6
#else
strlen(networkSettings.sta.ssid) ? networkSettings.sta.ssid : nullptr,
strlen(networkSettings.sta.password) ? networkSettings.sta.password : nullptr,
networkSettings.sta.channel
#endif
)->setApCredentials(
strlen(networkSettings.ap.ssid) ? networkSettings.ap.ssid : nullptr,
strlen(networkSettings.ap.password) ? networkSettings.ap.password : nullptr,

View File

@@ -345,6 +345,8 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
dst["opentherm"]["faultStateGpio"] = src.opentherm.faultStateGpio;
dst["opentherm"]["invertFaultState"] = src.opentherm.invertFaultState;
dst["opentherm"]["memberIdCode"] = src.opentherm.memberIdCode;
dst["opentherm"]["pressureFactor"] = roundd(src.opentherm.pressureFactor, 2);
dst["opentherm"]["dhwFlowRateFactor"] = roundd(src.opentherm.dhwFlowRateFactor, 2);
dst["opentherm"]["dhwPresent"] = src.opentherm.dhwPresent;
dst["opentherm"]["summerWinterMode"] = src.opentherm.summerWinterMode;
dst["opentherm"]["heatingCh2Enabled"] = src.opentherm.heatingCh2Enabled;
@@ -354,6 +356,9 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
dst["opentherm"]["modulationSyncWithHeating"] = src.opentherm.modulationSyncWithHeating;
dst["opentherm"]["getMinMaxTemp"] = src.opentherm.getMinMaxTemp;
dst["opentherm"]["nativeHeatingControl"] = src.opentherm.nativeHeatingControl;
dst["opentherm"]["immergasFix"] = src.opentherm.immergasFix;
dst["opentherm"]["filterNumValues"]["enable"] = src.opentherm.filterNumValues.enable;
dst["opentherm"]["filterNumValues"]["factor"] = roundd(src.opentherm.filterNumValues.factor, 2);
dst["mqtt"]["enable"] = src.mqtt.enable;
dst["mqtt"]["server"] = src.mqtt.server;
@@ -371,6 +376,8 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
dst["emergency"]["usePid"] = src.emergency.usePid;
dst["emergency"]["onNetworkFault"] = src.emergency.onNetworkFault;
dst["emergency"]["onMqttFault"] = src.emergency.onMqttFault;
dst["emergency"]["onIndoorSensorDisconnect"] = src.emergency.onIndoorSensorDisconnect;
dst["emergency"]["onOutdoorSensorDisconnect"] = src.emergency.onOutdoorSensorDisconnect;
}
dst["heating"]["enable"] = src.heating.enable;
@@ -401,12 +408,24 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
dst["sensors"]["outdoor"]["type"] = static_cast<byte>(src.sensors.outdoor.type);
dst["sensors"]["outdoor"]["gpio"] = src.sensors.outdoor.gpio;
char bleAddress[18];
sprintf(
bleAddress,
"%02x:%02x:%02x:%02x:%02x:%02x",
src.sensors.outdoor.bleAddress[0],
src.sensors.outdoor.bleAddress[1],
src.sensors.outdoor.bleAddress[2],
src.sensors.outdoor.bleAddress[3],
src.sensors.outdoor.bleAddress[4],
src.sensors.outdoor.bleAddress[5]
);
dst["sensors"]["outdoor"]["bleAddress"] = String(bleAddress);
dst["sensors"]["outdoor"]["offset"] = roundd(src.sensors.outdoor.offset, 2);
dst["sensors"]["indoor"]["type"] = static_cast<byte>(src.sensors.indoor.type);
dst["sensors"]["indoor"]["gpio"] = src.sensors.indoor.gpio;
char bleAddress[18];
sprintf(
bleAddress,
"%02x:%02x:%02x:%02x:%02x:%02x",
@@ -679,6 +698,42 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
}
}
if (!src["opentherm"]["pressureFactor"].isNull()) {
float value = src["opentherm"]["pressureFactor"].as<float>();
if (value > 0 && value <= 100 && fabs(value - dst.opentherm.pressureFactor) > 0.0001f) {
dst.opentherm.pressureFactor = roundd(value, 2);
changed = true;
}
}
if (!src["opentherm"]["dhwFlowRateFactor"].isNull()) {
float value = src["opentherm"]["dhwFlowRateFactor"].as<float>();
if (value > 0 && value <= 100 && fabs(value - dst.opentherm.dhwFlowRateFactor) > 0.0001f) {
dst.opentherm.dhwFlowRateFactor = roundd(value, 2);
changed = true;
}
}
if (src["opentherm"]["filterNumValues"]["enable"].is<bool>()) {
bool value = src["opentherm"]["filterNumValues"]["enable"].as<bool>();
if (value != dst.opentherm.filterNumValues.enable) {
dst.opentherm.filterNumValues.enable = value;
changed = true;
}
}
if (!src["opentherm"]["filterNumValues"]["factor"].isNull()) {
float value = src["opentherm"]["filterNumValues"]["factor"].as<float>();
if (value > 0 && value <= 1 && fabs(value - dst.opentherm.filterNumValues.factor) > 0.0001f) {
dst.opentherm.filterNumValues.factor = roundd(value, 2);
changed = true;
}
}
if (src["opentherm"]["dhwPresent"].is<bool>()) {
bool value = src["opentherm"]["dhwPresent"].as<bool>();
@@ -786,6 +841,15 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
}
}
if (src["opentherm"]["immergasFix"].is<bool>()) {
bool value = src["opentherm"]["immergasFix"].as<bool>();
if (value != dst.opentherm.immergasFix) {
dst.opentherm.immergasFix = value;
changed = true;
}
}
// mqtt
if (src["mqtt"]["enable"].is<bool>()) {
@@ -883,7 +947,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
if (src["emergency"]["useEquitherm"].is<bool>()) {
bool value = src["emergency"]["useEquitherm"].as<bool>();
if (!dst.opentherm.nativeHeatingControl && dst.sensors.outdoor.type != SensorType::MANUAL) {
if (!dst.opentherm.nativeHeatingControl && dst.sensors.outdoor.type != SensorType::MANUAL && dst.sensors.outdoor.type != SensorType::BLUETOOTH) {
if (value != dst.emergency.useEquitherm) {
dst.emergency.useEquitherm = value;
changed = true;
@@ -903,7 +967,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
if (src["emergency"]["usePid"].is<bool>()) {
bool value = src["emergency"]["usePid"].as<bool>();
if (!dst.opentherm.nativeHeatingControl && dst.sensors.indoor.type != SensorType::MANUAL) {
if (!dst.opentherm.nativeHeatingControl && dst.sensors.indoor.type != SensorType::MANUAL && dst.sensors.indoor.type != SensorType::BLUETOOTH) {
if (value != dst.emergency.usePid) {
dst.emergency.usePid = value;
changed = true;
@@ -937,6 +1001,26 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
changed = true;
}
}
if (src["emergency"]["onIndoorSensorDisconnect"].is<bool>()) {
bool value = src["emergency"]["onIndoorSensorDisconnect"].as<bool>();
if (value != dst.emergency.onIndoorSensorDisconnect) {
dst.emergency.onIndoorSensorDisconnect = value;
dst.emergency.usePid = false;
changed = true;
}
}
if (src["emergency"]["onOutdoorSensorDisconnect"].is<bool>()) {
bool value = src["emergency"]["onOutdoorSensorDisconnect"].as<bool>();
if (value != dst.emergency.onOutdoorSensorDisconnect) {
dst.emergency.onOutdoorSensorDisconnect = value;
dst.emergency.useEquitherm = false;
changed = true;
}
}
}
@@ -1167,6 +1251,16 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
}
break;
#if USE_BLE
case static_cast<byte>(SensorType::BLUETOOTH):
if (dst.sensors.outdoor.type != SensorType::BLUETOOTH) {
dst.sensors.outdoor.type = SensorType::BLUETOOTH;
dst.emergency.useEquitherm = false;
changed = true;
}
break;
#endif
default:
break;
}
@@ -1189,6 +1283,21 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
}
}
#if USE_BLE
if (!src["sensors"]["outdoor"]["bleAddress"].isNull()) {
String value = src["sensors"]["outdoor"]["bleAddress"].as<String>();
int tmp[6];
if(sscanf(value.c_str(), "%02x:%02x:%02x:%02x:%02x:%02x", &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]) == 6) {
for(uint8_t i = 0; i < 6; i++) {
if (dst.sensors.outdoor.bleAddress[i] != (uint8_t) tmp[i]) {
dst.sensors.outdoor.bleAddress[i] = (uint8_t) tmp[i];
changed = true;
}
}
}
}
#endif
if (!src["sensors"]["outdoor"]["offset"].isNull()) {
float value = src["sensors"]["outdoor"]["offset"].as<float>();
@@ -1222,6 +1331,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
case static_cast<byte>(SensorType::BLUETOOTH):
if (dst.sensors.indoor.type != SensorType::BLUETOOTH) {
dst.sensors.indoor.type = SensorType::BLUETOOTH;
dst.emergency.usePid = false;
changed = true;
}
break;
@@ -1437,8 +1547,17 @@ void varsToJson(const Variables& src, JsonVariant dst) {
dst["sensors"]["pressure"] = roundd(src.sensors.pressure, 2);
dst["sensors"]["dhwFlowRate"] = roundd(src.sensors.dhwFlowRate, 2);
dst["sensors"]["faultCode"] = src.sensors.faultCode;
dst["sensors"]["diagnosticCode"] = src.sensors.diagnosticCode;
dst["sensors"]["rssi"] = src.sensors.rssi;
dst["sensors"]["uptime"] = millis() / 1000ul;
dst["sensors"]["outdoor"]["connected"] = src.sensors.outdoor.connected;
dst["sensors"]["outdoor"]["rssi"] = src.sensors.outdoor.rssi;
dst["sensors"]["outdoor"]["battery"] = roundd(src.sensors.outdoor.battery, 2);
dst["sensors"]["outdoor"]["humidity"] = roundd(src.sensors.outdoor.humidity, 2);
dst["sensors"]["indoor"]["connected"] = src.sensors.indoor.connected;
dst["sensors"]["indoor"]["rssi"] = src.sensors.indoor.rssi;
dst["sensors"]["indoor"]["battery"] = roundd(src.sensors.indoor.battery, 2);
dst["sensors"]["indoor"]["humidity"] = roundd(src.sensors.indoor.humidity, 2);
dst["temperatures"]["indoor"] = roundd(src.temperatures.indoor, 2);
dst["temperatures"]["outdoor"] = roundd(src.temperatures.outdoor, 2);

View File

@@ -8,6 +8,7 @@
"issues": "Issues & questions",
"releases": "Releases"
},
"dbm": "dBm",
"button": {
"upgrade": "Upgrade",
@@ -87,10 +88,19 @@
"fault": "Fault",
"diag": "Diagnostic",
"extpump": "External pump",
"outdoorSensorConnected": "Outdoor sensor connected",
"outdoorSensorRssi": "Outdoor sensor RSSI",
"outdoorSensorHumidity": "Outdoor sensor humidity",
"outdoorSensorBattery": "Outdoor sensor battery",
"indoorSensorConnected": "Indoor sensor connected",
"indoorSensorRssi": "Indoor sensor RSSI",
"indoorSensorHumidity": "Indoor sensor humidity",
"indoorSensorBattery": "Indoor sensor battery",
"modulation": "Modulation",
"pressure": "Pressure",
"dhwFlowRate": "DHW flow rate",
"faultCode": "Fault code",
"diagCode": "Diagnostic code",
"indoorTemp": "Indoor temp",
"outdoorTemp": "Outdoor temp",
"heatingTemp": "Heating temp",
@@ -166,7 +176,8 @@
"enable": "Enable",
"note": {
"restart": "After changing these settings, the device must be restarted for the changes to take effect.",
"blankNotUse": "blank - not use"
"blankNotUse": "blank - not use",
"bleDevice": "BLE device can be used <u>only</u> with some ESP32 boards with BLE support!"
},
"temp": {
@@ -203,12 +214,12 @@
},
"heating": {
"hyst": "Hysteresis",
"hyst": "Hysteresis <small>(in degrees)</small>",
"maxMod": "Max modulation level"
},
"emergency": {
"desc": "<b>!</b> Emergency mode can be useful <u>only</u> when using Equitherm and/or PID (when normal work) and when reporting indoor/outdoor temperature via MQTT or API. In this mode, sensor values that are reported via MQTT/API are not used.",
"desc": "<b>!</b> Emergency mode can be useful <u>only</u> when using Equitherm and/or PID (when normal work) and when reporting indoor/outdoor temperature via MQTT/API/BLE. In this mode, sensor values that are reported via MQTT/API/BLE are not used.",
"target": {
"title": "Target temperature",
@@ -218,12 +229,14 @@
"events": {
"network": "On network fault",
"mqtt": "On MQTT fault"
"mqtt": "On MQTT fault",
"indoorSensorDisconnect": "On loss connection with indoor sensor",
"outdoorSensorDisconnect": "On loss connection with outdoor sensor"
},
"regulators": {
"equitherm": "Equitherm <small>(requires at least an external/boiler <u>outdoor</u> sensor)</small>",
"pid": "PID <small>(requires at least an external/BLE <u>indoor</u> sensor)</small>"
"equitherm": "Equitherm <small>(requires at least an external (DS18B20) or boiler <u>outdoor</u> sensor)</small>",
"pid": "PID <small>(requires at least an external (DS18B20) <u>indoor</u> sensor)</small>"
}
},
@@ -248,6 +261,25 @@
"outGpio": "Out GPIO",
"ledGpio": "RX LED GPIO",
"memberIdCode": "Master MemberID code",
"pressureFactor": {
"title": "Coeff. pressure correction",
"note": "If the pressure displayed is <b>X10</b> from the real one, set the <b>0.1</b>."
},
"dhwFlowRateFactor": {
"title": "Coeff. DHW flow rate correction",
"note": "If the DHW flow rate displayed is <b>X10</b> from the real one, set the <b>0.1</b>."
},
"fnv": {
"title": "Filtering numeric values",
"enable": {
"title": "Enable filtering",
"note": "It can be useful if there is a lot of sharp noise on the charts. The filter used is \"Running Average\"."
},
"factor": {
"title": "Filtration coeff.",
"note": "The lower the value, the smoother and <u>longer</u> the change in numeric values."
}
},
"options": {
"dhwPresent": "DHW present",
@@ -257,7 +289,8 @@
"dhwToCh2": "Duplicate DHW to CH2",
"dhwBlocking": "DHW blocking",
"modulationSyncWithHeating": "Sync modulation with heating",
"getMinMaxTemp": "Get min/max temp from boiler"
"getMinMaxTemp": "Get min/max temp from boiler",
"immergasFix": "Fix for Immergas boilers"
},
"faultState": {
@@ -288,14 +321,11 @@
"boiler": "From boiler via OpenTherm",
"manual": "Manual via MQTT/API",
"ext": "External (DS18B20)",
"ble": "BLE device <i>(ONLY for some ESP32 which support BLE)</i>"
"ble": "BLE device"
},
"gpio": "GPIO",
"offset": "Temp offset <small>(calibration)</small>",
"bleAddress": {
"title": "BLE address",
"note": "ONLY for some ESP32 which support BLE"
}
"bleAddress": "BLE device MAC address"
},
"extPump": {

View File

@@ -8,6 +8,7 @@
"issues": "Проблемы и вопросы",
"releases": "Релизы"
},
"dbm": "дБм",
"button": {
"upgrade": "Обновить",
@@ -87,10 +88,19 @@
"fault": "Ошибка",
"diag": "Диагностика",
"extpump": "Внешний насос",
"outdoorSensorConnected": "Датчик наруж. темп.",
"outdoorSensorRssi": "RSSI датчика наруж. темп.",
"outdoorSensorHumidity": "Влажность с наруж. датчика темп.",
"outdoorSensorBattery": "Заряд наруж. датчика темп.",
"indoorSensorConnected": "Датчик внутр. темп.",
"indoorSensorRssi": "RSSI датчика внутр. темп.",
"indoorSensorHumidity": "Влажность с внутр. датчика темп.",
"indoorSensorBattery": "Заряд внутр. датчика темп.",
"modulation": "Уровень модуляции",
"pressure": "Давление",
"dhwFlowRate": "Расход ГВС",
"faultCode": "Код ошибки",
"diagCode": "Диагностический код",
"indoorTemp": "Внутренняя темп.",
"outdoorTemp": "Наружная темп.",
"heatingTemp": "Темп. отопления",
@@ -166,7 +176,8 @@
"enable": "Вкл",
"note": {
"restart": "После изменения этих настроек устройство необходимо перезагрузить, чтобы изменения вступили в силу.",
"blankNotUse": "пусто - не использовать"
"blankNotUse": "пусто - не использовать",
"bleDevice": "BLE устройство можно использовать <u>только</u> с некоторыми платами ESP32, которые поддерживают BLE!"
},
"temp": {
@@ -203,12 +214,12 @@
},
"heating": {
"hyst": "Гистерезис",
"hyst": "Гистерезис <small>(в градусах)</small>",
"maxMod": "Макс. уровень модуляции"
},
"emergency": {
"desc": "<b>!</b> Аварийный режим может быть полезен <u>только</u> при использовании ПЗА и/или ПИД и при передачи наружной/внутренней температуры через MQTT или API. В этом режиме значения датчиков, передаваемые через MQTT/API, не используются.",
"desc": "<b>!</b> Аварийный режим может быть полезен <u>только</u> при использовании ПЗА и/или ПИД и при передачи наружной/внутренней температуры через MQTT/API/BLE. В этом режиме значения датчиков, передаваемые через MQTT/API/BLE, не используются.",
"target": {
"title": "Целевая температура",
@@ -218,12 +229,14 @@
"events": {
"network": "При отключении сети",
"mqtt": "При отключении MQTT"
"mqtt": "При отключении MQTT",
"indoorSensorDisconnect": "При потере связи с датчиком внутренней темп.",
"outdoorSensorDisconnect": "При потере связи с датчиком наружной темп."
},
"regulators": {
"equitherm": "ПЗА <small>(требуется внешний или подключенный к котлу датчик <u>наружной</u> температуры)</small>",
"pid": "ПИД <small>(требуется внешний/BLE датчик <u>внутренней</u> температуры)</small>"
"equitherm": "ПЗА <small>(требуется внешний (DS18B20) или подключенный к котлу датчик <u>наружной</u> температуры)</small>",
"pid": "ПИД <small>(требуется внешний (DS18B20) датчик <u>внутренней</u> температуры)</small>"
}
},
@@ -240,7 +253,7 @@
"p": "Коэффициент P",
"i": "Коэффициент I",
"d": "Коэффициент D",
"dt": "DT <small>в секундах</small>"
"dt": "DT <small>(сек)</small>"
},
"ot": {
@@ -248,6 +261,25 @@
"outGpio": "Выход GPIO",
"ledGpio": "RX LED GPIO",
"memberIdCode": "Master MemberID код",
"pressureFactor": {
"title": "Коэфф. коррекции давления",
"note": "Если давление отображается <b>Х10</b> от реального, установите значение <b>0.1</b>."
},
"dhwFlowRateFactor": {
"title": "Коэфф. коррекции потока ГВС",
"note": "Если поток ГВС отображается <b>Х10</b> от реального, установите значение <b>0.1</b>."
},
"fnv": {
"title": "Фильтрация числовых значений",
"enable": {
"title": "Включить фильтрацию",
"note": "Может быть полезно, если на графиках много резкого шума. В качестве фильтра используется \"бегущее среднее\"."
},
"factor": {
"title": "Коэфф. фильтрации",
"note": "Чем меньше коэф., тем плавнее и <u>дольше</u> изменение числовых значений."
}
},
"options": {
"dhwPresent": "Контур ГВС",
@@ -257,7 +289,8 @@
"dhwToCh2": "Дублировать параметры ГВС в канал 2",
"dhwBlocking": "DHW blocking",
"modulationSyncWithHeating": "Синхронизировать модуляцию с отоплением",
"getMinMaxTemp": "Получать мин. и макс. температуру от котла"
"getMinMaxTemp": "Получать мин. и макс. температуру от котла",
"immergasFix": "Фикс для котлов Immergas"
},
"faultState": {
@@ -268,7 +301,7 @@
"nativeHeating": {
"title": "Передать управление отоплением котлу",
"note": "Работает <u>ТОЛЬКО</u> если котел требует и принимает целевую температуру в помещении и сам регулирует температуру теплоносителя на основе встроенного режима кривых. Несовместимо с ПИД и ПЗА, а также с гистерезисом встроенного ПО."
"note": "Работает <u>ТОЛЬКО</u> если котел требует и принимает целевую температуру в помещении и сам регулирует температуру теплоносителя на основе встроенного режима кривых. Несовместимо с ПИД, ПЗА и гистерезисом."
}
},
@@ -279,7 +312,7 @@
"user": "Имя пользователя",
"password": "Пароль",
"prefix": "Префикс",
"interval": "Интервал публикации (в секундах)"
"interval": "Интервал публикации <small>(сек)</small>"
},
"tempSensor": {
@@ -288,14 +321,11 @@
"boiler": "От котла через OpenTherm",
"manual": "Вручную через MQTT/API",
"ext": "Внешний датчик (DS18B20)",
"ble": "BLE устройство <i>(ТОЛЬКО для некоторых плат ESP32 с поддержкой BLE)</i>"
"ble": "BLE устройство"
},
"gpio": "GPIO",
"offset": "Смещение температуры <small>(калибровка)</small>",
"bleAddress": {
"title": "BLE адрес",
"note": "ТОЛЬКО для некоторых плат ESP32 с поддержкой BLE"
}
"bleAddress": "MAC адрес BLE устройства"
},
"extPump": {

View File

@@ -114,6 +114,38 @@
<th scope="row" data-i18n>dashboard.state.extpump</th>
<td><input type="radio" id="ot-external-pump" aria-invalid="false" checked disabled /></td>
</tr>
<tr>
<th scope="row" data-i18n>dashboard.state.outdoorSensorConnected</th>
<td><input type="radio" id="outdoor-sensor-connected" aria-invalid="false" checked disabled /></td>
</tr>
<tr>
<th scope="row" data-i18n>dashboard.state.outdoorSensorRssi</th>
<td><b id="outdoor-sensor-rssi"></b> <span data-i18n>dbm</span></td>
</tr>
<tr>
<th scope="row" data-i18n>dashboard.state.outdoorSensorHumidity</th>
<td><b id="outdoor-sensor-humidity"></b> %</td>
</tr>
<tr>
<th scope="row" data-i18n>dashboard.state.outdoorSensorBattery</th>
<td><b id="outdoor-sensor-battery"></b> %</td>
</tr>
<tr>
<th scope="row" data-i18n>dashboard.state.indoorSensorConnected</th>
<td><input type="radio" id="indoor-sensor-connected" aria-invalid="false" checked disabled /></td>
</tr>
<tr>
<th scope="row" data-i18n>dashboard.state.indoorSensorRssi</th>
<td><b id="indoor-sensor-rssi"></b> <span data-i18n>dbm</span></td>
</tr>
<tr>
<th scope="row" data-i18n>dashboard.state.indoorSensorHumidity</th>
<td><b id="indoor-sensor-humidity"></b> %</td>
</tr>
<tr>
<th scope="row" data-i18n>dashboard.state.indoorSensorBattery</th>
<td><b id="indoor-sensor-battery"></b> %</td>
</tr>
<tr>
<th scope="row" data-i18n>dashboard.state.modulation</th>
<td><b id="ot-modulation"></b> %</td>
@@ -130,6 +162,10 @@
<th scope="row" data-i18n>dashboard.state.faultCode</th>
<td><b id="ot-fault-code"></b></td>
</tr>
<tr>
<th scope="row" data-i18n>dashboard.state.diagCode</th>
<td><b id="ot-diag-code"></b></td>
</tr>
<tr>
<th scope="row" data-i18n>dashboard.state.indoorTemp</th>
<td><b id="indoor-temp"></b> <span class="temp-unit"></span></td>
@@ -377,6 +413,7 @@
setValue('#thermostat-dhw-current', result.temperatures.dhw);
setState('#ot-connected', result.states.otStatus);
setState('#mqtt-connected', result.states.mqtt);
setState('#ot-emergency', result.states.emergency);
setState('#ot-heating', result.states.heating);
setState('#ot-dhw', result.states.dhw);
@@ -384,12 +421,31 @@
setState('#ot-fault', result.states.fault);
setState('#ot-diagnostic', result.states.diagnostic);
setState('#ot-external-pump', result.states.externalPump);
setState('#mqtt-connected', result.states.mqtt);
setState('#outdoor-sensor-connected', result.sensors.outdoor.connected);
setState('#indoor-sensor-connected', result.sensors.indoor.connected);
setValue('#outdoor-sensor-rssi', result.sensors.outdoor.rssi);
setValue('#outdoor-sensor-humidity', result.sensors.outdoor.humidity);
setValue('#outdoor-sensor-battery', result.sensors.outdoor.battery);
setValue('#indoor-sensor-rssi', result.sensors.indoor.rssi);
setValue('#indoor-sensor-humidity', result.sensors.indoor.humidity);
setValue('#indoor-sensor-battery', result.sensors.indoor.battery);
setValue('#ot-modulation', result.sensors.modulation);
setValue('#ot-pressure', result.sensors.pressure);
setValue('#ot-dhw-flow-rate', result.sensors.dhwFlowRate);
setValue('#ot-fault-code', result.sensors.faultCode ? ("E" + result.sensors.faultCode) : "-");
setValue(
'#ot-fault-code',
result.sensors.faultCode
? (result.sensors.faultCode + " (0x" + dec2hex(result.sensors.faultCode) + ")")
: "-"
);
setValue(
'#ot-diag-code',
result.sensors.diagnosticCode
? (result.sensors.diagnosticCode + " (0x" + dec2hex(result.sensors.diagnosticCode) + ")")
: "-"
);
setValue('#indoor-temp', result.temperatures.indoor);
setValue('#outdoor-temp', result.temperatures.outdoor);

View File

@@ -233,6 +233,16 @@
<input type="checkbox" id="emergency-on-mqtt-fault" name="emergency[onMqttFault]" value="true">
<span data-i18n>settings.emergency.events.mqtt</span>
</label>
<label for="emergency-on-indoor-sensor-disconnect">
<input type="checkbox" id="emergency-on-indoor-sensor-disconnect" name="emergency[onIndoorSensorDisconnect]" value="true">
<span data-i18n>settings.emergency.events.indoorSensorDisconnect</span>
</label>
<label for="emergency-on-outdoor-sensor-disconnect">
<input type="checkbox" id="emergency-on-outdoor-sensor-disconnect" name="emergency[onOutdoorSensorDisconnect]" value="true">
<span data-i18n>settings.emergency.events.outdoorSensorDisconnect</span>
</label>
</fieldset>
<fieldset>
@@ -391,6 +401,20 @@
</label>
</div>
<div class="grid">
<label for="opentherm-pressure-factor">
<span data-i18n>settings.ot.pressureFactor.title</span>
<input type="number" inputmode="numeric" id="opentherm-pressure-factor" name="opentherm[pressureFactor]" min="0.1" max="100" step="0.01">
<small data-i18n>settings.ot.pressureFactor.note</small>
</label>
<label for="opentherm-dhw-fr-factor">
<span data-i18n>settings.ot.dhwFlowRateFactor.title</span>
<input type="number" inputmode="numeric" id="opentherm-dhw-fr-factor" name="opentherm[dhwFlowRateFactor]" min="0.1" max="100" step="0.01">
<small data-i18n>settings.ot.dhwFlowRateFactor.note</small>
</label>
</div>
<fieldset>
<legend data-i18n>settings.section.ot.options</legend>
<label for="opentherm-dhw-present">
@@ -433,6 +457,31 @@
<span data-i18n>settings.ot.options.getMinMaxTemp</span>
</label>
<label for="opentherm-immergas-fix">
<input type="checkbox" id="opentherm-immergas-fix" name="opentherm[immergasFix]" value="true">
<span data-i18n>settings.ot.options.immergasFix</span>
</label>
<hr />
<fieldset>
<legend>
<span data-i18n>settings.ot.fnv.title</span>
</legend>
<label for="opentherm-fnv-enable">
<input type="checkbox" id="opentherm-fnv-enable" name="opentherm[filterNumValues][enable]" value="true">
<span data-i18n>settings.ot.fnv.enable.title</span>
<br>
<small data-i18n>settings.ot.fnv.enable.note</small>
</label>
<label for="opentherm-fnv-factor">
<span data-i18n>settings.ot.fnv.factor.title</span>
<input type="number" inputmode="numeric" id="opentherm-fnv-factor" name="opentherm[filterNumValues][factor]" min="0.01" max="1" step="0.01">
<small data-i18n>settings.ot.fnv.factor.note</small>
</label>
</fieldset>
<hr />
<fieldset>
<label for="opentherm-fault-state-gpio">
@@ -544,17 +593,33 @@
<input type="radio" class="outdoor-sensor-type" name="sensors[outdoor][type]" value="2" />
<span data-i18n>settings.tempSensor.source.ext</span>
</label>
<label>
<input type="radio" class="outdoor-sensor-type" name="sensors[outdoor][type]" value="3" />
<span data-i18n>settings.tempSensor.source.ble</span>
</label>
</fieldset>
<label for="outdoor-sensor-gpio">
<span data-i18n>settings.tempSensor.gpio</span>
<input type="number" inputmode="numeric" id="outdoor-sensor-gpio" name="sensors[outdoor][gpio]" min="0" max="254" step="1">
</label>
<div class="grid">
<label for="outdoor-sensor-gpio">
<span data-i18n>settings.tempSensor.gpio</span>
<input type="number" inputmode="numeric" id="outdoor-sensor-gpio" name="sensors[outdoor][gpio]" min="0" max="254" step="1">
</label>
<label for="outdoor-sensor-ble-addresss">
<span data-i18n>settings.tempSensor.bleAddress</span>
<input type="text" id="outdoor-sensor-ble-addresss" name="sensors[outdoor][bleAddress]" pattern="([A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2}">
</label>
</div>
<label for="outdoor-sensor-offset">
<span data-i18n>settings.tempSensor.offset</span>
<input type="number" inputmode="numeric" id="outdoor-sensor-offset" name="sensors[outdoor][offset]" min="-10" max="10" step="0.01" required>
</label>
<fieldset>
<mark data-i18n>settings.note.bleDevice</mark>
</fieldset>
<button type="submit" data-i18n>button.save</button>
</form>
@@ -587,24 +652,27 @@
</label>
</fieldset>
<label for="indoor-sensor-gpio">
<span data-i18n>settings.tempSensor.gpio</span>
<input type="number" inputmode="numeric" id="indoor-sensor-gpio" name="sensors[indoor][gpio]" min="0" max="254" step="1">
</label>
<div class="grid">
<label for="indoor-sensor-offset">
<span data-i18n>settings.tempSensor.offset</span>
<input type="number" inputmode="numeric" id="indoor-sensor-offset" name="sensors[indoor][offset]" min="-10" max="10" step="0.01" required>
<label for="indoor-sensor-gpio">
<span data-i18n>settings.tempSensor.gpio</span>
<input type="number" inputmode="numeric" id="indoor-sensor-gpio" name="sensors[indoor][gpio]" min="0" max="254" step="1">
</label>
<label for="indoor-sensor-ble-addresss">
<span data-i18n>settings.tempSensor.bleAddress.title</span>
<span data-i18n>settings.tempSensor.bleAddress</span>
<input type="text" id="indoor-sensor-ble-addresss" name="sensors[indoor][bleAddress]" pattern="([A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2}">
<small data-i18n>settings.tempSensor.bleAddress.note</small>
</label>
</div>
<label for="indoor-sensor-offset">
<span data-i18n>settings.tempSensor.offset</span>
<input type="number" inputmode="numeric" id="indoor-sensor-offset" name="sensors[indoor][offset]" min="-10" max="10" step="0.01" required>
</label>
<fieldset>
<mark data-i18n>settings.note.bleDevice</mark>
</fieldset>
<button type="submit" data-i18n>button.save</button>
</form>
</div>
@@ -698,6 +766,8 @@
setInputValue('#opentherm-fault-state-gpio', data.opentherm.faultStateGpio < 255 ? data.opentherm.faultStateGpio : '');
setCheckboxValue('#opentherm-invert-fault-state', data.opentherm.invertFaultState);
setInputValue('#opentherm-member-id-code', data.opentherm.memberIdCode);
setInputValue('#opentherm-pressure-factor', data.opentherm.pressureFactor);
setInputValue('#opentherm-dhw-fr-factor', data.opentherm.dhwFlowRateFactor);
setCheckboxValue('#opentherm-dhw-present', data.opentherm.dhwPresent);
setCheckboxValue('#opentherm-sw-mode', data.opentherm.summerWinterMode);
setCheckboxValue('#opentherm-heating-ch2-enabled', data.opentherm.heatingCh2Enabled);
@@ -707,6 +777,9 @@
setCheckboxValue('#opentherm-sync-modulation-with-heating', data.opentherm.modulationSyncWithHeating);
setCheckboxValue('#opentherm-get-min-max-temp', data.opentherm.getMinMaxTemp);
setCheckboxValue('#opentherm-native-heating-control', data.opentherm.nativeHeatingControl);
setCheckboxValue('#opentherm-immergas-fix', data.opentherm.immergasFix);
setCheckboxValue('#opentherm-fnv-enable', data.opentherm.filterNumValues.enable);
setInputValue('#opentherm-fnv-factor', data.opentherm.filterNumValues.factor);
setBusy('#opentherm-settings-busy', '#opentherm-settings', false);
// MQTT
@@ -724,6 +797,7 @@
setRadioValue('.outdoor-sensor-type', data.sensors.outdoor.type);
setInputValue('#outdoor-sensor-gpio', data.sensors.outdoor.gpio < 255 ? data.sensors.outdoor.gpio : '');
setInputValue('#outdoor-sensor-offset', data.sensors.outdoor.offset);
setInputValue('#outdoor-sensor-ble-addresss', data.sensors.outdoor.bleAddress);
setBusy('#outdoor-sensor-settings-busy', '#outdoor-sensor-settings', false);
// Indoor sensor
@@ -772,6 +846,8 @@
setCheckboxValue('#emergency-use-pid', data.emergency.usePid);
setCheckboxValue('#emergency-on-network-fault', data.emergency.onNetworkFault);
setCheckboxValue('#emergency-on-mqtt-fault', data.emergency.onMqttFault);
setCheckboxValue('#emergency-on-indoor-sensor-disconnect', data.emergency.onIndoorSensorDisconnect);
setCheckboxValue('#emergency-on-outdoor-sensor-disconnect', data.emergency.onOutdoorSensorDisconnect);
setInputValue('#emergency-target', data.emergency.target, {
"min": (!data.emergency.useEquitherm && !data.emergency.usePid) ? data.heating.minTemp : 10,
"max": (!data.emergency.useEquitherm && !data.emergency.usePid) ? data.heating.maxTemp : 30,

View File

@@ -102,7 +102,7 @@ class Lang {
}
getSuitableLocale(locales) {
return locales.find(this.localeIsSupported) || this.defaultLocale;
return locales.find(this.localeIsSupported, this) || this.defaultLocale;
}
browserLocales(codeOnly = false) {

View File

@@ -14,14 +14,11 @@ function setupForm(formSelector, onResultCallback = null, noCastItems = []) {
let button = form.querySelector('button[type="submit"]');
let defaultText;
if (button) {
defaultText = button.textContent;
}
form.addEventListener('submit', async (event) => {
event.preventDefault();
if (button) {
defaultText = button.textContent;
button.textContent = i18n("button.wait");
button.setAttribute('disabled', true);
button.setAttribute('aria-busy', true);
@@ -100,16 +97,13 @@ function setupNetworkScanForm(formSelector, tableSelector) {
let button = form.querySelector('button[type="submit"]');
let defaultText;
if (button) {
defaultText = button.innerHTML;
}
const onSubmitFn = async (event) => {
if (event) {
event.preventDefault();
}
if (button) {
defaultText = button.innerHTML;
button.innerHTML = i18n('button.wait');
button.setAttribute('disabled', true);
button.setAttribute('aria-busy', true);
@@ -262,14 +256,11 @@ function setupRestoreBackupForm(formSelector) {
let button = form.querySelector('button[type="submit"]');
let defaultText;
if (button) {
defaultText = button.textContent;
}
form.addEventListener('submit', async (event) => {
event.preventDefault();
if (button) {
defaultText = button.textContent;
button.textContent = i18n('button.wait');
button.setAttribute('disabled', true);
button.setAttribute('aria-busy', true);
@@ -349,10 +340,6 @@ function setupUpgradeForm(formSelector) {
let button = form.querySelector('button[type="submit"]');
let defaultText;
if (button) {
defaultText = button.textContent;
}
const statusToText = (status) => {
switch (status) {
case 0:
@@ -456,6 +443,7 @@ function setupUpgradeForm(formSelector) {
hide('.upgrade-filesystem-result');
if (button) {
defaultText = button.textContent;
button.textContent = i18n('button.uploading');
button.setAttribute('disabled', true);
button.setAttribute('aria-busy', true);
@@ -621,7 +609,7 @@ function memberIdToVendor(memberId) {
27: "Baxi",
29: "Itho Daalderop",
33: "Viessmann",
41: "Italtherm",
41: "Italtherm/Radiant",
56: "Baxi Luna Duo-Tec",
131: "Nefit",
148: "Navien",
@@ -677,4 +665,13 @@ function form2json(data, noCastItems = []) {
let object = Array.from(data).reduce(method, {});
return JSON.stringify(object);
}
function dec2hex(i) {
let hex = parseInt(i).toString(16);
if (hex.length % 2 != 0) {
hex = "0" + hex;
}
return hex.toUpperCase();
}

View File

@@ -1,12 +0,0 @@
{
"version": 1,
"editor": "wokwi",
"parts": [
{ "type": "wokwi-esp32-devkit-v1", "id": "esp", "top": 0, "left": 0, "attrs": {} }
],
"connections": [
[ "esp:TX0", "$serialMonitor:RX", "", [] ],
[ "esp:RX0", "$serialMonitor:TX", "", [] ]
]
}

View File

@@ -1,8 +0,0 @@
[wokwi]
version = 1
elf = "../../.pio/build/nodemcu_32s/firmware.elf"
firmware = "../../.pio/build/nodemcu_32s/firmware.bin"
[[net.forward]]
from = "localhost:9080"
to = "target:80"