mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-11-12 01:14:45 +05:00
Compare commits
14
Commits
master
..
ab239d2239
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab239d2239 | ||
|
|
5544f43162 | ||
|
|
06c2ddcf96 | ||
|
|
0bb05006f4 | ||
|
|
5046bc0e8f | ||
|
|
0d3adad446 | ||
|
|
587678f184 | ||
|
|
72235286c0 | ||
|
|
ee868b22ce | ||
|
|
8046a7e13f | ||
|
|
0ec1fc5f24 | ||
|
|
061136b13e | ||
|
|
3e61dabeab | ||
|
|
e5f4281d4c |
No files matched your search
@@ -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 }}
|
||||||
@@ -7,7 +7,7 @@ jobs:
|
|||||||
stale:
|
stale:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v11
|
- uses: actions/stale@v9
|
||||||
with:
|
with:
|
||||||
stale-issue-message: >
|
stale-issue-message: >
|
||||||
This issue is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 5 days.
|
This issue is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 5 days.
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ All available information and instructions can be found in the wiki:
|
|||||||
* [Leds on board](https://github.com/Laxilef/OTGateway/wiki/OT-adapters#leds-on-board)
|
* [Leds on board](https://github.com/Laxilef/OTGateway/wiki/OT-adapters#leds-on-board)
|
||||||
|
|
||||||
## Gratitude
|
## Gratitude
|
||||||
* To the developers of the libraries used: [OpenTherm Library](https://github.com/ihormelnyk/opentherm_library), [ESP8266Scheduler](https://github.com/nrwiersma/ESP8266Scheduler), [ArduinoJson](https://github.com/bblanchon/ArduinoJson), [NimBLE-Arduino](https://github.com/h2zero/NimBLE-Arduino), [ArduinoMqttClient](https://github.com/arduino-libraries/ArduinoMqttClient), [ESPTelnet](https://github.com/LennartHennigs/ESPTelnet), [FileData](https://github.com/GyverLibs/FileData), [GyverPID](https://github.com/GyverLibs/GyverPID), [GyverBlinker](https://github.com/GyverLibs/GyverBlinker), [OneWireNg](https://github.com/pstolarz/OneWireNg) & [OneWire](https://github.com/PaulStoffregen/OneWire)
|
* To the developers of the libraries used: [OpenTherm Library](https://github.com/ihormelnyk/opentherm_library), [ESP8266Scheduler](https://github.com/nrwiersma/ESP8266Scheduler), [ArduinoJson](https://github.com/bblanchon/ArduinoJson), [NimBLE-Arduino](https://github.com/h2zero/NimBLE-Arduino), [ArduinoMqttClient](https://github.com/arduino-libraries/ArduinoMqttClient), [ESPTelnet](https://github.com/LennartHennigs/ESPTelnet), [FileData](https://github.com/GyverLibs/FileData), [GyverPID](https://github.com/GyverLibs/GyverPID), [GyverBlinker](https://github.com/GyverLibs/GyverBlinker), [FileData](https://github.com/GyverLibs/FileData), [OneWireNg](https://github.com/pstolarz/OneWireNg) & [OneWire](https://github.com/PaulStoffregen/OneWire)
|
||||||
* To the [PlatformIO](https://platformio.org/) Team
|
* To the [PlatformIO](https://platformio.org/) Team
|
||||||
* To the team and contributors of the [pioarduino](https://github.com/pioarduino/platform-espressif32) project
|
* To the team and contributors of the [pioarduino](https://github.com/pioarduino/platform-espressif32) project
|
||||||
* To the [BrowserStack](https://www.browserstack.com/) team. This project is tested with BrowserStack.
|
* To the [BrowserStack](https://www.browserstack.com/) team. This project is tested with BrowserStack.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Blueprint for reporting indoor/outdoor temperature to OpenTherm Gateway from any home assistant sensor
|
# Blueprint for reporting indoor/outdoor temperature to OpenTherm Gateway from any home assistant sensor
|
||||||
# Updated: 26.01.2026
|
# Updated: 03.09.2024
|
||||||
|
|
||||||
blueprint:
|
blueprint:
|
||||||
name: Report temp to OpenTherm Gateway
|
name: Report temp to OpenTherm Gateway
|
||||||
@@ -15,6 +15,7 @@ blueprint:
|
|||||||
multiple: false
|
multiple: false
|
||||||
filter:
|
filter:
|
||||||
- domain: sensor
|
- domain: sensor
|
||||||
|
device_class: temperature
|
||||||
target_entity:
|
target_entity:
|
||||||
name: Target entity
|
name: Target entity
|
||||||
description: "Usually ``number.opentherm_indoor_temp`` or ``number.opentherm_outdoor_temp``"
|
description: "Usually ``number.opentherm_indoor_temp`` or ``number.opentherm_outdoor_temp``"
|
||||||
@@ -37,12 +38,8 @@ condition:
|
|||||||
value_template: "{{ states(source_entity) != 'unavailable' and states(target_entity) != 'unavailable' }}"
|
value_template: "{{ states(source_entity) != 'unavailable' and states(target_entity) != 'unavailable' }}"
|
||||||
action:
|
action:
|
||||||
- if:
|
- if:
|
||||||
- condition: or
|
|
||||||
conditions:
|
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ (states(source_entity)|float(0) - states(target_entity)|float(0)) | abs | round(2) >= 0.01 }}"
|
value_template: "{{ (states(source_entity)|float(0) - states(target_entity)|float(0)) | abs | round(2) >= 0.01 }}"
|
||||||
- condition: template
|
|
||||||
value_template: "{{ (as_timestamp(now()) - as_timestamp(states[target_entity].last_updated)) | int(0) > 300 }}"
|
|
||||||
then:
|
then:
|
||||||
- service: number.set_value
|
- service: number.set_value
|
||||||
data:
|
data:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Blueprint for reporting temperature to OpenTherm Gateway from home assistant weather integration
|
# Blueprint for reporting temperature to OpenTherm Gateway from home assistant weather integration
|
||||||
# Updated: 26.01.2026
|
# Updated: 03.09.2024
|
||||||
|
|
||||||
blueprint:
|
blueprint:
|
||||||
name: Report temp to OpenTherm Gateway from Weather
|
name: Report temp to OpenTherm Gateway from Weather
|
||||||
@@ -37,12 +37,8 @@ condition:
|
|||||||
value_template: "{{ states(source_entity) != 'unavailable' and states(target_entity) != 'unavailable' }}"
|
value_template: "{{ states(source_entity) != 'unavailable' and states(target_entity) != 'unavailable' }}"
|
||||||
action:
|
action:
|
||||||
- if:
|
- if:
|
||||||
- condition: or
|
|
||||||
conditions:
|
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ (state_attr(source_entity, 'temperature')|float(0) - states(target_entity)|float(0)) | abs | round(2) >= 0.1 }}"
|
value_template: "{{ (state_attr(source_entity, 'temperature')|float(0) - states(target_entity)|float(0)) | abs | round(2) >= 0.1 }}"
|
||||||
- condition: template
|
|
||||||
value_template: "{{ (as_timestamp(now()) - as_timestamp(states[target_entity].last_updated)) | int(0) > 300 }}"
|
|
||||||
then:
|
then:
|
||||||
- service: number.set_value
|
- service: number.set_value
|
||||||
data:
|
data:
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
class CustomOpenTherm : public OpenTherm {
|
class CustomOpenTherm : public OpenTherm {
|
||||||
public:
|
public:
|
||||||
typedef std::function<void(unsigned int)> DelayCallback;
|
typedef std::function<void(unsigned int)> DelayCallback;
|
||||||
typedef std::function<void(unsigned long, uint8_t)> BeforeSendRequestCallback;
|
typedef std::function<void(unsigned long, byte)> BeforeSendRequestCallback;
|
||||||
typedef std::function<void(unsigned long, unsigned long, OpenThermResponseStatus, uint8_t)> AfterSendRequestCallback;
|
typedef std::function<void(unsigned long, unsigned long, OpenThermResponseStatus, byte)> AfterSendRequestCallback;
|
||||||
|
|
||||||
CustomOpenTherm(int inPin = 4, int outPin = 5, bool isSlave = false, bool alwaysReceive = false) : OpenTherm(inPin, outPin, isSlave, alwaysReceive) {}
|
CustomOpenTherm(int inPin = 4, int outPin = 5, bool isSlave = false, bool alwaysReceive = false) : OpenTherm(inPin, outPin, isSlave, alwaysReceive) {}
|
||||||
~CustomOpenTherm() {}
|
~CustomOpenTherm() {}
|
||||||
@@ -70,89 +70,51 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline auto sendBoilerReset() {
|
bool sendBoilerReset() {
|
||||||
return this->sendRequestCode(1);
|
unsigned int data = 1;
|
||||||
}
|
data <<= 8;
|
||||||
|
|
||||||
inline auto sendServiceReset() {
|
|
||||||
return this->sendRequestCode(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline auto sendWaterFilling() {
|
|
||||||
return this->sendRequestCode(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool sendRequestCode(const uint8_t requestCode) {
|
|
||||||
unsigned long response = this->sendRequest(buildRequest(
|
unsigned long response = this->sendRequest(buildRequest(
|
||||||
OpenThermMessageType::WRITE_DATA,
|
OpenThermMessageType::WRITE_DATA,
|
||||||
OpenThermMessageID::RemoteRequest,
|
OpenThermMessageID::RemoteRequest,
|
||||||
static_cast<unsigned int>(requestCode) << 8
|
data
|
||||||
));
|
));
|
||||||
|
|
||||||
if (!isValidResponse(response) || !isValidResponseId(response, OpenThermMessageID::RemoteRequest)) {
|
return isValidResponse(response) && isValidResponseId(response, OpenThermMessageID::RemoteRequest);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t responseRequestCode = (response & 0xFFFF) >> 8;
|
bool sendServiceReset() {
|
||||||
const uint8_t responseCode = response & 0xFF;
|
unsigned int data = 10;
|
||||||
if (responseRequestCode != requestCode || responseCode < 128) {
|
data <<= 8;
|
||||||
return false;
|
unsigned long response = this->sendRequest(buildRequest(
|
||||||
}
|
|
||||||
|
|
||||||
// reset
|
|
||||||
this->sendRequest(buildRequest(
|
|
||||||
OpenThermMessageType::WRITE_DATA,
|
OpenThermMessageType::WRITE_DATA,
|
||||||
OpenThermMessageID::RemoteRequest,
|
OpenThermMessageID::RemoteRequest,
|
||||||
0u << 8
|
data
|
||||||
));
|
));
|
||||||
|
|
||||||
return true;
|
return isValidResponse(response) && isValidResponseId(response, OpenThermMessageID::RemoteRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getStr(OpenThermMessageID id, char* buffer, uint16_t length = 50) {
|
bool sendWaterFilling() {
|
||||||
if (buffer == nullptr || length == 0) {
|
unsigned int data = 2;
|
||||||
return false;
|
data <<= 8;
|
||||||
}
|
unsigned long response = this->sendRequest(buildRequest(
|
||||||
|
OpenThermMessageType::WRITE_DATA,
|
||||||
unsigned long response;
|
OpenThermMessageID::RemoteRequest,
|
||||||
uint8_t index = 0;
|
data
|
||||||
uint8_t maxIndex = 255;
|
|
||||||
|
|
||||||
while (index <= maxIndex && index < length) {
|
|
||||||
response = this->sendRequest(buildRequest(
|
|
||||||
OpenThermMessageType::READ_DATA,
|
|
||||||
id,
|
|
||||||
static_cast<unsigned int>(index) << 8
|
|
||||||
));
|
));
|
||||||
|
|
||||||
if (!isValidResponse(response) || !isValidResponseId(response, id)) {
|
return isValidResponse(response) && isValidResponseId(response, OpenThermMessageID::RemoteRequest);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t character = response & 0xFF;
|
static bool isCh2Active(unsigned long response)
|
||||||
if (character == 0) {
|
{
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (index == 0) {
|
|
||||||
maxIndex = (response & 0xFFFF) >> 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
buffer[index++] = static_cast<char>(character);
|
|
||||||
}
|
|
||||||
|
|
||||||
buffer[index] = '\0';
|
|
||||||
return index > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool isCh2Active(unsigned long response) {
|
|
||||||
return response & 0x20;
|
return response & 0x20;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isValidResponseId(unsigned long response, OpenThermMessageID id) {
|
static bool isValidResponseId(unsigned long response, OpenThermMessageID id) {
|
||||||
const uint8_t responseId = (response >> 16) & 0xFF;
|
byte responseId = (response >> 16) & 0xFF;
|
||||||
|
|
||||||
return static_cast<uint8_t>(id) == responseId;
|
return (byte)id == responseId;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t getResponseMessageTypeId(unsigned long response) {
|
static uint8_t getResponseMessageTypeId(unsigned long response) {
|
||||||
@@ -163,10 +125,10 @@ public:
|
|||||||
uint8_t msgType = getResponseMessageTypeId(response);
|
uint8_t msgType = getResponseMessageTypeId(response);
|
||||||
|
|
||||||
switch (msgType) {
|
switch (msgType) {
|
||||||
case static_cast<uint8_t>(OpenThermMessageType::READ_ACK):
|
case (uint8_t) OpenThermMessageType::READ_ACK:
|
||||||
case static_cast<uint8_t>(OpenThermMessageType::WRITE_ACK):
|
case (uint8_t) OpenThermMessageType::WRITE_ACK:
|
||||||
case static_cast<uint8_t>(OpenThermMessageType::DATA_INVALID):
|
case (uint8_t) OpenThermMessageType::DATA_INVALID:
|
||||||
case static_cast<uint8_t>(OpenThermMessageType::UNKNOWN_DATA_ID):
|
case (uint8_t) OpenThermMessageType::UNKNOWN_DATA_ID:
|
||||||
return CustomOpenTherm::messageTypeToString(
|
return CustomOpenTherm::messageTypeToString(
|
||||||
static_cast<OpenThermMessageType>(msgType)
|
static_cast<OpenThermMessageType>(msgType)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -147,19 +147,8 @@ public:
|
|||||||
return topic;
|
return topic;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class DT, class VT>
|
|
||||||
String getEntityIdWithPrefix(DT domain, VT value, char separator = '_') {
|
|
||||||
String topic = "";
|
|
||||||
topic.concat(domain);
|
|
||||||
topic.concat('.');
|
|
||||||
topic.concat(this->devicePrefix);
|
|
||||||
topic.concat(separator);
|
|
||||||
topic.concat(value);
|
|
||||||
return topic;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
String getUniqueIdWithPrefix(T value, char separator = '_') {
|
String getObjectIdWithPrefix(T value, char separator = '_') {
|
||||||
String topic = "";
|
String topic = "";
|
||||||
topic.concat(this->devicePrefix);
|
topic.concat(this->devicePrefix);
|
||||||
topic.concat(separator);
|
topic.concat(separator);
|
||||||
|
|||||||
@@ -12,67 +12,66 @@ const char HA_ENTITY_SELECT[] PROGMEM = "select";
|
|||||||
const char HA_ENTITY_SENSOR[] PROGMEM = "sensor";
|
const char HA_ENTITY_SENSOR[] PROGMEM = "sensor";
|
||||||
const char HA_ENTITY_SWITCH[] PROGMEM = "switch";
|
const char HA_ENTITY_SWITCH[] PROGMEM = "switch";
|
||||||
|
|
||||||
// https://www.home-assistant.io/integrations/mqtt/#supported-abbreviations-in-mqtt-discovery-messages
|
const char HA_DEVICE[] PROGMEM = "device";
|
||||||
const char HA_DEFAULT_ENTITY_ID[] PROGMEM = "def_ent_id"; // "default_entity_id "
|
const char HA_IDENTIFIERS[] PROGMEM = "identifiers";
|
||||||
const char HA_DEVICE[] PROGMEM = "dev"; // "device"
|
const char HA_SW_VERSION[] PROGMEM = "sw_version";
|
||||||
const char HA_IDENTIFIERS[] PROGMEM = "ids"; // "identifiers"
|
const char HA_MANUFACTURER[] PROGMEM = "manufacturer";
|
||||||
const char HA_SW_VERSION[] PROGMEM = "sw"; // "sw_version"
|
const char HA_MODEL[] PROGMEM = "model";
|
||||||
const char HA_MANUFACTURER[] PROGMEM = "mf"; // "manufacturer"
|
|
||||||
const char HA_MODEL[] PROGMEM = "mdl"; // "model"
|
|
||||||
const char HA_NAME[] PROGMEM = "name";
|
const char HA_NAME[] PROGMEM = "name";
|
||||||
const char HA_CONF_URL[] PROGMEM = "cu"; // "configuration_url"
|
const char HA_CONF_URL[] PROGMEM = "configuration_url";
|
||||||
const char HA_COMMAND_TOPIC[] PROGMEM = "cmd_t"; // "command_topic"
|
const char HA_COMMAND_TOPIC[] PROGMEM = "command_topic";
|
||||||
const char HA_COMMAND_TEMPLATE[] PROGMEM = "cmd_tpl"; // "command_template"
|
const char HA_COMMAND_TEMPLATE[] PROGMEM = "command_template";
|
||||||
const char HA_ENABLED_BY_DEFAULT[] PROGMEM = "en"; // "enabled_by_default"
|
const char HA_ENABLED_BY_DEFAULT[] PROGMEM = "enabled_by_default";
|
||||||
const char HA_UNIQUE_ID[] PROGMEM = "uniq_id"; // "unique_id"
|
const char HA_UNIQUE_ID[] PROGMEM = "unique_id";
|
||||||
const char HA_ENTITY_CATEGORY[] PROGMEM = "ent_cat"; // "entity_category"
|
const char HA_OBJECT_ID[] PROGMEM = "object_id";
|
||||||
|
const char HA_ENTITY_CATEGORY[] PROGMEM = "entity_category";
|
||||||
const char HA_ENTITY_CATEGORY_DIAGNOSTIC[] PROGMEM = "diagnostic";
|
const char HA_ENTITY_CATEGORY_DIAGNOSTIC[] PROGMEM = "diagnostic";
|
||||||
const char HA_ENTITY_CATEGORY_CONFIG[] PROGMEM = "config";
|
const char HA_ENTITY_CATEGORY_CONFIG[] PROGMEM = "config";
|
||||||
const char HA_STATE_TOPIC[] PROGMEM = "stat_t"; // "state_topic"
|
const char HA_STATE_TOPIC[] PROGMEM = "state_topic";
|
||||||
const char HA_VALUE_TEMPLATE[] PROGMEM = "val_tpl"; // "value_template"
|
const char HA_VALUE_TEMPLATE[] PROGMEM = "value_template";
|
||||||
const char HA_OPTIONS[] PROGMEM = "ops"; // "options"
|
const char HA_OPTIONS[] PROGMEM = "options";
|
||||||
const char HA_AVAILABILITY[] PROGMEM = "avty"; // "availability"
|
const char HA_AVAILABILITY[] PROGMEM = "availability";
|
||||||
const char HA_AVAILABILITY_MODE[] PROGMEM = "avty_mode"; // "availability_mode"
|
const char HA_AVAILABILITY_MODE[] PROGMEM = "availability_mode";
|
||||||
const char HA_TOPIC[] PROGMEM = "t"; // "topic"
|
const char HA_TOPIC[] PROGMEM = "topic";
|
||||||
const char HA_DEVICE_CLASS[] PROGMEM = "dev_cla"; // "device_class"
|
const char HA_DEVICE_CLASS[] PROGMEM = "device_class";
|
||||||
const char HA_UNIT_OF_MEASUREMENT[] PROGMEM = "unit_of_meas"; // "unit_of_measurement"
|
const char HA_UNIT_OF_MEASUREMENT[] PROGMEM = "unit_of_measurement";
|
||||||
const char HA_UNIT_OF_MEASUREMENT_C[] PROGMEM = "°C";
|
const char HA_UNIT_OF_MEASUREMENT_C[] PROGMEM = "°C";
|
||||||
const char HA_UNIT_OF_MEASUREMENT_F[] PROGMEM = "°F";
|
const char HA_UNIT_OF_MEASUREMENT_F[] PROGMEM = "°F";
|
||||||
const char HA_UNIT_OF_MEASUREMENT_PERCENT[] PROGMEM = "%";
|
const char HA_UNIT_OF_MEASUREMENT_PERCENT[] PROGMEM = "%";
|
||||||
const char HA_UNIT_OF_MEASUREMENT_L_MIN[] PROGMEM = "L/min";
|
const char HA_UNIT_OF_MEASUREMENT_L_MIN[] PROGMEM = "L/min";
|
||||||
const char HA_UNIT_OF_MEASUREMENT_GAL_MIN[] PROGMEM = "gal/min";
|
const char HA_UNIT_OF_MEASUREMENT_GAL_MIN[] PROGMEM = "gal/min";
|
||||||
const char HA_ICON[] PROGMEM = "ic"; // "icon"
|
const char HA_ICON[] PROGMEM = "icon";
|
||||||
const char HA_MIN[] PROGMEM = "min";
|
const char HA_MIN[] PROGMEM = "min";
|
||||||
const char HA_MAX[] PROGMEM = "max";
|
const char HA_MAX[] PROGMEM = "max";
|
||||||
const char HA_STEP[] PROGMEM = "step";
|
const char HA_STEP[] PROGMEM = "step";
|
||||||
const char HA_MODE[] PROGMEM = "mode";
|
const char HA_MODE[] PROGMEM = "mode";
|
||||||
const char HA_MODE_BOX[] PROGMEM = "box";
|
const char HA_MODE_BOX[] PROGMEM = "box";
|
||||||
const char HA_STATE_ON[] PROGMEM = "stat_on"; // "state_on"
|
const char HA_STATE_ON[] PROGMEM = "state_on";
|
||||||
const char HA_STATE_OFF[] PROGMEM = "stat_off"; // "state_off"
|
const char HA_STATE_OFF[] PROGMEM = "state_off";
|
||||||
const char HA_PAYLOAD_ON[] PROGMEM = "pl_on"; // "payload_on"
|
const char HA_PAYLOAD_ON[] PROGMEM = "payload_on";
|
||||||
const char HA_PAYLOAD_OFF[] PROGMEM = "pl_off"; // "payload_off"
|
const char HA_PAYLOAD_OFF[] PROGMEM = "payload_off";
|
||||||
const char HA_STATE_CLASS[] PROGMEM = "stat_cla"; // "state_class"
|
const char HA_STATE_CLASS[] PROGMEM = "state_class";
|
||||||
const char HA_STATE_CLASS_MEASUREMENT[] PROGMEM = "measurement";
|
const char HA_STATE_CLASS_MEASUREMENT[] PROGMEM = "measurement";
|
||||||
const char HA_EXPIRE_AFTER[] PROGMEM = "exp_aft"; // "expire_after"
|
const char HA_EXPIRE_AFTER[] PROGMEM = "expire_after";
|
||||||
const char HA_CURRENT_TEMPERATURE_TOPIC[] PROGMEM = "curr_temp_t"; // "current_temperature_topic"
|
const char HA_CURRENT_TEMPERATURE_TOPIC[] PROGMEM = "current_temperature_topic";
|
||||||
const char HA_CURRENT_TEMPERATURE_TEMPLATE[] PROGMEM = "curr_temp_tpl"; // "current_temperature_template"
|
const char HA_CURRENT_TEMPERATURE_TEMPLATE[] PROGMEM = "current_temperature_template";
|
||||||
const char HA_TEMPERATURE_COMMAND_TOPIC[] PROGMEM = "temp_cmd_t"; // "temperature_command_topic"
|
const char HA_TEMPERATURE_COMMAND_TOPIC[] PROGMEM = "temperature_command_topic";
|
||||||
const char HA_TEMPERATURE_COMMAND_TEMPLATE[] PROGMEM = "temp_cmd_tpl"; // "temperature_command_template"
|
const char HA_TEMPERATURE_COMMAND_TEMPLATE[] PROGMEM = "temperature_command_template";
|
||||||
const char HA_TEMPERATURE_STATE_TOPIC[] PROGMEM = "temp_stat_t"; // "temperature_state_topic"
|
const char HA_TEMPERATURE_STATE_TOPIC[] PROGMEM = "temperature_state_topic";
|
||||||
const char HA_TEMPERATURE_STATE_TEMPLATE[] PROGMEM = "temp_stat_tpl"; // "temperature_state_template"
|
const char HA_TEMPERATURE_STATE_TEMPLATE[] PROGMEM = "temperature_state_template";
|
||||||
const char HA_TEMPERATURE_UNIT[] PROGMEM = "temp_unit"; // "temperature_unit"
|
const char HA_TEMPERATURE_UNIT[] PROGMEM = "temperature_unit";
|
||||||
const char HA_MODE_COMMAND_TOPIC[] PROGMEM = "mode_cmd_t"; // "mode_command_topic"
|
const char HA_MODE_COMMAND_TOPIC[] PROGMEM = "mode_command_topic";
|
||||||
const char HA_MODE_COMMAND_TEMPLATE[] PROGMEM = "mode_cmd_tpl"; // "mode_command_template"
|
const char HA_MODE_COMMAND_TEMPLATE[] PROGMEM = "mode_command_template";
|
||||||
const char HA_MODE_STATE_TOPIC[] PROGMEM = "mode_stat_t"; // "mode_state_topic"
|
const char HA_MODE_STATE_TOPIC[] PROGMEM = "mode_state_topic";
|
||||||
const char HA_MODE_STATE_TEMPLATE[] PROGMEM = "mode_stat_tpl"; // "mode_state_template"
|
const char HA_MODE_STATE_TEMPLATE[] PROGMEM = "mode_state_template";
|
||||||
const char HA_MODES[] PROGMEM = "modes";
|
const char HA_MODES[] PROGMEM = "modes";
|
||||||
const char HA_ACTION_TOPIC[] PROGMEM = "act_t"; // "action_topic"
|
const char HA_ACTION_TOPIC[] PROGMEM = "action_topic";
|
||||||
const char HA_ACTION_TEMPLATE[] PROGMEM = "act_tpl"; // "action_template"
|
const char HA_ACTION_TEMPLATE[] PROGMEM = "action_template";
|
||||||
const char HA_MIN_TEMP[] PROGMEM = "min_temp";
|
const char HA_MIN_TEMP[] PROGMEM = "min_temp";
|
||||||
const char HA_MAX_TEMP[] PROGMEM = "max_temp";
|
const char HA_MAX_TEMP[] PROGMEM = "max_temp";
|
||||||
const char HA_TEMP_STEP[] PROGMEM = "temp_step";
|
const char HA_TEMP_STEP[] PROGMEM = "temp_step";
|
||||||
const char HA_PRESET_MODE_COMMAND_TOPIC[] PROGMEM = "pr_mode_cmd_t"; // "preset_mode_command_topic"
|
const char HA_PRESET_MODE_COMMAND_TOPIC[] PROGMEM = "preset_mode_command_topic";
|
||||||
const char HA_PRESET_MODE_COMMAND_TEMPLATE[] PROGMEM = "pr_mode_cmd_tpl"; // "preset_mode_command_template"
|
const char HA_PRESET_MODE_COMMAND_TEMPLATE[] PROGMEM = "preset_mode_command_template";
|
||||||
const char HA_PRESET_MODE_STATE_TOPIC[] PROGMEM = "pr_mode_stat_t"; // "preset_mode_state_topic"
|
const char HA_PRESET_MODE_STATE_TOPIC[] PROGMEM = "preset_mode_state_topic";
|
||||||
const char HA_PRESET_MODE_VALUE_TEMPLATE[] PROGMEM = "pr_mode_val_tpl"; // "preset_mode_value_template"
|
const char HA_PRESET_MODE_VALUE_TEMPLATE[] PROGMEM = "preset_mode_value_template";
|
||||||
const char HA_PRESET_MODES[] PROGMEM = "pr_modes"; // "preset_modes"
|
const char HA_PRESET_MODES[] PROGMEM = "preset_modes";
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <NetworkUplink.h>
|
|
||||||
#include <NetworkWifi.h>
|
|
||||||
|
|
||||||
namespace NetworkUtils {
|
|
||||||
/**
|
|
||||||
* @brief Fallback AP: the setup network, raised when the station cannot carry the uplink
|
|
||||||
*/
|
|
||||||
class ApUplink : public NetworkUplink {
|
|
||||||
public:
|
|
||||||
ApUplink(UplinkContext* context, WifiUplink* wifi) : NetworkUplink(context), wifi(wifi) {}
|
|
||||||
|
|
||||||
void loop() override {
|
|
||||||
// the association carries the traffic again: retire the AP once it is stable and idle
|
|
||||||
if (this->wifi->isActive()) {
|
|
||||||
if (
|
|
||||||
this->isEnabled() && !this->hasClients()
|
|
||||||
&& millis() - this->wifi->getConnectedTime() >= this->retireDelay
|
|
||||||
) {
|
|
||||||
Log.sinfoln(FPSTR(L_NETWORK), F("Stop AP because STA connected"));
|
|
||||||
this->stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->isEnabled()) {
|
|
||||||
this->attempt.disarm();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// a failed softAP() retries once the window runs out
|
|
||||||
if (this->attempt.isPending()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The AP interface is up, whether or not anyone is on it
|
|
||||||
*
|
|
||||||
* A parked radio means the AP is not carrying anything, whatever the mode still says.
|
|
||||||
*/
|
|
||||||
bool isActive() override {
|
|
||||||
return this->isEnabled() && !this->wifi->isSuspended();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isEnabled() {
|
|
||||||
return (WiFi.getMode() & WIFI_AP) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasClients() {
|
|
||||||
if (!this->isEnabled()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return WiFi.softAPgetStationNum() > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void start() {
|
|
||||||
Log.sinfoln(
|
|
||||||
FPSTR(L_NETWORK),
|
|
||||||
this->wifi->hasCredentials()
|
|
||||||
? F("Disconnected for a long time, start AP")
|
|
||||||
: F("No STA credentials, start AP")
|
|
||||||
);
|
|
||||||
|
|
||||||
WiFi.mode(WIFI_AP_STA);
|
|
||||||
this->context->delayCallback(250);
|
|
||||||
|
|
||||||
if (!WiFi.softAP(this->context->apName, this->context->apPassword, this->context->apChannel)) {
|
|
||||||
this->attempt.arm(this->startTimeout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void stop() {
|
|
||||||
WiFi.mode(WIFI_STA);
|
|
||||||
this->attempt.disarm();
|
|
||||||
}
|
|
||||||
|
|
||||||
IPAddress localIP() override {
|
|
||||||
return WiFi.softAPIP();
|
|
||||||
}
|
|
||||||
|
|
||||||
IPAddress subnetMask() override {
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
|
||||||
return WiFi.softAPSubnetMask();
|
|
||||||
#else
|
|
||||||
return IPAddress(255, 255, 255, 0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
IPAddress gatewayIP() override {
|
|
||||||
return WiFi.softAPIP();
|
|
||||||
}
|
|
||||||
|
|
||||||
IPAddress dnsIP() override {
|
|
||||||
return WiFi.softAPIP();
|
|
||||||
}
|
|
||||||
|
|
||||||
String macAddress() override {
|
|
||||||
return WiFi.softAPmacAddress();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const unsigned long retireDelay = 15000;
|
|
||||||
const unsigned long startTimeout = 5000;
|
|
||||||
|
|
||||||
WifiUplink* wifi;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
#pragma once
|
|
||||||
#if defined(ARDUINO_ARCH_ESP8266)
|
#if defined(ARDUINO_ARCH_ESP8266)
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include "lwip/etharp.h"
|
#include "lwip/etharp.h"
|
||||||
|
|||||||
@@ -1,269 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <NetworkUplink.h>
|
|
||||||
|
|
||||||
#ifdef NETWORK_HAS_ETHERNET
|
|
||||||
#include <ETH.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace NetworkUtils {
|
|
||||||
/**
|
|
||||||
* @brief Ethernet uplink: the W5500 driver, its cable and its DHCP lease
|
|
||||||
*/
|
|
||||||
class EthernetUplink : public NetworkUplink {
|
|
||||||
public:
|
|
||||||
explicit EthernetUplink(UplinkContext* context) : NetworkUplink(context) {}
|
|
||||||
|
|
||||||
void loop() override {
|
|
||||||
#ifdef NETWORK_HAS_ETHERNET
|
|
||||||
if (this->restartFlag) {
|
|
||||||
this->restartFlag = false;
|
|
||||||
|
|
||||||
// The W5500 driver cannot be re-initialized in place: Arduino's ETH.end() leaves
|
|
||||||
// the SPI bus allocated, so a wiring change only takes effect after a restart.
|
|
||||||
if (this->started) {
|
|
||||||
Log.swarningln(FPSTR(L_NETWORK), F("Ethernet: settings changed, restart required to apply them"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this->enabled || !this->hasPins()) {
|
|
||||||
if (this->active || this->linkUp) {
|
|
||||||
this->active = false;
|
|
||||||
this->linkUp = false;
|
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_NETWORK), F("Ethernet: disabled, handing the uplink back to WiFi"));
|
|
||||||
}
|
|
||||||
|
|
||||||
this->attempt.disarm();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this->started) {
|
|
||||||
if (this->startUnavailable) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.sinfoln(
|
|
||||||
FPSTR(L_NETWORK),
|
|
||||||
F("Ethernet: init W5500 (CS: %u, IRQ: %u, RST: %u, CLK: %u, MISO: %u, MOSI: %u)"),
|
|
||||||
this->cs,
|
|
||||||
this->irq,
|
|
||||||
this->rst,
|
|
||||||
this->clk,
|
|
||||||
this->miso,
|
|
||||||
this->mosi
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!ETH.begin(ETH_PHY_W5500, 1, this->cs, this->irq, this->rst, SPI2_HOST, this->clk, this->miso, this->mosi, 12)) {
|
|
||||||
// A failed init leaves the SPI bus allocated, so retrying cannot succeed;
|
|
||||||
// wait for a restart instead of flapping.
|
|
||||||
this->startUnavailable = true;
|
|
||||||
this->attempt.disarm();
|
|
||||||
|
|
||||||
Log.serrorln(FPSTR(L_NETWORK), F("Ethernet: W5500 init failed, check the wiring and restart"));
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->started = true;
|
|
||||||
this->running = true;
|
|
||||||
this->prevLinkCheck = 0;
|
|
||||||
this->attempt.arm(this->linkGrace);
|
|
||||||
|
|
||||||
if (!this->context->useDhcp) {
|
|
||||||
ETH.config(this->context->staticIp, this->context->staticGateway, this->context->staticSubnet, this->context->staticDns);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strlen(this->context->hostname) && UplinkContext::isHostnameValid(this->context->hostname)) {
|
|
||||||
ETH.setHostname(this->context->hostname);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (millis() - this->prevLinkCheck < this->linkCheckInterval) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->prevLinkCheck = millis();
|
|
||||||
|
|
||||||
if (!ETH.linkUp()) {
|
|
||||||
if (this->linkUp) {
|
|
||||||
this->linkUp = false;
|
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_NETWORK), F("Ethernet: cable disconnected"));
|
|
||||||
}
|
|
||||||
|
|
||||||
this->attempt.disarm();
|
|
||||||
|
|
||||||
if (this->active) {
|
|
||||||
this->active = false;
|
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_NETWORK), F("Ethernet: link lost, falling back to WiFi"));
|
|
||||||
this->context->delayCallback(250);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this->linkUp) {
|
|
||||||
this->linkUp = true;
|
|
||||||
this->attempt.arm(this->leaseGrace);
|
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_NETWORK), F("Ethernet: cable connected"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ETH.connected() || this->active) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->active = true;
|
|
||||||
this->attempt.disarm();
|
|
||||||
|
|
||||||
Log.sinfoln(
|
|
||||||
FPSTR(L_NETWORK),
|
|
||||||
F("Ethernet: using ethernet instead of WiFi, IP: %s, link: %u Mbps, duplex: %u"),
|
|
||||||
ETH.localIP().toString().c_str(),
|
|
||||||
ETH.linkSpeed(),
|
|
||||||
ETH.fullDuplex() ? 1 : 0
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Ethernet carries the uplink: cable plugged in and DHCP lease obtained
|
|
||||||
*/
|
|
||||||
bool isActive() override {
|
|
||||||
#ifdef NETWORK_HAS_ETHERNET
|
|
||||||
if (!this->enabled || !this->started) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ETH.linkUp() && ETH.connected();
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Enable/disable the interface, taking the driver in and out of the FSM
|
|
||||||
*/
|
|
||||||
void setEnabled(bool value) {
|
|
||||||
this->enabled = value;
|
|
||||||
|
|
||||||
#ifdef NETWORK_HAS_ETHERNET
|
|
||||||
// The driver stays installed: stop() only takes the link and the netif down, while the
|
|
||||||
// SPI bus, the MAC and the netif itself stay allocated, so start() resumes without a restart
|
|
||||||
if (this->started && ETH.handle() != nullptr && value != this->running) {
|
|
||||||
esp_err_t ret = value ? esp_eth_start(ETH.handle()) : esp_eth_stop(ETH.handle());
|
|
||||||
|
|
||||||
if (ret == ESP_OK) {
|
|
||||||
this->running = value;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.serrorln(FPSTR(L_NETWORK), F("Ethernet: driver %s failed"), value ? "start" : "stop");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Configure the W5500 wiring. Use GPIO_IS_NOT_CONFIGURED to disable
|
|
||||||
*/
|
|
||||||
void setPins(uint8_t clk, uint8_t mosi, uint8_t miso, uint8_t cs, uint8_t irq, uint8_t rst) {
|
|
||||||
if (
|
|
||||||
clk != this->clk || mosi != this->mosi || miso != this->miso
|
|
||||||
|| cs != this->cs || irq != this->irq || rst != this->rst
|
|
||||||
) {
|
|
||||||
this->markSettingsChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
this->clk = clk;
|
|
||||||
this->mosi = mosi;
|
|
||||||
this->miso = miso;
|
|
||||||
this->cs = cs;
|
|
||||||
this->irq = irq;
|
|
||||||
this->rst = rst;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief A setting the driver reads changed: applying it needs a restart
|
|
||||||
*/
|
|
||||||
void markSettingsChanged() {
|
|
||||||
if (this->started) {
|
|
||||||
this->restartFlag = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasPins() {
|
|
||||||
return this->clk != GPIO_IS_NOT_CONFIGURED
|
|
||||||
&& this->mosi != GPIO_IS_NOT_CONFIGURED
|
|
||||||
&& this->miso != GPIO_IS_NOT_CONFIGURED
|
|
||||||
&& this->cs != GPIO_IS_NOT_CONFIGURED
|
|
||||||
&& this->irq != GPIO_IS_NOT_CONFIGURED
|
|
||||||
&& this->rst != GPIO_IS_NOT_CONFIGURED;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPAddress localIP() override {
|
|
||||||
#ifdef NETWORK_HAS_ETHERNET
|
|
||||||
return ETH.localIP();
|
|
||||||
#else
|
|
||||||
return IPAddress();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
IPAddress subnetMask() override {
|
|
||||||
#ifdef NETWORK_HAS_ETHERNET
|
|
||||||
return ETH.subnetMask();
|
|
||||||
#else
|
|
||||||
return IPAddress();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
IPAddress gatewayIP() override {
|
|
||||||
#ifdef NETWORK_HAS_ETHERNET
|
|
||||||
return ETH.gatewayIP();
|
|
||||||
#else
|
|
||||||
return IPAddress();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
IPAddress dnsIP() override {
|
|
||||||
#ifdef NETWORK_HAS_ETHERNET
|
|
||||||
return ETH.dnsIP();
|
|
||||||
#else
|
|
||||||
return IPAddress();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
String macAddress() override {
|
|
||||||
#ifdef NETWORK_HAS_ETHERNET
|
|
||||||
return ETH.macAddress();
|
|
||||||
#else
|
|
||||||
return String();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const unsigned long linkCheckInterval = 1000;
|
|
||||||
const unsigned long linkGrace = 5000;
|
|
||||||
const unsigned long leaseGrace = 20000;
|
|
||||||
|
|
||||||
bool enabled = false;
|
|
||||||
bool started = false;
|
|
||||||
bool running = false;
|
|
||||||
bool active = false;
|
|
||||||
bool linkUp = false;
|
|
||||||
bool restartFlag = false;
|
|
||||||
bool startUnavailable = false;
|
|
||||||
|
|
||||||
uint8_t clk = GPIO_IS_NOT_CONFIGURED;
|
|
||||||
uint8_t mosi = GPIO_IS_NOT_CONFIGURED;
|
|
||||||
uint8_t miso = GPIO_IS_NOT_CONFIGURED;
|
|
||||||
uint8_t cs = GPIO_IS_NOT_CONFIGURED;
|
|
||||||
uint8_t irq = GPIO_IS_NOT_CONFIGURED;
|
|
||||||
uint8_t rst = GPIO_IS_NOT_CONFIGURED;
|
|
||||||
|
|
||||||
unsigned long prevLinkCheck = 0;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
+362
-200
@@ -1,314 +1,476 @@
|
|||||||
#pragma once
|
#if defined(ARDUINO_ARCH_ESP8266)
|
||||||
#include <NetworkAp.h>
|
#include <ESP8266WiFi.h>
|
||||||
|
#include "lwip/etharp.h"
|
||||||
|
#elif defined(ARDUINO_ARCH_ESP32)
|
||||||
|
#include <WiFi.h>
|
||||||
|
#include <esp_wifi.h>
|
||||||
|
#endif
|
||||||
#include <NetworkConnection.h>
|
#include <NetworkConnection.h>
|
||||||
#include <NetworkEthernet.h>
|
|
||||||
#include <NetworkUplink.h>
|
|
||||||
#include <NetworkWifi.h>
|
|
||||||
|
|
||||||
namespace NetworkUtils {
|
namespace NetworkUtils {
|
||||||
/**
|
|
||||||
* @brief Picks the uplink that carries the traffic and drives it
|
|
||||||
*
|
|
||||||
* The hierarchy is ethernet > WiFi > fallback AP: the first interface able to do it owns the
|
|
||||||
* pass, and every status getter reads that decision instead of re-testing the interfaces.
|
|
||||||
*/
|
|
||||||
class NetworkMgr {
|
class NetworkMgr {
|
||||||
public:
|
public:
|
||||||
NetworkMgr() : wifi(&this->context), ap(&this->context, &this->wifi), ethernet(&this->context) {
|
typedef std::function<void()> YieldCallback;
|
||||||
NetworkConnection::setup(this->context.useDhcp);
|
typedef std::function<void(unsigned int)> DelayCallback;
|
||||||
this->wifi.resetWifi();
|
|
||||||
|
NetworkMgr() {
|
||||||
|
NetworkConnection::setup(this->useDhcp);
|
||||||
|
this->resetWifi();
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkMgr* setYieldCallback(YieldCallback callback = nullptr) {
|
NetworkMgr* setYieldCallback(YieldCallback callback = nullptr) {
|
||||||
this->context.yieldCallback = callback;
|
this->yieldCallback = callback;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkMgr* setDelayCallback(DelayCallback callback = nullptr) {
|
NetworkMgr* setDelayCallback(DelayCallback callback = nullptr) {
|
||||||
this->context.delayCallback = callback;
|
this->delayCallback = callback;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkMgr* setHostname(const char* value) {
|
NetworkMgr* setHostname(const char* value) {
|
||||||
this->context.hostname = value;
|
this->hostname = value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
NetworkMgr* setApCredentials(const char* ssid, const char* password = nullptr, byte channel = 0) {
|
||||||
|
this->apName = ssid;
|
||||||
|
this->apPassword = password;
|
||||||
|
this->apChannel = channel;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkMgr* setApCredentials(const char* ssid, const char* password = nullptr, uint8_t channel = 0) {
|
NetworkMgr* setStaCredentials(const char* ssid = nullptr, const char* password = nullptr, byte channel = 0) {
|
||||||
this->context.apName = ssid;
|
this->staSsid = ssid;
|
||||||
this->context.apPassword = password;
|
this->staPassword = password;
|
||||||
this->context.apChannel = channel;
|
this->staChannel = channel;
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
NetworkMgr* setStaCredentials(const char* ssid = nullptr, const char* password = nullptr, uint8_t channel = 0) {
|
|
||||||
this->context.staSsid = ssid;
|
|
||||||
this->context.staPassword = password;
|
|
||||||
this->context.staChannel = channel;
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkMgr* setUseDhcp(bool value) {
|
NetworkMgr* setUseDhcp(bool value) {
|
||||||
if (value != this->context.useDhcp) {
|
this->useDhcp = value;
|
||||||
this->ethernet.markSettingsChanged();
|
NetworkConnection::setup(this->useDhcp);
|
||||||
}
|
|
||||||
|
|
||||||
this->context.useDhcp = value;
|
|
||||||
NetworkConnection::setup(this->context.useDhcp);
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkMgr* setStaticConfig(const char* ip, const char* gateway, const char* subnet, const char* dns) {
|
NetworkMgr* setStaticConfig(const char* ip, const char* gateway, const char* subnet, const char* dns) {
|
||||||
IPAddress valueIp, valueGateway, valueSubnet, valueDns;
|
this->staticIp.fromString(ip);
|
||||||
|
this->staticGateway.fromString(gateway);
|
||||||
valueIp.fromString(ip);
|
this->staticSubnet.fromString(subnet);
|
||||||
valueGateway.fromString(gateway);
|
this->staticDns.fromString(dns);
|
||||||
valueSubnet.fromString(subnet);
|
|
||||||
valueDns.fromString(dns);
|
|
||||||
|
|
||||||
if (
|
|
||||||
valueIp != this->context.staticIp || valueGateway != this->context.staticGateway
|
|
||||||
|| valueSubnet != this->context.staticSubnet || valueDns != this->context.staticDns
|
|
||||||
) {
|
|
||||||
this->ethernet.markSettingsChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
this->context.staticIp = valueIp;
|
|
||||||
this->context.staticGateway = valueGateway;
|
|
||||||
this->context.staticSubnet = valueSubnet;
|
|
||||||
this->context.staticDns = valueDns;
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkMgr* setStaticConfig(IPAddress& ip, IPAddress& gateway, IPAddress& subnet, IPAddress& dns) {
|
NetworkMgr* setStaticConfig(IPAddress& ip, IPAddress& gateway, IPAddress& subnet, IPAddress& dns) {
|
||||||
if (
|
this->staticIp = ip;
|
||||||
ip != this->context.staticIp || gateway != this->context.staticGateway
|
this->staticGateway = gateway;
|
||||||
|| subnet != this->context.staticSubnet || dns != this->context.staticDns
|
this->staticSubnet = subnet;
|
||||||
) {
|
this->staticDns = dns;
|
||||||
this->ethernet.markSettingsChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
this->context.staticIp = ip;
|
|
||||||
this->context.staticGateway = gateway;
|
|
||||||
this->context.staticSubnet = subnet;
|
|
||||||
this->context.staticDns = dns;
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
bool hasStaCredentials() {
|
||||||
* @brief Enable/disable the ethernet interface (W5500 over SPI)
|
return this->staSsid != nullptr;
|
||||||
*/
|
|
||||||
NetworkMgr* setEthernet(bool enabled) {
|
|
||||||
this->ethernet.setEnabled(enabled);
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Configure W5500 wiring. Use GPIO_IS_NOT_CONFIGURED to disable
|
|
||||||
*/
|
|
||||||
NetworkMgr* setEthernetPins(uint8_t clk, uint8_t mosi, uint8_t miso, uint8_t cs, uint8_t irq, uint8_t rst) {
|
|
||||||
this->ethernet.setPins(clk, mosi, miso, cs, irq, rst);
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Uplinks in the order they are tried: ethernet, WiFi, fallback AP
|
|
||||||
*/
|
|
||||||
enum class Uplink : uint8_t { None = 0, Ap, Wifi, Ethernet };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The uplink that currently carries traffic
|
|
||||||
*
|
|
||||||
* Always the first interface in the hierarchy that can do it, so every consumer reads the
|
|
||||||
* same decision instead of re-testing ethernet and overriding the WiFi answer.
|
|
||||||
*/
|
|
||||||
Uplink getUplink() {
|
|
||||||
if (this->ethernet.isActive()) {
|
|
||||||
return Uplink::Ethernet;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->wifi.isActive()) {
|
|
||||||
return Uplink::Wifi;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->ap.isActive()) {
|
|
||||||
return Uplink::Ap;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Uplink::None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isConnected() {
|
bool isConnected() {
|
||||||
return this->getUplink() >= Uplink::Wifi;
|
return this->isStaEnabled() && NetworkConnection::getStatus() == NetworkConnection::Status::CONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
bool isConnecting() {
|
||||||
* @brief WiFi signal quality in percent, 0 when WiFi is not carrying the uplink
|
return this->isStaEnabled() && NetworkConnection::getStatus() == NetworkConnection::Status::CONNECTING;
|
||||||
*/
|
|
||||||
uint8_t getSignalQuality() {
|
|
||||||
return this->getUplink() == Uplink::Wifi ? rssiToSignalQuality(this->wifi.rssi()) : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
bool isStaEnabled() {
|
||||||
* @return "ethernet", "wifi", "wifi-ap" or "none"
|
return (WiFi.getMode() & WIFI_STA) != 0;
|
||||||
*/
|
|
||||||
const char* getConnectionType() {
|
|
||||||
return uplinkName(this->getUplink());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Uplink token, already in locale-key shape
|
|
||||||
*/
|
|
||||||
static const char* uplinkName(Uplink uplink) {
|
|
||||||
switch (uplink) {
|
|
||||||
case Uplink::Ethernet:
|
|
||||||
return "ethernet";
|
|
||||||
|
|
||||||
case Uplink::Wifi:
|
|
||||||
return "wifi";
|
|
||||||
|
|
||||||
case Uplink::Ap:
|
|
||||||
return "wifi-ap";
|
|
||||||
|
|
||||||
default:
|
|
||||||
return "none";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isApEnabled() {
|
bool isApEnabled() {
|
||||||
return this->ap.isEnabled();
|
return (WiFi.getMode() & WIFI_AP) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasApClients() {
|
||||||
|
if (!this->isApEnabled()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return WiFi.softAPgetStationNum() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
short int getRssi() {
|
short int getRssi() {
|
||||||
return this->station()->rssi();
|
return WiFi.RSSI();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress getApIp() {
|
IPAddress getApIp() {
|
||||||
return this->ap.localIP();
|
return WiFi.softAPIP();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress getStaIp() {
|
IPAddress getStaIp() {
|
||||||
return this->station()->localIP();
|
return WiFi.localIP();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress getStaSubnet() {
|
IPAddress getStaSubnet() {
|
||||||
return this->station()->subnetMask();
|
return WiFi.subnetMask();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress getStaGateway() {
|
IPAddress getStaGateway() {
|
||||||
return this->station()->gatewayIP();
|
return WiFi.gatewayIP();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress getStaDns() {
|
IPAddress getStaDns() {
|
||||||
return this->station()->dnsIP();
|
return WiFi.dnsIP();
|
||||||
}
|
}
|
||||||
|
|
||||||
String getStaMac() {
|
String getStaMac() {
|
||||||
return this->station()->macAddress();
|
return WiFi.macAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* getStaSsid() {
|
const char* getStaSsid() {
|
||||||
return this->context.staSsid;
|
return this->staSsid;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t getStaChannel() {
|
const char* getStaPassword() {
|
||||||
return this->context.staChannel;
|
return this->staPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte getStaChannel() {
|
||||||
|
return this->staChannel;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool resetWifi() {
|
||||||
|
// set policy manual for work 13 ch
|
||||||
|
{
|
||||||
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
|
wifi_country_t country = {"JP", 1, 14, WIFI_COUNTRY_POLICY_MANUAL};
|
||||||
|
wifi_set_country(&country);
|
||||||
|
#elif defined(ARDUINO_ARCH_ESP32)
|
||||||
|
const wifi_country_t country = {"JP", 1, 14, CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER, WIFI_COUNTRY_POLICY_MANUAL};
|
||||||
|
esp_wifi_set_country(&country);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
WiFi.persistent(false);
|
||||||
|
#if !defined(ESP_ARDUINO_VERSION_MAJOR) || ESP_ARDUINO_VERSION_MAJOR < 3
|
||||||
|
WiFi.setAutoConnect(false);
|
||||||
|
#endif
|
||||||
|
WiFi.setAutoReconnect(false);
|
||||||
|
|
||||||
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
|
WiFi.setSleepMode(WIFI_NONE_SLEEP);
|
||||||
|
#elif defined(ARDUINO_ARCH_ESP32)
|
||||||
|
WiFi.setSleep(USE_BLE ? WIFI_PS_MIN_MODEM : WIFI_PS_NONE);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
WiFi.softAPdisconnect();
|
||||||
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
|
/*if (wifi_softap_dhcps_status() == DHCP_STARTED) {
|
||||||
|
wifi_softap_dhcps_stop();
|
||||||
|
}*/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
WiFi.disconnect(false, true);
|
||||||
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
|
/*if (wifi_station_dhcpc_status() == DHCP_STARTED) {
|
||||||
|
wifi_station_dhcpc_stop();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
wifi_station_dhcpc_set_maxtry(5);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ARDUINO_ARCH_ESP32) && ESP_ARDUINO_VERSION_MAJOR < 3
|
||||||
|
// Nothing. Because memory leaks when turn off WiFi on ESP32 SDK < 3.0.0
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return WiFi.mode(WIFI_OFF);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void reconnect() {
|
void reconnect() {
|
||||||
this->wifi.reconnect();
|
this->reconnectFlag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool connect(bool force = false, unsigned int timeout = 1000u) {
|
||||||
|
if (this->isConnected() && !force) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (force && !this->isApEnabled()) {
|
||||||
|
this->resetWifi();
|
||||||
|
NetworkConnection::reset();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/*#ifdef ARDUINO_ARCH_ESP8266
|
||||||
|
if (wifi_station_dhcpc_status() == DHCP_STARTED) {
|
||||||
|
wifi_station_dhcpc_stop();
|
||||||
|
}
|
||||||
|
#endif*/
|
||||||
|
|
||||||
|
this->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->hasStaCredentials()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->delayCallback(250);
|
||||||
|
|
||||||
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
if (this->setWifiHostname(this->hostname)) {
|
||||||
|
Log.straceln(FPSTR(L_NETWORK), F("Set hostname '%s': success"), this->hostname);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log.serrorln(FPSTR(L_NETWORK), F("Set hostname '%s': fail"), this->hostname);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!WiFi.mode((WiFiMode_t)(WiFi.getMode() | WIFI_STA))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->delayCallback(250);
|
||||||
|
|
||||||
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
|
if (this->setWifiHostname(this->hostname)) {
|
||||||
|
Log.straceln(FPSTR(L_NETWORK), F("Set hostname '%s': success"), this->hostname);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log.serrorln(FPSTR(L_NETWORK), F("Set hostname '%s': fail"), this->hostname);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->delayCallback(250);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
WiFi.setScanMethod(WIFI_ALL_CHANNEL_SCAN);
|
||||||
|
WiFi.setSortMethod(WIFI_CONNECT_AP_BY_SIGNAL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!this->useDhcp) {
|
||||||
|
WiFi.begin(this->staSsid, this->staPassword, this->staChannel, nullptr, false);
|
||||||
|
WiFi.config(this->staticIp, this->staticGateway, this->staticSubnet, this->staticDns);
|
||||||
|
WiFi.reconnect();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
WiFi.begin(this->staSsid, this->staPassword, this->staChannel, nullptr, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long beginConnectionTime = millis();
|
||||||
|
while (millis() - beginConnectionTime < timeout) {
|
||||||
|
this->delayCallback(100);
|
||||||
|
|
||||||
|
NetworkConnection::Status status = NetworkConnection::getStatus();
|
||||||
|
if (status != NetworkConnection::Status::CONNECTING && status != NetworkConnection::Status::NONE) {
|
||||||
|
return status == NetworkConnection::Status::CONNECTED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void disconnect() {
|
||||||
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
WiFi.disconnectAsync(false, true);
|
||||||
|
|
||||||
|
const unsigned long start = millis();
|
||||||
|
while (WiFi.isConnected() && (millis() - start) < 5000) {
|
||||||
|
this->delayCallback(100);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
WiFi.disconnect(false, true);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// The top of the hierarchy polls every pass so it can take the uplink whenever it can
|
if (this->reconnectFlag) {
|
||||||
this->ethernet.loop();
|
this->delayCallback(5000);
|
||||||
|
|
||||||
this->trackUplink();
|
Log.sinfoln(FPSTR(L_NETWORK), F("Reconnecting..."));
|
||||||
this->updateWifiRadio();
|
this->reconnectFlag = false;
|
||||||
|
this->disconnect();
|
||||||
|
NetworkConnection::reset();
|
||||||
|
this->delayCallback(1000);
|
||||||
|
|
||||||
if (this->getUplink() == Uplink::Ethernet) {
|
} else if (this->isConnected() && !this->hasStaCredentials()) {
|
||||||
|
Log.sinfoln(FPSTR(L_NETWORK), F("Reset"));
|
||||||
|
this->resetWifi();
|
||||||
|
NetworkConnection::reset();
|
||||||
|
this->delayCallback(1000);
|
||||||
|
|
||||||
|
} else if (this->isConnected()) {
|
||||||
|
if (!this->connected) {
|
||||||
|
this->connectedTime = millis();
|
||||||
|
this->connected = true;
|
||||||
|
|
||||||
|
Log.sinfoln(
|
||||||
|
FPSTR(L_NETWORK),
|
||||||
|
F("Connected, downtime: %lu s., IP: %s, RSSI: %hhd"),
|
||||||
|
(millis() - this->disconnectedTime) / 1000,
|
||||||
|
WiFi.localIP().toString().c_str(),
|
||||||
|
WiFi.RSSI()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->isApEnabled() && millis() - this->connectedTime > this->reconnectInterval && !this->hasApClients()) {
|
||||||
|
Log.sinfoln(FPSTR(L_NETWORK), F("Stop AP because STA connected"));
|
||||||
|
|
||||||
|
WiFi.mode(WIFI_STA);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// a pending ethernet attempt holds the hierarchy: nothing below it starts until it resolves
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
if (this->ethernet.isPending() && !this->wifi.isActive() && !this->ap.isActive()) {
|
if (millis() - this->prevArpGratuitous > 60000) {
|
||||||
return;
|
this->stationKeepAliveNow();
|
||||||
|
this->prevArpGratuitous = millis();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (this->connected) {
|
||||||
|
this->disconnectedTime = millis();
|
||||||
|
this->connected = false;
|
||||||
|
|
||||||
|
Log.sinfoln(
|
||||||
|
FPSTR(L_NETWORK),
|
||||||
|
F("Disconnected, reason: %d, uptime: %lu s."),
|
||||||
|
NetworkConnection::getDisconnectReason(),
|
||||||
|
(millis() - this->connectedTime) / 1000
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->wifi.loop();
|
if (!this->hasStaCredentials() && !this->isApEnabled()) {
|
||||||
|
Log.sinfoln(FPSTR(L_NETWORK), F("No STA credentials, start AP"));
|
||||||
|
|
||||||
// the ladder only reaches the AP once the station is out of the running
|
WiFi.mode(WIFI_AP_STA);
|
||||||
if (!this->wifi.isActive() && this->wifi.isPending()) {
|
this->delayCallback(250);
|
||||||
return;
|
WiFi.softAP(this->apName, this->apPassword, this->apChannel);
|
||||||
|
|
||||||
|
} else if (!this->isApEnabled() && millis() - this->disconnectedTime > this->failedConnectTimeout) {
|
||||||
|
Log.sinfoln(FPSTR(L_NETWORK), F("Disconnected for a long time, start AP"));
|
||||||
|
|
||||||
|
WiFi.mode(WIFI_AP_STA);
|
||||||
|
this->delayCallback(250);
|
||||||
|
WiFi.softAP(this->apName, this->apPassword, this->apChannel);
|
||||||
|
|
||||||
|
} else if (this->isConnecting() && millis() - this->prevReconnectingTime > this->resetConnectionTimeout) {
|
||||||
|
Log.swarningln(FPSTR(L_NETWORK), F("Connection timeout, reset wifi..."));
|
||||||
|
this->resetWifi();
|
||||||
|
NetworkConnection::reset();
|
||||||
|
this->delayCallback(250);
|
||||||
|
|
||||||
|
} else if (!this->isConnecting() && this->hasStaCredentials() && (!this->prevReconnectingTime || millis() - this->prevReconnectingTime > this->reconnectInterval)) {
|
||||||
|
Log.sinfoln(FPSTR(L_NETWORK), F("Try connect..."));
|
||||||
|
|
||||||
|
NetworkConnection::reset();
|
||||||
|
if (!this->connect(true, this->connectionTimeout)) {
|
||||||
|
Log.straceln(FPSTR(L_NETWORK), F("Connection failed. Status: %d, reason: %d, raw reason: %d"), NetworkConnection::getStatus(), NetworkConnection::getDisconnectReason(), NetworkConnection::rawDisconnectReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->ap.loop();
|
this->prevReconnectingTime = millis();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t rssiToSignalQuality(short int rssi) {
|
static byte rssiToSignalQuality(short int rssi) {
|
||||||
return constrain(map(rssi, -100, -50, 0, 100), 0, 100);
|
return constrain(map(rssi, -100, -50, 0, 100), 0, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
UplinkContext context;
|
const unsigned int reconnectInterval = 15000;
|
||||||
WifiUplink wifi;
|
const unsigned int failedConnectTimeout = 185000;
|
||||||
ApUplink ap;
|
const unsigned int connectionTimeout = 10000;
|
||||||
EthernetUplink ethernet;
|
const unsigned int resetConnectionTimeout = 90000;
|
||||||
|
|
||||||
Uplink uplink = Uplink::None;
|
YieldCallback yieldCallback = []() {
|
||||||
|
::yield();
|
||||||
|
};
|
||||||
|
DelayCallback delayCallback = [](unsigned int time) {
|
||||||
|
::delay(time);
|
||||||
|
};
|
||||||
|
|
||||||
|
const char* hostname = "esp";
|
||||||
|
const char* apName = "ESP";
|
||||||
|
const char* apPassword = nullptr;
|
||||||
|
byte apChannel = 1;
|
||||||
|
|
||||||
|
const char* staSsid = nullptr;
|
||||||
|
const char* staPassword = nullptr;
|
||||||
|
byte staChannel = 0;
|
||||||
|
|
||||||
|
bool useDhcp = true;
|
||||||
|
IPAddress staticIp;
|
||||||
|
IPAddress staticGateway;
|
||||||
|
IPAddress staticSubnet;
|
||||||
|
IPAddress staticDns;
|
||||||
|
|
||||||
|
bool connected = false;
|
||||||
|
bool reconnectFlag = false;
|
||||||
|
unsigned long prevArpGratuitous = 0;
|
||||||
|
unsigned long prevReconnectingTime = 0;
|
||||||
|
unsigned long connectedTime = 0;
|
||||||
|
unsigned long disconnectedTime = 0;
|
||||||
|
|
||||||
|
|
||||||
|
bool setWifiHostname(const char* hostname) {
|
||||||
|
if (!this->isHostnameValid(hostname)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(WiFi.getHostname(), hostname) == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return WiFi.setHostname(hostname);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
/**
|
/**
|
||||||
* @brief The interface holding the station address: the wired one while it carries the
|
* @brief
|
||||||
* uplink, the station otherwise
|
* https://github.com/arendst/Tasmota/blob/e6515883f0ee5451931b6280ff847b117de5a231/tasmota/tasmota_support/support_wifi.ino#L1196
|
||||||
*/
|
*/
|
||||||
NetworkUplink* station() {
|
static void stationKeepAliveNow(void) {
|
||||||
if (this->getUplink() == Uplink::Ethernet) {
|
for (netif* interface = netif_list; interface != nullptr; interface = interface->next) {
|
||||||
return &this->ethernet;
|
if (
|
||||||
|
(interface->flags & NETIF_FLAG_LINK_UP)
|
||||||
|
&& (interface->flags & NETIF_FLAG_UP)
|
||||||
|
&& interface->num == STATION_IF
|
||||||
|
&& (!ip4_addr_isany_val(*netif_ip4_addr(interface)))
|
||||||
|
) {
|
||||||
|
etharp_gratuitous(interface);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return &this->wifi;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Notice an uplink change so the hierarchy is walked from the top again
|
* @brief check RFC compliance
|
||||||
*/
|
|
||||||
void trackUplink() {
|
|
||||||
const Uplink current = this->getUplink();
|
|
||||||
|
|
||||||
if (current == this->uplink) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_NETWORK), F("Uplink: %s -> %s"), uplinkName(this->uplink), uplinkName(current));
|
|
||||||
|
|
||||||
this->uplink = current;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Keep the WiFi radio in step with the uplink
|
|
||||||
*
|
*
|
||||||
* WiFi is only in service while it carries the traffic. The AP is for first configuration:
|
* @param value
|
||||||
* once a cable carries the uplink the radio goes off, and if that uplink never comes up the
|
* @return true
|
||||||
* ladder falls back to the AP again on its own.
|
* @return false
|
||||||
*/
|
*/
|
||||||
void updateWifiRadio() {
|
static bool isHostnameValid(const char* value) {
|
||||||
if (this->ethernet.isActive()) {
|
size_t len = strlen(value);
|
||||||
this->wifi.suspend();
|
if (len > 24) {
|
||||||
|
return false;
|
||||||
return;
|
} else if (value[len - 1] == '-') {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->wifi.resume();
|
for (size_t i = 0; i < len; i++) {
|
||||||
|
if (!isalnum(value[i]) && value[i] != '-') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1,143 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#if defined(ARDUINO_ARCH_ESP8266)
|
|
||||||
#include <ESP8266WiFi.h>
|
|
||||||
#include "lwip/etharp.h"
|
|
||||||
#elif defined(ARDUINO_ARCH_ESP32)
|
|
||||||
#include <WiFi.h>
|
|
||||||
#include <esp_wifi.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// W5500 support needs both the ESP32 core (for ETH.h) and the per-env USE_ETHERNET flag.
|
|
||||||
// USE_ETHERNET defaults to false in defines.h, so this must be a value test, not #ifdef.
|
|
||||||
#if USE_ETHERNET && defined(ARDUINO_ARCH_ESP32)
|
|
||||||
#define NETWORK_HAS_ETHERNET
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace NetworkUtils {
|
|
||||||
typedef std::function<void()> YieldCallback;
|
|
||||||
typedef std::function<void(unsigned int)> DelayCallback;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Settings and callbacks every uplink reads
|
|
||||||
*/
|
|
||||||
struct UplinkContext {
|
|
||||||
const char* hostname = "esp";
|
|
||||||
|
|
||||||
const char* staSsid = nullptr;
|
|
||||||
const char* staPassword = nullptr;
|
|
||||||
uint8_t staChannel = 0;
|
|
||||||
|
|
||||||
const char* apName = "ESP";
|
|
||||||
const char* apPassword = nullptr;
|
|
||||||
uint8_t apChannel = 1;
|
|
||||||
|
|
||||||
bool useDhcp = true;
|
|
||||||
IPAddress staticIp;
|
|
||||||
IPAddress staticGateway;
|
|
||||||
IPAddress staticSubnet;
|
|
||||||
IPAddress staticDns;
|
|
||||||
|
|
||||||
YieldCallback yieldCallback = []() {
|
|
||||||
::yield();
|
|
||||||
};
|
|
||||||
DelayCallback delayCallback = [](unsigned int time) {
|
|
||||||
::delay(time);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief check RFC compliance
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
* @return true
|
|
||||||
* @return false
|
|
||||||
*/
|
|
||||||
static bool isHostnameValid(const char* value) {
|
|
||||||
size_t len = strlen(value);
|
|
||||||
if (len > 24) {
|
|
||||||
return false;
|
|
||||||
} else if (value[len - 1] == '-') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < len; i++) {
|
|
||||||
if (!isalnum(value[i]) && value[i] != '-') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief How long an uplink may still take the pass
|
|
||||||
*
|
|
||||||
* Armed when the uplink starts trying, disarmed when it resolves either way. A window that has
|
|
||||||
* run out means the uplink gave up, which lets the class below it take over.
|
|
||||||
*/
|
|
||||||
class UplinkAttempt {
|
|
||||||
public:
|
|
||||||
void arm(unsigned long window) {
|
|
||||||
this->start = millis() ? millis() : 1;
|
|
||||||
this->window = window;
|
|
||||||
}
|
|
||||||
|
|
||||||
void disarm() {
|
|
||||||
this->start = 0;
|
|
||||||
this->window = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isArmed() const {
|
|
||||||
return this->window > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isPending() const {
|
|
||||||
return this->window > 0 && (millis() - this->start) < this->window;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
unsigned long start = 0;
|
|
||||||
unsigned long window = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief One interface that is able to carry the uplink
|
|
||||||
*/
|
|
||||||
class NetworkUplink {
|
|
||||||
public:
|
|
||||||
explicit NetworkUplink(UplinkContext* context) : context(context) {}
|
|
||||||
|
|
||||||
virtual ~NetworkUplink() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Run one pass of this interface's state machine
|
|
||||||
*/
|
|
||||||
virtual void loop() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The interface is able to carry traffic right now
|
|
||||||
*/
|
|
||||||
virtual bool isActive() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The interface may still become active, so nothing below it should start
|
|
||||||
*/
|
|
||||||
virtual bool isPending() {
|
|
||||||
return !this->isActive() && this->attempt.isPending();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual IPAddress localIP() = 0;
|
|
||||||
virtual IPAddress subnetMask() = 0;
|
|
||||||
virtual IPAddress gatewayIP() = 0;
|
|
||||||
virtual IPAddress dnsIP() = 0;
|
|
||||||
virtual String macAddress() = 0;
|
|
||||||
|
|
||||||
virtual short int rssi() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
UplinkContext* context;
|
|
||||||
UplinkAttempt attempt;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,431 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <NetworkConnection.h>
|
|
||||||
#include <NetworkUplink.h>
|
|
||||||
|
|
||||||
namespace NetworkUtils {
|
|
||||||
/**
|
|
||||||
* @brief WiFi uplink: the station association, its radio, and the fallback AP
|
|
||||||
*/
|
|
||||||
class WifiUplink : public NetworkUplink {
|
|
||||||
public:
|
|
||||||
explicit WifiUplink(UplinkContext* context) : NetworkUplink(context) {}
|
|
||||||
|
|
||||||
void loop() override {
|
|
||||||
if (this->reconnectFlag) {
|
|
||||||
this->context->delayCallback(5000);
|
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_NETWORK), F("Reconnecting..."));
|
|
||||||
this->reconnectFlag = false;
|
|
||||||
this->disconnect();
|
|
||||||
NetworkConnection::reset();
|
|
||||||
this->context->delayCallback(1000);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->isAssociated() && !this->hasCredentials()) {
|
|
||||||
Log.sinfoln(FPSTR(L_NETWORK), F("Reset"));
|
|
||||||
this->resetWifi();
|
|
||||||
NetworkConnection::reset();
|
|
||||||
this->context->delayCallback(1000);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->isAssociated()) {
|
|
||||||
this->attempt.disarm();
|
|
||||||
|
|
||||||
if (!this->connected) {
|
|
||||||
this->connectedTime = millis();
|
|
||||||
this->connected = true;
|
|
||||||
|
|
||||||
Log.sinfoln(
|
|
||||||
FPSTR(L_NETWORK),
|
|
||||||
F("Connected, downtime: %lu s., IP: %s, RSSI: %hhd"),
|
|
||||||
(millis() - this->disconnectedTime) / 1000,
|
|
||||||
WiFi.localIP().toString().c_str(),
|
|
||||||
WiFi.RSSI()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP8266
|
|
||||||
if (millis() - this->prevArpGratuitous > 60000) {
|
|
||||||
this->stationKeepAliveNow();
|
|
||||||
this->prevArpGratuitous = millis();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// the association is down: track the downtime and keep asking for the network
|
|
||||||
if (this->connected) {
|
|
||||||
this->disconnectedTime = millis();
|
|
||||||
this->connected = false;
|
|
||||||
this->attempt.arm(this->failedConnectTimeout);
|
|
||||||
|
|
||||||
Log.sinfoln(
|
|
||||||
FPSTR(L_NETWORK),
|
|
||||||
F("Disconnected, reason: %d, uptime: %lu s."),
|
|
||||||
NetworkConnection::getDisconnectReason(),
|
|
||||||
(millis() - this->connectedTime) / 1000
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this->hasCredentials()) {
|
|
||||||
this->attempt.disarm();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this->attempt.isArmed()) {
|
|
||||||
this->attempt.arm(this->failedConnectTimeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->isConnecting() && millis() - this->prevReconnectingTime > this->resetConnectionTimeout) {
|
|
||||||
Log.swarningln(FPSTR(L_NETWORK), F("Connection timeout, reset wifi..."));
|
|
||||||
this->resetWifi();
|
|
||||||
NetworkConnection::reset();
|
|
||||||
this->context->delayCallback(250);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this->isConnecting() && (!this->prevReconnectingTime || millis() - this->prevReconnectingTime > this->reconnectInterval)) {
|
|
||||||
Log.sinfoln(FPSTR(L_NETWORK), F("Try connect..."));
|
|
||||||
|
|
||||||
NetworkConnection::reset();
|
|
||||||
if (!this->connect(true, this->connectionTimeout)) {
|
|
||||||
Log.straceln(FPSTR(L_NETWORK), F("Connection failed. Status: %d, reason: %d, raw reason: %d"), NetworkConnection::getStatus(), NetworkConnection::getDisconnectReason(), NetworkConnection::rawDisconnectReason);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->prevReconnectingTime = millis();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief WiFi carries the uplink: radio running and associated
|
|
||||||
*/
|
|
||||||
bool isActive() override {
|
|
||||||
return !this->suspended && this->isAssociated();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isAssociated() {
|
|
||||||
return this->isStaEnabled() && NetworkConnection::getStatus() == NetworkConnection::Status::CONNECTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isConnecting() {
|
|
||||||
return this->isStaEnabled() && NetworkConnection::getStatus() == NetworkConnection::Status::CONNECTING;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isStaEnabled() {
|
|
||||||
return (WiFi.getMode() & WIFI_STA) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isApEnabled() {
|
|
||||||
return (WiFi.getMode() & WIFI_AP) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief When the association first came up, for the fallback AP's retirement delay
|
|
||||||
*/
|
|
||||||
unsigned long getConnectedTime() {
|
|
||||||
return this->connectedTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Stop the radio while another uplink carries the traffic
|
|
||||||
*
|
|
||||||
* esp_wifi_stop() parks the radio without tearing the driver and its netifs down.
|
|
||||||
* WiFi.mode(WIFI_OFF) does the same job but also deinitialises, which panicked when it
|
|
||||||
* was called from this task with lwIP live — keep the driver allocated.
|
|
||||||
*/
|
|
||||||
void suspend() {
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
|
||||||
if (this->suspended) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (WiFi.getMode() == WIFI_MODE_NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// a scan holds the radio: parking it mid-scan leaves the driver half torn down
|
|
||||||
if (WiFi.scanComplete() == WIFI_SCAN_RUNNING) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_NETWORK), F("Ethernet: uplink active, switching the WiFi radio off"));
|
|
||||||
|
|
||||||
esp_wifi_stop();
|
|
||||||
this->suspended = true;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Bring the radio back when no other uplink carries the traffic
|
|
||||||
*/
|
|
||||||
void resume() {
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
|
||||||
if (!this->suspended) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->suspended = false;
|
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_NETWORK), F("Ethernet: uplink lost, switching the WiFi radio back on"));
|
|
||||||
|
|
||||||
esp_wifi_start();
|
|
||||||
|
|
||||||
this->connected = false;
|
|
||||||
this->disconnectedTime = millis();
|
|
||||||
this->prevReconnectingTime = 0;
|
|
||||||
this->attempt.arm(this->failedConnectTimeout);
|
|
||||||
|
|
||||||
NetworkConnection::reset();
|
|
||||||
|
|
||||||
if (this->hasCredentials()) {
|
|
||||||
WiFi.begin(this->context->staSsid, this->context->staPassword);
|
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_NETWORK), F("Ethernet: reconnecting to WiFi \"%s\""), this->context->staSsid);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isSuspended() {
|
|
||||||
return this->suspended;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool resetWifi() {
|
|
||||||
// set policy manual for work 13 ch
|
|
||||||
{
|
|
||||||
#ifdef ARDUINO_ARCH_ESP8266
|
|
||||||
wifi_country_t country = {"JP", 1, 14, WIFI_COUNTRY_POLICY_MANUAL};
|
|
||||||
wifi_set_country(&country);
|
|
||||||
#elif defined(ARDUINO_ARCH_ESP32)
|
|
||||||
const wifi_country_t country = {"JP", 1, 14, CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER, WIFI_COUNTRY_POLICY_MANUAL};
|
|
||||||
esp_wifi_set_country(&country);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
WiFi.persistent(false);
|
|
||||||
#if !defined(ESP_ARDUINO_VERSION_MAJOR) || ESP_ARDUINO_VERSION_MAJOR < 3
|
|
||||||
WiFi.setAutoConnect(false);
|
|
||||||
#endif
|
|
||||||
WiFi.setAutoReconnect(false);
|
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP8266
|
|
||||||
WiFi.setSleepMode(WIFI_NONE_SLEEP);
|
|
||||||
#elif defined(ARDUINO_ARCH_ESP32)
|
|
||||||
WiFi.setSleep(USE_BLE ? WIFI_PS_MIN_MODEM : WIFI_PS_NONE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WiFi.softAPdisconnect();
|
|
||||||
#ifdef ARDUINO_ARCH_ESP8266
|
|
||||||
/*if (wifi_softap_dhcps_status() == DHCP_STARTED) {
|
|
||||||
wifi_softap_dhcps_stop();
|
|
||||||
}*/
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WiFi.disconnect(false, true);
|
|
||||||
#ifdef ARDUINO_ARCH_ESP8266
|
|
||||||
/*if (wifi_station_dhcpc_status() == DHCP_STARTED) {
|
|
||||||
wifi_station_dhcpc_stop();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
wifi_station_dhcpc_set_maxtry(5);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP32) && ESP_ARDUINO_VERSION_MAJOR < 3
|
|
||||||
// Nothing. Because memory leaks when turn off WiFi on ESP32 SDK < 3.0.0
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
return WiFi.mode(WIFI_OFF);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Ask for a fresh connect
|
|
||||||
*
|
|
||||||
* The attempt window is armed here so the ladder keeps the fallback AP out of the way while
|
|
||||||
* the station works on this reconnect; it expires like any other failed attempt.
|
|
||||||
*/
|
|
||||||
void reconnect() {
|
|
||||||
this->attempt.arm(this->failedConnectTimeout);
|
|
||||||
|
|
||||||
this->reconnectFlag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool connect(bool force = false, unsigned int timeout = 1000u) {
|
|
||||||
if (this->isAssociated() && !force) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (force && !this->isApEnabled()) {
|
|
||||||
this->resetWifi();
|
|
||||||
NetworkConnection::reset();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
/*#ifdef ARDUINO_ARCH_ESP8266
|
|
||||||
if (wifi_station_dhcpc_status() == DHCP_STARTED) {
|
|
||||||
wifi_station_dhcpc_stop();
|
|
||||||
}
|
|
||||||
#endif*/
|
|
||||||
|
|
||||||
this->disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this->hasCredentials()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->context->delayCallback(250);
|
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
|
||||||
if (this->setHostname(this->context->hostname)) {
|
|
||||||
Log.straceln(FPSTR(L_NETWORK), F("Set hostname '%s': success"), this->context->hostname);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.serrorln(FPSTR(L_NETWORK), F("Set hostname '%s': fail"), this->context->hostname);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!WiFi.mode((WiFiMode_t)(WiFi.getMode() | WIFI_STA))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->context->delayCallback(250);
|
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP8266
|
|
||||||
if (this->setHostname(this->context->hostname)) {
|
|
||||||
Log.straceln(FPSTR(L_NETWORK), F("Set hostname '%s': success"), this->context->hostname);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.serrorln(FPSTR(L_NETWORK), F("Set hostname '%s': fail"), this->context->hostname);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->context->delayCallback(250);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
|
||||||
WiFi.setScanMethod(WIFI_ALL_CHANNEL_SCAN);
|
|
||||||
WiFi.setSortMethod(WIFI_CONNECT_AP_BY_SIGNAL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!this->context->useDhcp) {
|
|
||||||
WiFi.begin(this->context->staSsid, this->context->staPassword, this->context->staChannel, nullptr, false);
|
|
||||||
WiFi.config(this->context->staticIp, this->context->staticGateway, this->context->staticSubnet, this->context->staticDns);
|
|
||||||
WiFi.reconnect();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
|
||||||
// the interface keeps a static address from an earlier association, so the addressing has
|
|
||||||
// to be reset before the station reconnects or the switch back to DHCP never takes effect
|
|
||||||
const IPAddress noIp(0, 0, 0, 0);
|
|
||||||
WiFi.config(noIp, noIp, noIp);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WiFi.begin(this->context->staSsid, this->context->staPassword, this->context->staChannel, nullptr, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned long beginConnectionTime = millis();
|
|
||||||
while (millis() - beginConnectionTime < timeout) {
|
|
||||||
this->context->delayCallback(100);
|
|
||||||
|
|
||||||
NetworkConnection::Status status = NetworkConnection::getStatus();
|
|
||||||
if (status != NetworkConnection::Status::CONNECTING && status != NetworkConnection::Status::NONE) {
|
|
||||||
return status == NetworkConnection::Status::CONNECTED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void disconnect() {
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
|
||||||
WiFi.disconnectAsync(false, true);
|
|
||||||
|
|
||||||
const unsigned long start = millis();
|
|
||||||
while (WiFi.isConnected() && (millis() - start) < 5000) {
|
|
||||||
this->context->delayCallback(100);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
WiFi.disconnect(false, true);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setHostname(const char* hostname) {
|
|
||||||
if (!UplinkContext::isHostnameValid(hostname)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strcmp(WiFi.getHostname(), hostname) == 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return WiFi.setHostname(hostname);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasCredentials() {
|
|
||||||
return this->context->staSsid != nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPAddress localIP() override {
|
|
||||||
return WiFi.localIP();
|
|
||||||
}
|
|
||||||
|
|
||||||
IPAddress subnetMask() override {
|
|
||||||
return WiFi.subnetMask();
|
|
||||||
}
|
|
||||||
|
|
||||||
IPAddress gatewayIP() override {
|
|
||||||
return WiFi.gatewayIP();
|
|
||||||
}
|
|
||||||
|
|
||||||
IPAddress dnsIP() override {
|
|
||||||
return WiFi.dnsIP();
|
|
||||||
}
|
|
||||||
|
|
||||||
String macAddress() override {
|
|
||||||
return WiFi.macAddress();
|
|
||||||
}
|
|
||||||
|
|
||||||
short int rssi() override {
|
|
||||||
return WiFi.RSSI();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const unsigned int reconnectInterval = 15000;
|
|
||||||
const unsigned int failedConnectTimeout = 185000;
|
|
||||||
const unsigned int connectionTimeout = 10000;
|
|
||||||
const unsigned int resetConnectionTimeout = 90000;
|
|
||||||
|
|
||||||
bool connected = false;
|
|
||||||
bool reconnectFlag = false;
|
|
||||||
bool suspended = false;
|
|
||||||
unsigned long prevArpGratuitous = 0;
|
|
||||||
unsigned long prevReconnectingTime = 0;
|
|
||||||
unsigned long connectedTime = 0;
|
|
||||||
unsigned long disconnectedTime = 0;
|
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP8266
|
|
||||||
/**
|
|
||||||
* @brief
|
|
||||||
* https://github.com/arendst/Tasmota/blob/e6515883f0ee5451931b6280ff847b117de5a231/tasmota/tasmota_support/support_wifi.ino#L1196
|
|
||||||
*/
|
|
||||||
static void stationKeepAliveNow(void) {
|
|
||||||
for (netif* interface = netif_list; interface != nullptr; interface = interface->next) {
|
|
||||||
if (
|
|
||||||
(interface->flags & NETIF_FLAG_LINK_UP)
|
|
||||||
&& (interface->flags & NETIF_FLAG_UP)
|
|
||||||
&& interface->num == STATION_IF
|
|
||||||
&& (!ip4_addr_isany_val(*netif_ip4_addr(interface)))
|
|
||||||
) {
|
|
||||||
etharp_gratuitous(interface);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
}
|
|
||||||
+3
-3
@@ -4,12 +4,12 @@
|
|||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"cssnano": "^9.3.2",
|
"cssnano": "^7.0.2",
|
||||||
"cssnano-preset-advanced": "^10.0.0",
|
"cssnano-preset-advanced": "^7.0.2",
|
||||||
"gulp": "^5.0.0",
|
"gulp": "^5.0.0",
|
||||||
"gulp-concat": "^2.6.1",
|
"gulp-concat": "^2.6.1",
|
||||||
"gulp-gzip": "^1.4.2",
|
"gulp-gzip": "^1.4.2",
|
||||||
"gulp-html-minifier-terser": "^8.0.0",
|
"gulp-html-minifier-terser": "^7.1.0",
|
||||||
"gulp-jsonminify": "^1.1.0",
|
"gulp-jsonminify": "^1.1.0",
|
||||||
"gulp-postcss": "^10.0.0",
|
"gulp-postcss": "^10.0.0",
|
||||||
"gulp-terser": "^2.1.0",
|
"gulp-terser": "^2.1.0",
|
||||||
|
|||||||
+12
-21
@@ -14,21 +14,19 @@ extra_configs = secrets.default.ini
|
|||||||
core_dir = .pio
|
core_dir = .pio
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
version = 1.6.0
|
version = 1.5.5
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
bblanchon/ArduinoJson@^7.4.2
|
bblanchon/ArduinoJson@^7.3.0
|
||||||
;ihormelnyk/OpenTherm Library@^1.1.5
|
;ihormelnyk/OpenTherm Library@^1.1.5
|
||||||
https://github.com/Laxilef/opentherm_library#esp32_timer
|
https://github.com/Laxilef/opentherm_library#esp32_timer
|
||||||
arduino-libraries/ArduinoMqttClient@^0.1.8
|
arduino-libraries/ArduinoMqttClient@^0.1.8
|
||||||
lennarthennigs/ESP Telnet@^2.2.3
|
lennarthennigs/ESP Telnet@^2.2
|
||||||
gyverlibs/FileData@^1.0.3
|
gyverlibs/FileData@^1.0.2
|
||||||
gyverlibs/GyverPID@^3.3.2
|
gyverlibs/GyverPID@^3.3.2
|
||||||
gyverlibs/GyverBlinker@^1.1.1
|
gyverlibs/GyverBlinker@^1.1.1
|
||||||
pstolarz/OneWireNg@^0.14.1
|
https://github.com/pstolarz/Arduino-Temperature-Control-Library.git#OneWireNg
|
||||||
milesburton/DallasTemperature@^4.0.6
|
|
||||||
laxilef/TinyLogger@^1.1.1
|
laxilef/TinyLogger@^1.1.1
|
||||||
lib_ignore = OneWire
|
|
||||||
build_type = ${secrets.build_type}
|
build_type = ${secrets.build_type}
|
||||||
build_flags =
|
build_flags =
|
||||||
-mtext-section-literals
|
-mtext-section-literals
|
||||||
@@ -75,7 +73,7 @@ platform_packages = ${env.platform_packages}
|
|||||||
lib_deps =
|
lib_deps =
|
||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
nrwiersma/ESP8266Scheduler@^1.2
|
nrwiersma/ESP8266Scheduler@^1.2
|
||||||
lib_ignore = ${env.lib_ignore}
|
lib_ignore =
|
||||||
extra_scripts =
|
extra_scripts =
|
||||||
post:tools/build.py
|
post:tools/build.py
|
||||||
build_type = ${env.build_type}
|
build_type = ${env.build_type}
|
||||||
@@ -94,14 +92,14 @@ check_flags = ${env.check_flags}
|
|||||||
;platform_packages =
|
;platform_packages =
|
||||||
; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.5
|
; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.5
|
||||||
; framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip
|
; framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip
|
||||||
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.36/platform-espressif32.zip
|
platform = https://github.com/pioarduino/platform-espressif32/releases/download/54.03.21/platform-espressif32.zip
|
||||||
platform_packages = ${env.platform_packages}
|
platform_packages = ${env.platform_packages}
|
||||||
board_build.partitions = esp32_partitions.csv
|
board_build.partitions = esp32_partitions.csv
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
laxilef/ESP32Scheduler@^1.0.1
|
laxilef/ESP32Scheduler@^1.0.1
|
||||||
nimble_lib = h2zero/NimBLE-Arduino@2.3.7
|
nimble_lib = h2zero/NimBLE-Arduino@^2.1.0
|
||||||
lib_ignore = ${env.lib_ignore}
|
lib_ignore =
|
||||||
extra_scripts =
|
extra_scripts =
|
||||||
post:tools/esp32.py
|
post:tools/esp32.py
|
||||||
post:tools/build.py
|
post:tools/build.py
|
||||||
@@ -236,7 +234,7 @@ build_flags =
|
|||||||
${esp32_defaults.build_flags}
|
${esp32_defaults.build_flags}
|
||||||
-D ARDUINO_USB_MODE=0
|
-D ARDUINO_USB_MODE=0
|
||||||
-D ARDUINO_USB_CDC_ON_BOOT=1
|
-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||||
-D MYNEWT_VAL_BLE_EXT_ADV=1
|
-D CONFIG_BT_NIMBLE_EXT_ADV=1
|
||||||
-D USE_BLE=1
|
-D USE_BLE=1
|
||||||
-D DEFAULT_OT_IN_GPIO=35
|
-D DEFAULT_OT_IN_GPIO=35
|
||||||
-D DEFAULT_OT_OUT_GPIO=36
|
-D DEFAULT_OT_OUT_GPIO=36
|
||||||
@@ -262,7 +260,7 @@ build_unflags =
|
|||||||
build_type = ${esp32_defaults.build_type}
|
build_type = ${esp32_defaults.build_type}
|
||||||
build_flags =
|
build_flags =
|
||||||
${esp32_defaults.build_flags}
|
${esp32_defaults.build_flags}
|
||||||
-D MYNEWT_VAL_BLE_EXT_ADV=1
|
-D CONFIG_BT_NIMBLE_EXT_ADV=1
|
||||||
-D USE_BLE=1
|
-D USE_BLE=1
|
||||||
-D DEFAULT_OT_IN_GPIO=8
|
-D DEFAULT_OT_IN_GPIO=8
|
||||||
-D DEFAULT_OT_OUT_GPIO=10
|
-D DEFAULT_OT_OUT_GPIO=10
|
||||||
@@ -296,10 +294,6 @@ build_flags =
|
|||||||
check_tool = ${esp32_defaults.check_tool}
|
check_tool = ${esp32_defaults.check_tool}
|
||||||
check_flags = ${esp32_defaults.check_flags}
|
check_flags = ${esp32_defaults.check_flags}
|
||||||
|
|
||||||
[env:nodemcu_32_160mhz]
|
|
||||||
extends = env:nodemcu_32
|
|
||||||
board_build.f_cpu = 160000000L ; set frequency to 160MHz
|
|
||||||
|
|
||||||
[env:d1_mini32]
|
[env:d1_mini32]
|
||||||
platform = ${esp32_defaults.platform}
|
platform = ${esp32_defaults.platform}
|
||||||
platform_packages = ${esp32_defaults.platform_packages}
|
platform_packages = ${esp32_defaults.platform_packages}
|
||||||
@@ -324,8 +318,6 @@ check_tool = ${esp32_defaults.check_tool}
|
|||||||
check_flags = ${esp32_defaults.check_flags}
|
check_flags = ${esp32_defaults.check_flags}
|
||||||
|
|
||||||
[env:esp32_c6]
|
[env:esp32_c6]
|
||||||
; W5500 ethernet (USE_ETHERNET) is hardware-validated on this target only; every other env
|
|
||||||
; inherits the `false` default from src/defines.h and compiles the driver out.
|
|
||||||
platform = ${esp32_defaults.platform}
|
platform = ${esp32_defaults.platform}
|
||||||
framework = arduino, espidf
|
framework = arduino, espidf
|
||||||
platform_packages = ${esp32_defaults.platform_packages}
|
platform_packages = ${esp32_defaults.platform_packages}
|
||||||
@@ -346,7 +338,6 @@ build_type = ${esp32_defaults.build_type}
|
|||||||
build_flags =
|
build_flags =
|
||||||
${esp32_defaults.build_flags}
|
${esp32_defaults.build_flags}
|
||||||
-D USE_BLE=1
|
-D USE_BLE=1
|
||||||
-D USE_ETHERNET=1
|
|
||||||
-D DEFAULT_OT_IN_GPIO=15
|
-D DEFAULT_OT_IN_GPIO=15
|
||||||
-D DEFAULT_OT_OUT_GPIO=23
|
-D DEFAULT_OT_OUT_GPIO=23
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=0
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=0
|
||||||
@@ -371,7 +362,7 @@ build_unflags =
|
|||||||
build_type = ${esp32_defaults.build_type}
|
build_type = ${esp32_defaults.build_type}
|
||||||
build_flags =
|
build_flags =
|
||||||
${esp32_defaults.build_flags}
|
${esp32_defaults.build_flags}
|
||||||
-D MYNEWT_VAL_BLE_EXT_ADV=1
|
-D CONFIG_BT_NIMBLE_EXT_ADV=1
|
||||||
-D USE_BLE=1
|
-D USE_BLE=1
|
||||||
-D DEFAULT_OT_IN_GPIO=3
|
-D DEFAULT_OT_IN_GPIO=3
|
||||||
-D DEFAULT_OT_OUT_GPIO=1
|
-D DEFAULT_OT_OUT_GPIO=1
|
||||||
|
|||||||
@@ -9,11 +9,6 @@ CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
|||||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
||||||
CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y
|
CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y
|
||||||
|
|
||||||
#
|
|
||||||
# Ethernet (W5500 over SPI)
|
|
||||||
CONFIG_ETH_USE_SPI_ETHERNET=y
|
|
||||||
CONFIG_ETH_SPI_ETHERNET_W5500=y
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# BT config
|
# BT config
|
||||||
CONFIG_BT_ENABLED=y
|
CONFIG_BT_ENABLED=y
|
||||||
|
|||||||
+91
-123
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
class HaHelper : public HomeAssistantHelper {
|
class HaHelper : public HomeAssistantHelper {
|
||||||
public:
|
public:
|
||||||
static const uint8_t TEMP_SOURCE_HEATING = 0;
|
static const byte TEMP_SOURCE_HEATING = 0;
|
||||||
static const uint8_t TEMP_SOURCE_INDOOR = 1;
|
static const byte TEMP_SOURCE_INDOOR = 1;
|
||||||
static const char AVAILABILITY_OT_CONN[];
|
static const char AVAILABILITY_OT_CONN[];
|
||||||
static const char AVAILABILITY_SENSOR_CONN[];
|
static const char AVAILABILITY_SENSOR_CONN[];
|
||||||
|
|
||||||
@@ -25,12 +25,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool publishDynamicSensor(Sensors::Settings& sSensor, Sensors::ValueType vType = Sensors::ValueType::PRIMARY, UnitSystem unit = UnitSystem::METRIC, bool enabledByDefault = true) {
|
bool publishDynamicSensor(Sensors::Settings& sSensor, Sensors::ValueType vType = Sensors::ValueType::PRIMARY, UnitSystem unit = UnitSystem::METRIC, bool enabledByDefault = true) {
|
||||||
#if !USE_BLE
|
|
||||||
if (sSensor.type == Sensors::Type::BLUETOOTH) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
|
|
||||||
// set device class & unit of measurement
|
// set device class & unit of measurement
|
||||||
@@ -267,13 +261,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// object id's
|
// object id's
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(objId.c_str());
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(objId.c_str());
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
sSensor.type == Sensors::Type::MANUAL
|
|
||||||
? FPSTR(HA_ENTITY_NUMBER)
|
|
||||||
: FPSTR(HA_ENTITY_SENSOR),
|
|
||||||
objId.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
const String& configTopic = this->makeConfigTopic(
|
const String& configTopic = this->makeConfigTopic(
|
||||||
sSensor.type == Sensors::Type::MANUAL ? FPSTR(HA_ENTITY_NUMBER) : FPSTR(HA_ENTITY_SENSOR),
|
sSensor.type == Sensors::Type::MANUAL ? FPSTR(HA_ENTITY_NUMBER) : FPSTR(HA_ENTITY_SENSOR),
|
||||||
@@ -334,8 +323,8 @@ public:
|
|||||||
String objId = Sensors::makeObjectIdWithSuffix(sSensor.name, F("connected"));
|
String objId = Sensors::makeObjectIdWithSuffix(sSensor.name, F("connected"));
|
||||||
|
|
||||||
// object id's
|
// object id's
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(objId.c_str());
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(objId.c_str());
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), objId.c_str());
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
|
|
||||||
// state topic
|
// state topic
|
||||||
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(
|
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(
|
||||||
@@ -381,8 +370,8 @@ public:
|
|||||||
String objId = Sensors::makeObjectIdWithSuffix(sSensor.name, F("signal_quality"));
|
String objId = Sensors::makeObjectIdWithSuffix(sSensor.name, F("signal_quality"));
|
||||||
|
|
||||||
// object id's
|
// object id's
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(objId.c_str());
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(objId.c_str());
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), objId.c_str());
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
|
|
||||||
// state topic
|
// state topic
|
||||||
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(
|
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(
|
||||||
@@ -418,6 +407,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool deleteSignalQualityDynamicSensor(Sensors::Settings& sSensor) {
|
bool deleteSignalQualityDynamicSensor(Sensors::Settings& sSensor) {
|
||||||
|
JsonDocument doc;
|
||||||
const String& configTopic = this->makeConfigTopic(
|
const String& configTopic = this->makeConfigTopic(
|
||||||
FPSTR(HA_ENTITY_SENSOR),
|
FPSTR(HA_ENTITY_SENSOR),
|
||||||
Sensors::makeObjectIdWithSuffix(sSensor.name, F("signal_quality")).c_str()
|
Sensors::makeObjectIdWithSuffix(sSensor.name, F("signal_quality")).c_str()
|
||||||
@@ -431,8 +421,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating_turbo"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("heating_turbo"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SWITCH), F("heating_turbo"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("Turbo heating");
|
doc[FPSTR(HA_NAME)] = F("Turbo heating");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:rocket-launch-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:rocket-launch-outline");
|
||||||
@@ -449,34 +439,12 @@ public:
|
|||||||
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_SWITCH), F("heating_turbo")).c_str(), doc);
|
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_SWITCH), F("heating_turbo")).c_str(), doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool publishSwitchHeatingHysteresis(bool enabledByDefault = true) {
|
|
||||||
JsonDocument doc;
|
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating_hysteresis"));
|
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SWITCH), F("heating_hysteresis"));
|
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
|
||||||
doc[FPSTR(HA_NAME)] = F("Use heating hysteresis");
|
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:altimeter");
|
|
||||||
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
|
||||||
doc[FPSTR(HA_STATE_ON)] = true;
|
|
||||||
doc[FPSTR(HA_STATE_OFF)] = false;
|
|
||||||
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.heating.hysteresis.enabled }}");
|
|
||||||
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
|
||||||
doc[FPSTR(HA_PAYLOAD_ON)] = F("{\"heating\": {\"hysteresis\" : {\"enabled\" : true}}}");
|
|
||||||
doc[FPSTR(HA_PAYLOAD_OFF)] = F("{\"heating\": {\"hysteresis\" : {\"enabled\" : false}}}");
|
|
||||||
doc[FPSTR(HA_EXPIRE_AFTER)] = this->expireAfter;
|
|
||||||
doc.shrinkToFit();
|
|
||||||
|
|
||||||
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_SWITCH), F("heating_hysteresis")).c_str(), doc);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool publishInputHeatingHysteresis(UnitSystem unit = UnitSystem::METRIC, bool enabledByDefault = true) {
|
bool publishInputHeatingHysteresis(UnitSystem unit = UnitSystem::METRIC, bool enabledByDefault = true) {
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating_hysteresis"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("heating_hysteresis"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("heating_hysteresis"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -490,9 +458,9 @@ public:
|
|||||||
doc[FPSTR(HA_NAME)] = F("Heating hysteresis");
|
doc[FPSTR(HA_NAME)] = F("Heating hysteresis");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:altimeter");
|
doc[FPSTR(HA_ICON)] = F("mdi:altimeter");
|
||||||
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
|
||||||
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.heating.hysteresis.value|float(0)|round(2) }}");
|
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.heating.hysteresis|float(0)|round(2) }}");
|
||||||
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
|
||||||
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"heating\": {\"hysteresis\" : {\"value\" : {{ value }}}}}");
|
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"heating\": {\"hysteresis\" : {{ value }}}}");
|
||||||
doc[FPSTR(HA_MIN)] = 0;
|
doc[FPSTR(HA_MIN)] = 0;
|
||||||
doc[FPSTR(HA_MAX)] = 15;
|
doc[FPSTR(HA_MAX)] = 15;
|
||||||
doc[FPSTR(HA_STEP)] = 0.01f;
|
doc[FPSTR(HA_STEP)] = 0.01f;
|
||||||
@@ -507,8 +475,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating_turbo_factor"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("heating_turbo_factor"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("heating_turbo_factor"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("power_factor");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("power_factor");
|
||||||
doc[FPSTR(HA_NAME)] = F("Heating turbo factor");
|
doc[FPSTR(HA_NAME)] = F("Heating turbo factor");
|
||||||
@@ -531,8 +499,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating_min_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("heating_min_temp"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("heating_min_temp"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -565,8 +533,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating_max_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("heating_max_temp"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("heating_max_temp"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -600,8 +568,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("dhw_min_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("dhw_min_temp"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("dhw_min_temp"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -634,8 +602,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("dhw_max_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("dhw_max_temp"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("dhw_max_temp"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -669,8 +637,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("pid"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SWITCH), F("pid"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("PID");
|
doc[FPSTR(HA_NAME)] = F("PID");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:chart-bar-stacked");
|
doc[FPSTR(HA_ICON)] = F("mdi:chart-bar-stacked");
|
||||||
@@ -691,8 +659,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_p"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("pid_p"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_p"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("PID factor P");
|
doc[FPSTR(HA_NAME)] = F("PID factor P");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-p-circle-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-p-circle-outline");
|
||||||
@@ -714,8 +682,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_i"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("pid_i"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_i"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("PID factor I");
|
doc[FPSTR(HA_NAME)] = F("PID factor I");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-i-circle-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-i-circle-outline");
|
||||||
@@ -737,8 +705,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_d"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("pid_d"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_d"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("PID factor D");
|
doc[FPSTR(HA_NAME)] = F("PID factor D");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-d-circle-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-d-circle-outline");
|
||||||
@@ -760,8 +728,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_dt"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("pid_dt"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_dt"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("duration");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("duration");
|
||||||
doc[FPSTR(HA_UNIT_OF_MEASUREMENT)] = F("s");
|
doc[FPSTR(HA_UNIT_OF_MEASUREMENT)] = F("s");
|
||||||
@@ -785,8 +753,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_min_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("pid_min_temp"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_min_temp"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -819,8 +787,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_max_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("pid_max_temp"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_max_temp"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -854,8 +822,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("equitherm"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SWITCH), F("equitherm"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("Equitherm");
|
doc[FPSTR(HA_NAME)] = F("Equitherm");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:sun-snowflake-variant");
|
doc[FPSTR(HA_ICON)] = F("mdi:sun-snowflake-variant");
|
||||||
@@ -876,8 +844,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_slope"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("equitherm_slope"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_slope"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("Equitherm slope");
|
doc[FPSTR(HA_NAME)] = F("Equitherm slope");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:slope-uphill");
|
doc[FPSTR(HA_ICON)] = F("mdi:slope-uphill");
|
||||||
@@ -899,8 +867,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_exponent"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("equitherm_exponent"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_exponent"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("Equitherm exponent");
|
doc[FPSTR(HA_NAME)] = F("Equitherm exponent");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:exponent");
|
doc[FPSTR(HA_ICON)] = F("mdi:exponent");
|
||||||
@@ -922,8 +890,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_shift"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("equitherm_shift"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_shift"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
doc[FPSTR(HA_NAME)] = F("Equitherm shift");
|
doc[FPSTR(HA_NAME)] = F("Equitherm shift");
|
||||||
@@ -949,8 +917,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.pid.enabled, 'offline', 'online') }}");
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.pid.enabled, 'offline', 'online') }}");
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_target_diff_factor"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("equitherm_target_diff_factor"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_target_diff_factor"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("Equitherm target diff factor");
|
doc[FPSTR(HA_NAME)] = F("Equitherm target diff factor");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:chart-timeline-variant-shimmer");
|
doc[FPSTR(HA_ICON)] = F("mdi:chart-timeline-variant-shimmer");
|
||||||
@@ -972,8 +940,8 @@ public:
|
|||||||
bool publishStatusState(bool enabledByDefault = true) {
|
bool publishStatusState(bool enabledByDefault = true) {
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("status"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("status"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("status"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
||||||
doc[FPSTR(HA_NAME)] = F("Status");
|
doc[FPSTR(HA_NAME)] = F("Status");
|
||||||
@@ -990,8 +958,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("emergency"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("emergency"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("emergency"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
||||||
doc[FPSTR(HA_NAME)] = F("Emergency");
|
doc[FPSTR(HA_NAME)] = F("Emergency");
|
||||||
@@ -1008,8 +976,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("ot_status"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("ot_status"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("ot_status"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("connectivity");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("connectivity");
|
||||||
doc[FPSTR(HA_NAME)] = F("Opentherm status");
|
doc[FPSTR(HA_NAME)] = F("Opentherm status");
|
||||||
@@ -1029,8 +997,9 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("heating"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("heating"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
|
//doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
||||||
doc[FPSTR(HA_NAME)] = F("Heating");
|
doc[FPSTR(HA_NAME)] = F("Heating");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:radiator");
|
doc[FPSTR(HA_ICON)] = F("mdi:radiator");
|
||||||
@@ -1049,8 +1018,9 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("dhw"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("dhw"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("dhw"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
|
//doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
||||||
doc[FPSTR(HA_NAME)] = F("DHW");
|
doc[FPSTR(HA_NAME)] = F("DHW");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:faucet");
|
doc[FPSTR(HA_ICON)] = F("mdi:faucet");
|
||||||
@@ -1069,8 +1039,9 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("flame"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("flame"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("flame"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
|
//doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
||||||
doc[FPSTR(HA_NAME)] = F("Flame");
|
doc[FPSTR(HA_NAME)] = F("Flame");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:gas-burner");
|
doc[FPSTR(HA_ICON)] = F("mdi:gas-burner");
|
||||||
@@ -1089,8 +1060,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("fault"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("fault"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("fault"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
||||||
doc[FPSTR(HA_NAME)] = F("Fault");
|
doc[FPSTR(HA_NAME)] = F("Fault");
|
||||||
@@ -1110,8 +1081,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
||||||
doc[FPSTR(HA_NAME)] = F("Diagnostic");
|
doc[FPSTR(HA_NAME)] = F("Diagnostic");
|
||||||
@@ -1128,8 +1099,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("ext_pump"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("ext_pump"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("ext_pump"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
||||||
doc[FPSTR(HA_NAME)] = F("External pump");
|
doc[FPSTR(HA_NAME)] = F("External pump");
|
||||||
@@ -1149,8 +1120,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.connected and value_json.slave.fault.active, 'online', 'offline') }}");
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.connected and value_json.slave.fault.active, 'online', 'offline') }}");
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("fault_code"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("fault_code"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), F("fault_code"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_NAME)] = F("Fault code");
|
doc[FPSTR(HA_NAME)] = F("Fault code");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:cog-box");
|
doc[FPSTR(HA_ICON)] = F("mdi:cog-box");
|
||||||
@@ -1169,8 +1140,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.connected and value_json.slave.fault.active or value_json.slave.diag.active, 'online', 'offline') }}");
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.connected and value_json.slave.fault.active or value_json.slave.diag.active, 'online', 'offline') }}");
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("diagnostic_code"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("diagnostic_code"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), F("diagnostic_code"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_NAME)] = F("Diagnostic code");
|
doc[FPSTR(HA_NAME)] = F("Diagnostic code");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:information-box");
|
doc[FPSTR(HA_ICON)] = F("mdi:information-box");
|
||||||
@@ -1184,13 +1155,10 @@ public:
|
|||||||
|
|
||||||
bool publishNetworkRssi(bool enabledByDefault = true) {
|
bool publishNetworkRssi(bool enabledByDefault = true) {
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][0][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_TOPIC)] = this->stateTopic.c_str();
|
|
||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.master.network.connectionType == 'wifi', 'online', 'offline') }}");
|
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(FPSTR(S_RSSI));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(FPSTR(S_RSSI));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), FPSTR(S_RSSI));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("signal_strength");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("signal_strength");
|
||||||
doc[FPSTR(HA_STATE_CLASS)] = FPSTR(HA_STATE_CLASS_MEASUREMENT);
|
doc[FPSTR(HA_STATE_CLASS)] = FPSTR(HA_STATE_CLASS_MEASUREMENT);
|
||||||
@@ -1209,8 +1177,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("uptime"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("uptime"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), F("uptime"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("duration");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("duration");
|
||||||
doc[FPSTR(HA_STATE_CLASS)] = F("total_increasing");
|
doc[FPSTR(HA_STATE_CLASS)] = F("total_increasing");
|
||||||
@@ -1226,12 +1194,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool publishClimateHeating(UnitSystem unit = UnitSystem::METRIC, uint8_t minTemp = 20, uint8_t maxTemp = 90, bool enabledByDefault = true) {
|
bool publishClimateHeating(UnitSystem unit = UnitSystem::METRIC, byte minTemp = 20, byte maxTemp = 90, bool enabledByDefault = true) {
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("heating"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_CLIMATE), F("heating"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_NAME)] = F("Heating");
|
doc[FPSTR(HA_NAME)] = F("Heating");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:radiator");
|
doc[FPSTR(HA_ICON)] = F("mdi:radiator");
|
||||||
|
|
||||||
@@ -1278,12 +1246,12 @@ public:
|
|||||||
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_CLIMATE), F("heating"), '_').c_str(), doc);
|
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_CLIMATE), F("heating"), '_').c_str(), doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool publishClimateDhw(UnitSystem unit = UnitSystem::METRIC, uint8_t minTemp = 40, uint8_t maxTemp = 60, bool enabledByDefault = true) {
|
bool publishClimateDhw(UnitSystem unit = UnitSystem::METRIC, byte minTemp = 40, byte maxTemp = 60, bool enabledByDefault = true) {
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("dhw"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("dhw"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_CLIMATE), F("dhw"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_NAME)] = F("DHW");
|
doc[FPSTR(HA_NAME)] = F("DHW");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:faucet");
|
doc[FPSTR(HA_ICON)] = F("mdi:faucet");
|
||||||
|
|
||||||
@@ -1327,8 +1295,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(FPSTR(S_RESTART));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(FPSTR(S_RESTART));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BUTTON), FPSTR(S_RESTART));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
||||||
doc[FPSTR(HA_NAME)] = F("Restart");
|
doc[FPSTR(HA_NAME)] = F("Restart");
|
||||||
@@ -1347,8 +1315,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.fault.active, 'online', 'offline') }}");
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.fault.active, 'online', 'offline') }}");
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("reset_fault"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("reset_fault"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BUTTON), F("reset_fault"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
||||||
doc[FPSTR(HA_NAME)] = F("Reset fault");
|
doc[FPSTR(HA_NAME)] = F("Reset fault");
|
||||||
@@ -1367,8 +1335,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.diag.active, 'online', 'offline') }}");
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.diag.active, 'online', 'offline') }}");
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("reset_diagnostic"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("reset_diagnostic"));
|
||||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BUTTON), F("reset_diagnostic"));
|
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
||||||
doc[FPSTR(HA_NAME)] = F("Reset diagnostic");
|
doc[FPSTR(HA_NAME)] = F("Reset diagnostic");
|
||||||
|
|||||||
+25
-63
@@ -43,6 +43,8 @@ protected:
|
|||||||
bool telnetStarted = false;
|
bool telnetStarted = false;
|
||||||
bool emergencyDetected = false;
|
bool emergencyDetected = false;
|
||||||
unsigned long emergencyFlipTime = 0;
|
unsigned long emergencyFlipTime = 0;
|
||||||
|
bool freezeDetected = false;
|
||||||
|
unsigned long freezeDetectedTime = 0;
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
const char* getTaskName() override {
|
const char* getTaskName() override {
|
||||||
@@ -102,8 +104,7 @@ protected:
|
|||||||
|
|
||||||
vars.mqtt.connected = tMqtt->isConnected();
|
vars.mqtt.connected = tMqtt->isConnected();
|
||||||
vars.network.connected = network->isConnected();
|
vars.network.connected = network->isConnected();
|
||||||
vars.network.rssi = network->getRssi();
|
vars.network.rssi = network->isConnected() ? WiFi.RSSI() : 0;
|
||||||
vars.network.connectionType = network->getUplink();
|
|
||||||
|
|
||||||
if (settings.system.logLevel >= TinyLogger::Level::SILENT && settings.system.logLevel <= TinyLogger::Level::VERBOSE) {
|
if (settings.system.logLevel >= TinyLogger::Level::SILENT && settings.system.logLevel <= TinyLogger::Level::VERBOSE) {
|
||||||
if (Log.getLevel() != settings.system.logLevel) {
|
if (Log.getLevel() != settings.system.logLevel) {
|
||||||
@@ -134,6 +135,8 @@ protected:
|
|||||||
tMqtt->disable();
|
tMqtt->disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sensors::setConnectionStatusByType(Sensors::Type::MANUAL, !settings.mqtt.enabled || vars.mqtt.connected, false);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (this->ntpStarted) {
|
if (this->ntpStarted) {
|
||||||
this->ntpStarted = false;
|
this->ntpStarted = false;
|
||||||
@@ -242,7 +245,7 @@ protected:
|
|||||||
|
|
||||||
void heating() {
|
void heating() {
|
||||||
// freeze protection
|
// freeze protection
|
||||||
{
|
if (!settings.heating.enabled) {
|
||||||
float lowTemp = 255.0f;
|
float lowTemp = 255.0f;
|
||||||
uint8_t availableSensors = 0;
|
uint8_t availableSensors = 0;
|
||||||
|
|
||||||
@@ -273,40 +276,29 @@ protected:
|
|||||||
availableSensors++;
|
availableSensors++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (availableSensors) {
|
if (availableSensors && lowTemp <= settings.heating.freezeProtection.lowTemp) {
|
||||||
if (vars.master.heating.freezing) {
|
if (!this->freezeDetected) {
|
||||||
if (lowTemp - (float) settings.heating.freezeProtection.highTemp + 0.0001f >= 0.0f) {
|
this->freezeDetected = true;
|
||||||
vars.master.heating.freezing = false;
|
this->freezeDetectedTime = millis();
|
||||||
|
|
||||||
Log.sinfoln(
|
} else if (millis() - this->freezeDetectedTime > (settings.heating.freezeProtection.thresholdTime * 1000)) {
|
||||||
FPSTR(L_MAIN),
|
this->freezeDetected = false;
|
||||||
F("No freezing detected. Current low temp: %.2f, threshold (high): %hhu"),
|
|
||||||
lowTemp, settings.heating.freezeProtection.highTemp
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if ((float) settings.heating.freezeProtection.lowTemp - lowTemp + 0.0001f >= 0.0f) {
|
|
||||||
vars.master.heating.freezing = true;
|
|
||||||
|
|
||||||
if (!settings.heating.enabled) {
|
|
||||||
settings.heating.enabled = true;
|
settings.heating.enabled = true;
|
||||||
fsSettings.update();
|
fsSettings.update();
|
||||||
}
|
|
||||||
|
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_MAIN),
|
FPSTR(L_MAIN),
|
||||||
F("Freezing detected! Current low temp: %.2f, threshold (low): %hhu"),
|
F("Heating turned on by freeze protection, current low temp: %.2f, threshold: %hhu"),
|
||||||
lowTemp, settings.heating.freezeProtection.lowTemp
|
lowTemp, settings.heating.freezeProtection.lowTemp
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (this->freezeDetected) {
|
||||||
|
this->freezeDetected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (vars.master.heating.freezing) {
|
} else if (this->freezeDetected) {
|
||||||
vars.master.heating.freezing = false;
|
this->freezeDetected = false;
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_MAIN), F("No sensors available, freeze protection unavailable!"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,7 +319,7 @@ protected:
|
|||||||
emergencyFlags |= 0b00000010;
|
emergencyFlags |= 0b00000010;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.opentherm.options.nativeOTC) {
|
if (settings.opentherm.options.nativeHeatingControl) {
|
||||||
emergencyFlags |= 0b00000100;
|
emergencyFlags |= 0b00000100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -617,12 +609,7 @@ protected:
|
|||||||
if (GPIO_IS_VALID(settings.externalPump.gpio)) {
|
if (GPIO_IS_VALID(settings.externalPump.gpio)) {
|
||||||
configuredGpio = settings.externalPump.gpio;
|
configuredGpio = settings.externalPump.gpio;
|
||||||
pinMode(configuredGpio, OUTPUT);
|
pinMode(configuredGpio, OUTPUT);
|
||||||
digitalWrite(
|
digitalWrite(configuredGpio, LOW);
|
||||||
configuredGpio,
|
|
||||||
settings.externalPump.invertState
|
|
||||||
? HIGH
|
|
||||||
: LOW
|
|
||||||
);
|
|
||||||
|
|
||||||
} else if (configuredGpio != GPIO_IS_NOT_CONFIGURED) {
|
} else if (configuredGpio != GPIO_IS_NOT_CONFIGURED) {
|
||||||
configuredGpio = GPIO_IS_NOT_CONFIGURED;
|
configuredGpio = GPIO_IS_NOT_CONFIGURED;
|
||||||
@@ -650,12 +637,7 @@ protected:
|
|||||||
|
|
||||||
if (!settings.externalPump.use) {
|
if (!settings.externalPump.use) {
|
||||||
if (vars.externalPump.state) {
|
if (vars.externalPump.state) {
|
||||||
digitalWrite(
|
digitalWrite(configuredGpio, LOW);
|
||||||
configuredGpio,
|
|
||||||
settings.externalPump.invertState
|
|
||||||
? HIGH
|
|
||||||
: LOW
|
|
||||||
);
|
|
||||||
|
|
||||||
vars.externalPump.state = false;
|
vars.externalPump.state = false;
|
||||||
vars.externalPump.lastEnabledTime = millis();
|
vars.externalPump.lastEnabledTime = millis();
|
||||||
@@ -668,12 +650,7 @@ protected:
|
|||||||
|
|
||||||
if (vars.externalPump.state && !this->heatingEnabled) {
|
if (vars.externalPump.state && !this->heatingEnabled) {
|
||||||
if (this->extPumpStartReason == MainTask::PumpStartReason::HEATING && millis() - this->heatingDisabledTime > (settings.externalPump.postCirculationTime * 1000u)) {
|
if (this->extPumpStartReason == MainTask::PumpStartReason::HEATING && millis() - this->heatingDisabledTime > (settings.externalPump.postCirculationTime * 1000u)) {
|
||||||
digitalWrite(
|
digitalWrite(configuredGpio, LOW);
|
||||||
configuredGpio,
|
|
||||||
settings.externalPump.invertState
|
|
||||||
? HIGH
|
|
||||||
: LOW
|
|
||||||
);
|
|
||||||
|
|
||||||
vars.externalPump.state = false;
|
vars.externalPump.state = false;
|
||||||
vars.externalPump.lastEnabledTime = millis();
|
vars.externalPump.lastEnabledTime = millis();
|
||||||
@@ -681,12 +658,7 @@ protected:
|
|||||||
Log.sinfoln(FPSTR(L_EXTPUMP), F("Disabled: expired post circulation time"));
|
Log.sinfoln(FPSTR(L_EXTPUMP), F("Disabled: expired post circulation time"));
|
||||||
|
|
||||||
} else if (this->extPumpStartReason == MainTask::PumpStartReason::ANTISTUCK && millis() - this->externalPumpStartTime >= (settings.externalPump.antiStuckTime * 1000u)) {
|
} else if (this->extPumpStartReason == MainTask::PumpStartReason::ANTISTUCK && millis() - this->externalPumpStartTime >= (settings.externalPump.antiStuckTime * 1000u)) {
|
||||||
digitalWrite(
|
digitalWrite(configuredGpio, LOW);
|
||||||
configuredGpio,
|
|
||||||
settings.externalPump.invertState
|
|
||||||
? HIGH
|
|
||||||
: LOW
|
|
||||||
);
|
|
||||||
|
|
||||||
vars.externalPump.state = false;
|
vars.externalPump.state = false;
|
||||||
vars.externalPump.lastEnabledTime = millis();
|
vars.externalPump.lastEnabledTime = millis();
|
||||||
@@ -702,12 +674,7 @@ protected:
|
|||||||
this->externalPumpStartTime = millis();
|
this->externalPumpStartTime = millis();
|
||||||
this->extPumpStartReason = MainTask::PumpStartReason::HEATING;
|
this->extPumpStartReason = MainTask::PumpStartReason::HEATING;
|
||||||
|
|
||||||
digitalWrite(
|
digitalWrite(configuredGpio, HIGH);
|
||||||
configuredGpio,
|
|
||||||
settings.externalPump.invertState
|
|
||||||
? LOW
|
|
||||||
: HIGH
|
|
||||||
);
|
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_EXTPUMP), F("Enabled: heating on"));
|
Log.sinfoln(FPSTR(L_EXTPUMP), F("Enabled: heating on"));
|
||||||
|
|
||||||
@@ -716,12 +683,7 @@ protected:
|
|||||||
this->externalPumpStartTime = millis();
|
this->externalPumpStartTime = millis();
|
||||||
this->extPumpStartReason = MainTask::PumpStartReason::ANTISTUCK;
|
this->extPumpStartReason = MainTask::PumpStartReason::ANTISTUCK;
|
||||||
|
|
||||||
digitalWrite(
|
digitalWrite(configuredGpio, HIGH);
|
||||||
configuredGpio,
|
|
||||||
settings.externalPump.invertState
|
|
||||||
? LOW
|
|
||||||
: HIGH
|
|
||||||
);
|
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_EXTPUMP), F("Enabled: anti stuck"));
|
Log.sinfoln(FPSTR(L_EXTPUMP), F("Enabled: anti stuck"));
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -486,7 +486,6 @@ protected:
|
|||||||
void publishHaEntities() {
|
void publishHaEntities() {
|
||||||
// heating
|
// heating
|
||||||
this->haHelper->publishSwitchHeatingTurbo(false);
|
this->haHelper->publishSwitchHeatingTurbo(false);
|
||||||
this->haHelper->publishSwitchHeatingHysteresis();
|
|
||||||
this->haHelper->publishInputHeatingHysteresis(settings.system.unitSystem);
|
this->haHelper->publishInputHeatingHysteresis(settings.system.unitSystem);
|
||||||
this->haHelper->publishInputHeatingTurboFactor(false);
|
this->haHelper->publishInputHeatingTurboFactor(false);
|
||||||
this->haHelper->publishInputHeatingMinTemp(settings.system.unitSystem);
|
this->haHelper->publishInputHeatingMinTemp(settings.system.unitSystem);
|
||||||
@@ -559,7 +558,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool publishNonStaticHaEntities(bool force = false) {
|
bool publishNonStaticHaEntities(bool force = false) {
|
||||||
static uint8_t _heatingMinTemp, _heatingMaxTemp, _dhwMinTemp, _dhwMaxTemp = 0;
|
static byte _heatingMinTemp, _heatingMaxTemp, _dhwMinTemp, _dhwMaxTemp = 0;
|
||||||
static bool _indoorTempControl, _dhwSupport = false;
|
static bool _indoorTempControl, _dhwSupport = false;
|
||||||
|
|
||||||
bool published = false;
|
bool published = false;
|
||||||
|
|||||||
+56
-173
@@ -19,8 +19,8 @@ protected:
|
|||||||
|
|
||||||
CustomOpenTherm* instance = nullptr;
|
CustomOpenTherm* instance = nullptr;
|
||||||
unsigned long instanceCreatedTime = 0;
|
unsigned long instanceCreatedTime = 0;
|
||||||
uint8_t instanceInGpio = 0;
|
byte instanceInGpio = 0;
|
||||||
uint8_t instanceOutGpio = 0;
|
byte instanceOutGpio = 0;
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
unsigned long connectedTime = 0;
|
unsigned long connectedTime = 0;
|
||||||
unsigned long disconnectedTime = 0;
|
unsigned long disconnectedTime = 0;
|
||||||
@@ -31,7 +31,7 @@ protected:
|
|||||||
unsigned long heatingSetTempTime = 0;
|
unsigned long heatingSetTempTime = 0;
|
||||||
unsigned long dhwSetTempTime = 0;
|
unsigned long dhwSetTempTime = 0;
|
||||||
unsigned long ch2SetTempTime = 0;
|
unsigned long ch2SetTempTime = 0;
|
||||||
uint8_t configuredRxLedGpio = GPIO_IS_NOT_CONFIGURED;
|
byte configuredRxLedGpio = GPIO_IS_NOT_CONFIGURED;
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
const char* getTaskName() override {
|
const char* getTaskName() override {
|
||||||
@@ -90,7 +90,7 @@ protected:
|
|||||||
|
|
||||||
Log.sinfoln(FPSTR(L_OT), F("Started. GPIO IN: %hhu, GPIO OUT: %hhu"), settings.opentherm.inGpio, settings.opentherm.outGpio);
|
Log.sinfoln(FPSTR(L_OT), F("Started. GPIO IN: %hhu, GPIO OUT: %hhu"), settings.opentherm.inGpio, settings.opentherm.outGpio);
|
||||||
|
|
||||||
this->instance->setAfterSendRequestCallback([this](unsigned long request, unsigned long response, OpenThermResponseStatus status, uint8_t attempt) {
|
this->instance->setAfterSendRequestCallback([this](unsigned long request, unsigned long response, OpenThermResponseStatus status, byte attempt) {
|
||||||
Log.sverboseln(
|
Log.sverboseln(
|
||||||
FPSTR(L_OT),
|
FPSTR(L_OT),
|
||||||
F("ID: %4d Request: %8lx Response: %8lx Msg type: %s Attempt: %2d Status: %s"),
|
F("ID: %4d Request: %8lx Response: %8lx Msg type: %s Attempt: %2d Status: %s"),
|
||||||
@@ -170,7 +170,8 @@ protected:
|
|||||||
// Heating settings
|
// Heating settings
|
||||||
vars.master.heating.enabled = this->isReady()
|
vars.master.heating.enabled = this->isReady()
|
||||||
&& settings.heating.enabled
|
&& settings.heating.enabled
|
||||||
&& (vars.master.heating.freezing || (vars.cascadeControl.input && !vars.master.heating.blocking))
|
&& vars.cascadeControl.input
|
||||||
|
&& !vars.master.heating.blocking
|
||||||
&& !vars.master.heating.overheat;
|
&& !vars.master.heating.overheat;
|
||||||
|
|
||||||
// DHW settings
|
// DHW settings
|
||||||
@@ -185,9 +186,7 @@ protected:
|
|||||||
|| (settings.opentherm.options.dhwToCh2 && settings.opentherm.options.dhwSupport && settings.dhw.enabled);
|
|| (settings.opentherm.options.dhwToCh2 && settings.opentherm.options.dhwSupport && settings.dhw.enabled);
|
||||||
|
|
||||||
if (settings.opentherm.options.heatingToCh2) {
|
if (settings.opentherm.options.heatingToCh2) {
|
||||||
vars.master.ch2.targetTemp = !settings.opentherm.options.nativeOTC
|
vars.master.ch2.targetTemp = vars.master.heating.setpointTemp;
|
||||||
? vars.master.heating.setpointTemp
|
|
||||||
: vars.master.heating.targetTemp;
|
|
||||||
|
|
||||||
} else if (settings.opentherm.options.dhwToCh2) {
|
} else if (settings.opentherm.options.dhwToCh2) {
|
||||||
vars.master.ch2.targetTemp = vars.master.dhw.targetTemp;
|
vars.master.ch2.targetTemp = vars.master.dhw.targetTemp;
|
||||||
@@ -219,7 +218,7 @@ protected:
|
|||||||
vars.master.heating.enabled,
|
vars.master.heating.enabled,
|
||||||
vars.master.dhw.enabled,
|
vars.master.dhw.enabled,
|
||||||
settings.opentherm.options.coolingSupport,
|
settings.opentherm.options.coolingSupport,
|
||||||
settings.opentherm.options.nativeOTC,
|
settings.opentherm.options.nativeHeatingControl,
|
||||||
vars.master.ch2.enabled,
|
vars.master.ch2.enabled,
|
||||||
summerWinterMode,
|
summerWinterMode,
|
||||||
dhwBlocking,
|
dhwBlocking,
|
||||||
@@ -237,7 +236,7 @@ protected:
|
|||||||
vars.slave.heating.active = CustomOpenTherm::isCentralHeatingActive(response);
|
vars.slave.heating.active = CustomOpenTherm::isCentralHeatingActive(response);
|
||||||
vars.slave.dhw.active = settings.opentherm.options.dhwSupport ? CustomOpenTherm::isHotWaterActive(response) : false;
|
vars.slave.dhw.active = settings.opentherm.options.dhwSupport ? CustomOpenTherm::isHotWaterActive(response) : false;
|
||||||
vars.slave.flame = CustomOpenTherm::isFlameOn(response);
|
vars.slave.flame = CustomOpenTherm::isFlameOn(response);
|
||||||
vars.slave.cooling.active = CustomOpenTherm::isCoolingActive(response);
|
vars.slave.cooling = CustomOpenTherm::isCoolingActive(response);
|
||||||
vars.slave.ch2.active = CustomOpenTherm::isCh2Active(response);
|
vars.slave.ch2.active = CustomOpenTherm::isCh2Active(response);
|
||||||
vars.slave.fault.active = CustomOpenTherm::isFault(response);
|
vars.slave.fault.active = CustomOpenTherm::isFault(response);
|
||||||
|
|
||||||
@@ -251,7 +250,7 @@ protected:
|
|||||||
Log.snoticeln(
|
Log.snoticeln(
|
||||||
FPSTR(L_OT), F("Received boiler status. Heating: %hhu; DHW: %hhu; flame: %hhu; cooling: %hhu; channel 2: %hhu; fault: %hhu; diag: %hhu"),
|
FPSTR(L_OT), F("Received boiler status. Heating: %hhu; DHW: %hhu; flame: %hhu; cooling: %hhu; channel 2: %hhu; fault: %hhu; diag: %hhu"),
|
||||||
vars.slave.heating.active, vars.slave.dhw.active,
|
vars.slave.heating.active, vars.slave.dhw.active,
|
||||||
vars.slave.flame, vars.slave.cooling.active, vars.slave.ch2.active, vars.slave.fault.active, vars.slave.diag.active
|
vars.slave.flame, vars.slave.cooling, vars.slave.ch2.active, vars.slave.fault.active, vars.slave.diag.active
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,7 +305,6 @@ protected:
|
|||||||
Sensors::setConnectionStatusByType(Sensors::Type::OT_DHW_BURNER_HOURS, false);
|
Sensors::setConnectionStatusByType(Sensors::Type::OT_DHW_BURNER_HOURS, false);
|
||||||
Sensors::setConnectionStatusByType(Sensors::Type::OT_HEATING_PUMP_HOURS, false);
|
Sensors::setConnectionStatusByType(Sensors::Type::OT_HEATING_PUMP_HOURS, false);
|
||||||
Sensors::setConnectionStatusByType(Sensors::Type::OT_DHW_PUMP_HOURS, false);
|
Sensors::setConnectionStatusByType(Sensors::Type::OT_DHW_PUMP_HOURS, false);
|
||||||
Sensors::setConnectionStatusByType(Sensors::Type::OT_COOLING_HOURS, false);
|
|
||||||
|
|
||||||
this->initialized = false;
|
this->initialized = false;
|
||||||
this->disconnectedTime = millis();
|
this->disconnectedTime = millis();
|
||||||
@@ -320,8 +318,6 @@ protected:
|
|||||||
vars.slave.dhw.enabled = false;
|
vars.slave.dhw.enabled = false;
|
||||||
vars.slave.dhw.active = false;
|
vars.slave.dhw.active = false;
|
||||||
vars.slave.flame = false;
|
vars.slave.flame = false;
|
||||||
vars.slave.cooling.active = false;
|
|
||||||
vars.slave.cooling.setpoint = 0;
|
|
||||||
vars.slave.fault.active = false;
|
vars.slave.fault.active = false;
|
||||||
vars.slave.fault.code = 0;
|
vars.slave.fault.code = 0;
|
||||||
vars.slave.diag.active = false;
|
vars.slave.diag.active = false;
|
||||||
@@ -679,21 +675,6 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update cooling hours
|
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_COOLING_HOURS, true)) {
|
|
||||||
if (this->updateCoolingHours()) {
|
|
||||||
Log.snoticeln(FPSTR(L_OT), F("Received cooling hours: %hu"), vars.slave.stats.coolingHours);
|
|
||||||
|
|
||||||
Sensors::setValueByType(
|
|
||||||
Sensors::Type::OT_COOLING_HOURS, vars.slave.stats.coolingHours,
|
|
||||||
Sensors::ValueType::PRIMARY, true, true
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.swarningln(FPSTR(L_OT), F("Failed receive cooling hours"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Auto fault reset
|
// Auto fault reset
|
||||||
if (settings.opentherm.options.autoFaultReset && vars.slave.fault.active && !vars.actions.resetFault) {
|
if (settings.opentherm.options.autoFaultReset && vars.slave.fault.active && !vars.actions.resetFault) {
|
||||||
vars.actions.resetFault = true;
|
vars.actions.resetFault = true;
|
||||||
@@ -707,22 +688,6 @@ protected:
|
|||||||
this->prevUpdateNonEssentialVars = millis();
|
this->prevUpdateNonEssentialVars = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set cooling setpoint = heating max modulation
|
|
||||||
if (settings.opentherm.options.coolingSupport) {
|
|
||||||
if (this->setCoolingSetpoint(settings.heating.maxModulation)) {
|
|
||||||
Log.snoticeln(
|
|
||||||
FPSTR(L_OT), F("Set cooling setpoint: %hhu%% (response: %hhu%%)"),
|
|
||||||
settings.heating.maxModulation, vars.slave.cooling.setpoint
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_OT), F("Failed set cooling setpoint: %hhu%% (response: %hhu%%)"),
|
|
||||||
settings.heating.maxModulation, vars.slave.cooling.setpoint
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set max modulation level
|
// Set max modulation level
|
||||||
uint8_t targetMaxModulation = vars.slave.modulation.max;
|
uint8_t targetMaxModulation = vars.slave.modulation.max;
|
||||||
if (vars.slave.heating.active) {
|
if (vars.slave.heating.active) {
|
||||||
@@ -809,7 +774,7 @@ protected:
|
|||||||
bool result = this->updateDhwTemp();
|
bool result = this->updateDhwTemp();
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
const float convertedDhwTemp = convertTemp(
|
float convertedDhwTemp = convertTemp(
|
||||||
vars.slave.dhw.currentTemp,
|
vars.slave.dhw.currentTemp,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -833,7 +798,7 @@ protected:
|
|||||||
// Update DHW temp 2
|
// Update DHW temp 2
|
||||||
if (settings.opentherm.options.dhwSupport && Sensors::getAmountByType(Sensors::Type::OT_DHW_TEMP2, true)) {
|
if (settings.opentherm.options.dhwSupport && Sensors::getAmountByType(Sensors::Type::OT_DHW_TEMP2, true)) {
|
||||||
if (this->updateDhwTemp2()) {
|
if (this->updateDhwTemp2()) {
|
||||||
const float convertedDhwTemp2 = convertTemp(
|
float convertedDhwTemp2 = convertTemp(
|
||||||
vars.slave.dhw.currentTemp2,
|
vars.slave.dhw.currentTemp2,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -857,7 +822,7 @@ protected:
|
|||||||
// Update DHW flow rate
|
// Update DHW flow rate
|
||||||
if (settings.opentherm.options.dhwSupport && Sensors::getAmountByType(Sensors::Type::OT_DHW_FLOW_RATE, true)) {
|
if (settings.opentherm.options.dhwSupport && Sensors::getAmountByType(Sensors::Type::OT_DHW_FLOW_RATE, true)) {
|
||||||
if (this->updateDhwFlowRate()) {
|
if (this->updateDhwFlowRate()) {
|
||||||
const float convertedDhwFlowRate = convertVolume(
|
float convertedDhwFlowRate = convertVolume(
|
||||||
vars.slave.dhw.flowRate,
|
vars.slave.dhw.flowRate,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -881,7 +846,7 @@ protected:
|
|||||||
// Update heating temp
|
// Update heating temp
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_HEATING_TEMP, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_HEATING_TEMP, true)) {
|
||||||
if (this->updateHeatingTemp()) {
|
if (this->updateHeatingTemp()) {
|
||||||
const float convertedHeatingTemp = convertTemp(
|
float convertedHeatingTemp = convertTemp(
|
||||||
vars.slave.heating.currentTemp,
|
vars.slave.heating.currentTemp,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -905,7 +870,7 @@ protected:
|
|||||||
// Update heating return temp
|
// Update heating return temp
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_HEATING_RETURN_TEMP, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_HEATING_RETURN_TEMP, true)) {
|
||||||
if (this->updateHeatingReturnTemp()) {
|
if (this->updateHeatingReturnTemp()) {
|
||||||
const float convertedHeatingReturnTemp = convertTemp(
|
float convertedHeatingReturnTemp = convertTemp(
|
||||||
vars.slave.heating.returnTemp,
|
vars.slave.heating.returnTemp,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -928,9 +893,9 @@ protected:
|
|||||||
|
|
||||||
// Update CH2 temp
|
// Update CH2 temp
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_CH2_TEMP, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_CH2_TEMP, true)) {
|
||||||
if (vars.master.ch2.enabled && !settings.opentherm.options.nativeOTC) {
|
if (vars.master.ch2.enabled && !settings.opentherm.options.nativeHeatingControl) {
|
||||||
if (this->updateCh2Temp()) {
|
if (this->updateCh2Temp()) {
|
||||||
const float convertedCh2Temp = convertTemp(
|
float convertedCh2Temp = convertTemp(
|
||||||
vars.slave.ch2.currentTemp,
|
vars.slave.ch2.currentTemp,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -955,7 +920,7 @@ protected:
|
|||||||
// Update exhaust temp
|
// Update exhaust temp
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_EXHAUST_TEMP, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_EXHAUST_TEMP, true)) {
|
||||||
if (this->updateExhaustTemp()) {
|
if (this->updateExhaustTemp()) {
|
||||||
const float convertedExhaustTemp = convertTemp(
|
float convertedExhaustTemp = convertTemp(
|
||||||
vars.slave.exhaust.temp,
|
vars.slave.exhaust.temp,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -979,7 +944,7 @@ protected:
|
|||||||
// Update heat exchanger temp
|
// Update heat exchanger temp
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_HEAT_EXCHANGER_TEMP, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_HEAT_EXCHANGER_TEMP, true)) {
|
||||||
if (this->updateHeatExchangerTemp()) {
|
if (this->updateHeatExchangerTemp()) {
|
||||||
const float convertedHeatExchTemp = convertTemp(
|
float convertedHeatExchTemp = convertTemp(
|
||||||
vars.slave.heatExchangerTemp,
|
vars.slave.heatExchangerTemp,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -1003,7 +968,7 @@ protected:
|
|||||||
// Update outdoor temp
|
// Update outdoor temp
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_OUTDOOR_TEMP, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_OUTDOOR_TEMP, true)) {
|
||||||
if (this->updateOutdoorTemp()) {
|
if (this->updateOutdoorTemp()) {
|
||||||
const float convertedOutdoorTemp = convertTemp(
|
float convertedOutdoorTemp = convertTemp(
|
||||||
vars.slave.heating.outdoorTemp,
|
vars.slave.heating.outdoorTemp,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -1027,7 +992,7 @@ protected:
|
|||||||
// Update solar storage temp
|
// Update solar storage temp
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_SOLAR_STORAGE_TEMP, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_SOLAR_STORAGE_TEMP, true)) {
|
||||||
if (this->updateSolarStorageTemp()) {
|
if (this->updateSolarStorageTemp()) {
|
||||||
const float convertedSolarStorageTemp = convertTemp(
|
float convertedSolarStorageTemp = convertTemp(
|
||||||
vars.slave.solar.storage,
|
vars.slave.solar.storage,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -1051,7 +1016,7 @@ protected:
|
|||||||
// Update solar collector temp
|
// Update solar collector temp
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_SOLAR_COLLECTOR_TEMP, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_SOLAR_COLLECTOR_TEMP, true)) {
|
||||||
if (this->updateSolarCollectorTemp()) {
|
if (this->updateSolarCollectorTemp()) {
|
||||||
const float convertedSolarCollectorTemp = convertTemp(
|
float convertedSolarCollectorTemp = convertTemp(
|
||||||
vars.slave.solar.collector,
|
vars.slave.solar.collector,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -1097,7 +1062,7 @@ protected:
|
|||||||
// Update pressure
|
// Update pressure
|
||||||
if (Sensors::getAmountByType(Sensors::Type::OT_PRESSURE, true)) {
|
if (Sensors::getAmountByType(Sensors::Type::OT_PRESSURE, true)) {
|
||||||
if (this->updatePressure()) {
|
if (this->updatePressure()) {
|
||||||
const float convertedPressure = convertPressure(
|
float convertedPressure = convertPressure(
|
||||||
vars.slave.pressure,
|
vars.slave.pressure,
|
||||||
settings.opentherm.unitSystem,
|
settings.opentherm.unitSystem,
|
||||||
settings.system.unitSystem
|
settings.system.unitSystem
|
||||||
@@ -1203,12 +1168,9 @@ protected:
|
|||||||
|
|
||||||
// Update DHW temp
|
// Update DHW temp
|
||||||
if (vars.master.dhw.enabled) {
|
if (vars.master.dhw.enabled) {
|
||||||
// Target dhw temp
|
|
||||||
const float& targetTemp = vars.master.dhw.targetTemp;
|
|
||||||
|
|
||||||
// Converted target dhw temp
|
// Converted target dhw temp
|
||||||
const float convertedTemp = convertTemp(
|
float convertedTemp = convertTemp(
|
||||||
targetTemp,
|
vars.master.dhw.targetTemp,
|
||||||
settings.system.unitSystem,
|
settings.system.unitSystem,
|
||||||
settings.opentherm.unitSystem
|
settings.opentherm.unitSystem
|
||||||
);
|
);
|
||||||
@@ -1220,7 +1182,7 @@ protected:
|
|||||||
|
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_OT_DHW), F("Set temp: %.2f (converted: %.2f, response: %.2f)"),
|
FPSTR(L_OT_DHW), F("Set temp: %.2f (converted: %.2f, response: %.2f)"),
|
||||||
targetTemp, convertedTemp, vars.slave.dhw.targetTemp
|
vars.master.dhw.targetTemp, convertedTemp, vars.slave.dhw.targetTemp
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1229,19 +1191,16 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send indoor temp if AlwaysSendIndoorTemp option is enabled.
|
// Native heating control
|
||||||
if (settings.opentherm.options.nativeOTC || settings.opentherm.options.alwaysSendIndoorTemp) {
|
if (settings.opentherm.options.nativeHeatingControl) {
|
||||||
// Current indoor temp
|
|
||||||
const float& indoorTemp = vars.master.heating.indoorTemp;
|
|
||||||
|
|
||||||
// Converted current indoor temp
|
// Converted current indoor temp
|
||||||
const float convertedTemp = convertTemp(indoorTemp, settings.system.unitSystem, settings.opentherm.unitSystem);
|
float convertedTemp = convertTemp(vars.master.heating.indoorTemp, settings.system.unitSystem, settings.opentherm.unitSystem);
|
||||||
|
|
||||||
// Set current indoor temp
|
// Set current indoor temp
|
||||||
if (this->setRoomTemp(convertedTemp)) {
|
if (this->setRoomTemp(convertedTemp)) {
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_OT_HEATING), F("Set current indoor temp: %.2f (converted: %.2f, response: %.2f)"),
|
FPSTR(L_OT_HEATING), F("Set current indoor temp: %.2f (converted: %.2f, response: %.2f)"),
|
||||||
indoorTemp, convertedTemp, vars.slave.heating.indoorTemp
|
vars.master.heating.indoorTemp, convertedTemp, vars.slave.heating.indoorTemp
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1253,26 +1212,17 @@ protected:
|
|||||||
if (this->setRoomTempCh2(convertedTemp)) {
|
if (this->setRoomTempCh2(convertedTemp)) {
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_OT_HEATING), F("Set current CH2 indoor temp: %.2f (converted: %.2f, response: %.2f)"),
|
FPSTR(L_OT_HEATING), F("Set current CH2 indoor temp: %.2f (converted: %.2f, response: %.2f)"),
|
||||||
indoorTemp, convertedTemp, vars.slave.ch2.indoorTemp
|
vars.master.heating.indoorTemp, convertedTemp, vars.slave.ch2.indoorTemp
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.swarningln(FPSTR(L_OT_HEATING), F("Failed set current CH2 indoor temp"));
|
Log.swarningln(FPSTR(L_OT_HEATING), F("Failed set current CH2 indoor temp"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// NativeOTC
|
|
||||||
if (settings.opentherm.options.nativeOTC) {
|
|
||||||
// Target indoor temp
|
|
||||||
const float& targetTemp = vars.master.heating.targetTemp;
|
|
||||||
|
|
||||||
// Converted target indoor temp
|
// Converted target indoor temp
|
||||||
const float convertedTemp = convertTemp(
|
convertedTemp = convertTemp(vars.master.heating.targetTemp, settings.system.unitSystem, settings.opentherm.unitSystem);
|
||||||
targetTemp,
|
|
||||||
settings.system.unitSystem,
|
|
||||||
settings.opentherm.unitSystem
|
|
||||||
);
|
|
||||||
|
|
||||||
// Set target indoor temp
|
// Set target indoor temp
|
||||||
if (this->needSetHeatingTemp(convertedTemp)) {
|
if (this->needSetHeatingTemp(convertedTemp)) {
|
||||||
@@ -1281,7 +1231,7 @@ protected:
|
|||||||
|
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_OT_HEATING), F("Set target indoor temp: %.2f (converted: %.2f, response: %.2f)"),
|
FPSTR(L_OT_HEATING), F("Set target indoor temp: %.2f (converted: %.2f, response: %.2f)"),
|
||||||
targetTemp, convertedTemp, vars.slave.heating.targetTemp
|
vars.master.heating.targetTemp, convertedTemp, vars.slave.heating.targetTemp
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1296,7 +1246,7 @@ protected:
|
|||||||
|
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_OT_HEATING), F("Set target CH2 indoor temp: %.2f (converted: %.2f, response: %.2f)"),
|
FPSTR(L_OT_HEATING), F("Set target CH2 indoor temp: %.2f (converted: %.2f, response: %.2f)"),
|
||||||
targetTemp, convertedTemp, vars.slave.ch2.targetTemp
|
vars.master.heating.targetTemp, convertedTemp, vars.slave.ch2.targetTemp
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1305,22 +1255,10 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set heating temp
|
// Normal heating control
|
||||||
{
|
if (!settings.opentherm.options.nativeHeatingControl && vars.master.heating.enabled) {
|
||||||
// Target heating temp
|
|
||||||
float targetTemp = 0.0f;
|
|
||||||
if (vars.master.heating.enabled) {
|
|
||||||
targetTemp = !settings.opentherm.options.nativeOTC
|
|
||||||
? vars.master.heating.setpointTemp
|
|
||||||
: vars.master.heating.targetTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Converted target heating temp
|
// Converted target heating temp
|
||||||
const float convertedTemp = convertTemp(
|
float convertedTemp = convertTemp(vars.master.heating.setpointTemp, settings.system.unitSystem, settings.opentherm.unitSystem);
|
||||||
targetTemp,
|
|
||||||
settings.system.unitSystem,
|
|
||||||
settings.opentherm.unitSystem
|
|
||||||
);
|
|
||||||
|
|
||||||
if (this->needSetHeatingTemp(convertedTemp)) {
|
if (this->needSetHeatingTemp(convertedTemp)) {
|
||||||
// Set max heating temp
|
// Set max heating temp
|
||||||
@@ -1328,13 +1266,13 @@ protected:
|
|||||||
if (this->setMaxHeatingTemp(convertedTemp)) {
|
if (this->setMaxHeatingTemp(convertedTemp)) {
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_OT_HEATING), F("Set max heating temp: %.2f (converted: %.2f)"),
|
FPSTR(L_OT_HEATING), F("Set max heating temp: %.2f (converted: %.2f)"),
|
||||||
targetTemp, convertedTemp
|
vars.master.heating.setpointTemp, convertedTemp
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.swarningln(
|
Log.swarningln(
|
||||||
FPSTR(L_OT_HEATING), F("Failed set max heating temp: %.2f (converted: %.2f)"),
|
FPSTR(L_OT_HEATING), F("Failed set max heating temp: %.2f (converted: %.2f)"),
|
||||||
targetTemp, convertedTemp
|
vars.master.heating.setpointTemp, convertedTemp
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1345,7 +1283,7 @@ protected:
|
|||||||
|
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_OT_HEATING), F("Set target temp: %.2f (converted: %.2f, response: %.2f)"),
|
FPSTR(L_OT_HEATING), F("Set target temp: %.2f (converted: %.2f, response: %.2f)"),
|
||||||
targetTemp, convertedTemp, vars.slave.heating.targetTemp
|
vars.master.heating.setpointTemp, convertedTemp, vars.slave.heating.targetTemp
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1355,15 +1293,11 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set CH2 temp
|
// Set CH2 temp
|
||||||
|
if (!settings.opentherm.options.nativeHeatingControl && vars.master.ch2.enabled) {
|
||||||
if (settings.opentherm.options.heatingToCh2 || settings.opentherm.options.dhwToCh2) {
|
if (settings.opentherm.options.heatingToCh2 || settings.opentherm.options.dhwToCh2) {
|
||||||
// Target CH2 heating temp
|
|
||||||
const float targetTemp = vars.master.ch2.enabled
|
|
||||||
? vars.master.ch2.targetTemp
|
|
||||||
: 0.0f;
|
|
||||||
|
|
||||||
// Converted target CH2 temp
|
// Converted target CH2 temp
|
||||||
const float convertedTemp = convertTemp(
|
float convertedTemp = convertTemp(
|
||||||
targetTemp,
|
vars.master.ch2.targetTemp,
|
||||||
settings.system.unitSystem,
|
settings.system.unitSystem,
|
||||||
settings.opentherm.unitSystem
|
settings.opentherm.unitSystem
|
||||||
);
|
);
|
||||||
@@ -1374,7 +1308,7 @@ protected:
|
|||||||
|
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_OT_CH2), F("Set temp: %.2f (converted: %.2f, response: %.2f)"),
|
FPSTR(L_OT_CH2), F("Set temp: %.2f (converted: %.2f, response: %.2f)"),
|
||||||
targetTemp, convertedTemp, vars.slave.ch2.targetTemp
|
vars.master.ch2.targetTemp, convertedTemp, vars.slave.ch2.targetTemp
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1382,11 +1316,12 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Heating overheat control
|
// Heating overheat control
|
||||||
if (settings.heating.overheatProtection.highTemp > 0 && settings.heating.overheatProtection.lowTemp > 0) {
|
if (settings.heating.overheatProtection.highTemp > 0 && settings.heating.overheatProtection.lowTemp > 0) {
|
||||||
const float highTemp = convertTemp(
|
float highTemp = convertTemp(
|
||||||
max({
|
max({
|
||||||
vars.slave.heating.currentTemp,
|
vars.slave.heating.currentTemp,
|
||||||
vars.slave.heating.returnTemp,
|
vars.slave.heating.returnTemp,
|
||||||
@@ -1423,7 +1358,7 @@ protected:
|
|||||||
|
|
||||||
// DHW overheat control
|
// DHW overheat control
|
||||||
if (settings.dhw.overheatProtection.highTemp > 0 && settings.dhw.overheatProtection.lowTemp > 0) {
|
if (settings.dhw.overheatProtection.highTemp > 0 && settings.dhw.overheatProtection.lowTemp > 0) {
|
||||||
const float highTemp = convertTemp(
|
float highTemp = convertTemp(
|
||||||
max({
|
max({
|
||||||
vars.slave.heating.currentTemp,
|
vars.slave.heating.currentTemp,
|
||||||
vars.slave.heating.returnTemp,
|
vars.slave.heating.returnTemp,
|
||||||
@@ -1517,19 +1452,6 @@ protected:
|
|||||||
} else {
|
} else {
|
||||||
Log.swarningln(FPSTR(L_OT), F("Failed set master config"));
|
Log.swarningln(FPSTR(L_OT), F("Failed set master config"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*char buf[100];
|
|
||||||
if (this->instance->getStr(OpenThermMessageID::Brand, buf, sizeof(buf) - 1)) {
|
|
||||||
Log.snoticeln(FPSTR(L_OT), F("Slave brand: %s"), buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->instance->getStr(OpenThermMessageID::BrandVersion, buf, sizeof(buf) - 1)) {
|
|
||||||
Log.snoticeln(FPSTR(L_OT), F("Slave brand version: %s"), buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->instance->getStr(OpenThermMessageID::BrandSerialNumber, buf, sizeof(buf) - 1)) {
|
|
||||||
Log.snoticeln(FPSTR(L_OT), F("Slave brand s/n: %s"), buf);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isReady() {
|
bool isReady() {
|
||||||
@@ -1646,26 +1568,6 @@ protected:
|
|||||||
return CustomOpenTherm::getUInt(response) == request;
|
return CustomOpenTherm::getUInt(response) == request;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool setCoolingSetpoint(const uint8_t value) {
|
|
||||||
const unsigned int request = CustomOpenTherm::toFloat(value);
|
|
||||||
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
|
||||||
OpenThermRequestType::WRITE_DATA,
|
|
||||||
OpenThermMessageID::CoolingControl,
|
|
||||||
request
|
|
||||||
));
|
|
||||||
|
|
||||||
if (!CustomOpenTherm::isValidResponse(response)) {
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} else if (!CustomOpenTherm::isValidResponseId(response, OpenThermMessageID::CoolingControl)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
vars.slave.cooling.setpoint = CustomOpenTherm::getFloat(response);
|
|
||||||
|
|
||||||
return CustomOpenTherm::getUInt(response) == request;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setMaxModulationLevel(const uint8_t value) {
|
bool setMaxModulationLevel(const uint8_t value) {
|
||||||
const unsigned int request = CustomOpenTherm::toFloat(value);
|
const unsigned int request = CustomOpenTherm::toFloat(value);
|
||||||
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
||||||
@@ -1707,7 +1609,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool setRoomTemp(const float temperature) {
|
bool setRoomTemp(float temperature) {
|
||||||
const unsigned int request = CustomOpenTherm::temperatureToData(temperature);
|
const unsigned int request = CustomOpenTherm::temperatureToData(temperature);
|
||||||
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
||||||
OpenThermMessageType::WRITE_DATA,
|
OpenThermMessageType::WRITE_DATA,
|
||||||
@@ -1727,7 +1629,7 @@ protected:
|
|||||||
return CustomOpenTherm::getUInt(response) == request;
|
return CustomOpenTherm::getUInt(response) == request;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool setRoomTempCh2(const float temperature) {
|
bool setRoomTempCh2(float temperature) {
|
||||||
const unsigned int request = CustomOpenTherm::temperatureToData(temperature);
|
const unsigned int request = CustomOpenTherm::temperatureToData(temperature);
|
||||||
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
||||||
OpenThermMessageType::WRITE_DATA,
|
OpenThermMessageType::WRITE_DATA,
|
||||||
@@ -2229,25 +2131,6 @@ protected:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool updateCoolingHours() {
|
|
||||||
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
|
||||||
OpenThermRequestType::READ_DATA,
|
|
||||||
OpenThermMessageID::CoolingOperationHours,
|
|
||||||
0
|
|
||||||
));
|
|
||||||
|
|
||||||
if (!CustomOpenTherm::isValidResponse(response)) {
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} else if (!CustomOpenTherm::isValidResponseId(response, OpenThermMessageID::CoolingOperationHours)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
vars.slave.stats.coolingHours = CustomOpenTherm::getUInt(response);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool updateModulationLevel() {
|
bool updateModulationLevel() {
|
||||||
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
||||||
OpenThermRequestType::READ_DATA,
|
OpenThermRequestType::READ_DATA,
|
||||||
@@ -2262,7 +2145,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float value = CustomOpenTherm::getFloat(response);
|
float value = CustomOpenTherm::getFloat(response);
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2286,7 +2169,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float value = CustomOpenTherm::getFloat(response);
|
float value = CustomOpenTherm::getFloat(response);
|
||||||
if (value <= 0) {
|
if (value <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2310,7 +2193,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float value = CustomOpenTherm::getFloat(response);
|
float value = CustomOpenTherm::getFloat(response);
|
||||||
if (value <= 0) {
|
if (value <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2364,7 +2247,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float value = CustomOpenTherm::getFloat(response);
|
float value = CustomOpenTherm::getFloat(response);
|
||||||
if (value <= 0) {
|
if (value <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2428,7 +2311,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float value = (float) CustomOpenTherm::getInt(response);
|
float value = (float) CustomOpenTherm::getInt(response);
|
||||||
if (!isValidTemp(value, settings.opentherm.unitSystem, -40, 500)) {
|
if (!isValidTemp(value, settings.opentherm.unitSystem, -40, 500)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2452,7 +2335,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float value = (float) CustomOpenTherm::getInt(response);
|
float value = (float) CustomOpenTherm::getInt(response);
|
||||||
if (value <= 0) {
|
if (value <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2553,7 +2436,7 @@ protected:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float value = CustomOpenTherm::getFloat(response);
|
float value = CustomOpenTherm::getFloat(response);
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
+34
-179
@@ -29,7 +29,6 @@ public:
|
|||||||
this->webServer = new WebServer(80);
|
this->webServer = new WebServer(80);
|
||||||
this->bufferedWebServer = new BufferedWebServer(this->webServer, 32u);
|
this->bufferedWebServer = new BufferedWebServer(this->webServer, 32u);
|
||||||
this->dnsServer = new DNSServer();
|
this->dnsServer = new DNSServer();
|
||||||
this->mDnsRetryTime = millis() - this->mDnsRetryInterval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~PortalTask() {
|
~PortalTask() {
|
||||||
@@ -57,11 +56,6 @@ protected:
|
|||||||
bool dnsServerEnabled = false;
|
bool dnsServerEnabled = false;
|
||||||
unsigned long webServerChangeState = 0;
|
unsigned long webServerChangeState = 0;
|
||||||
bool mDnsState = false;
|
bool mDnsState = false;
|
||||||
#if USE_ETHERNET
|
|
||||||
NetworkMgr::Uplink mdnsConnectionType = NetworkMgr::Uplink::None;
|
|
||||||
#endif
|
|
||||||
unsigned long mDnsRetryTime = 0;
|
|
||||||
const unsigned long mDnsRetryInterval = 5000;
|
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
const char* getTaskName() override {
|
const char* getTaskName() override {
|
||||||
@@ -247,17 +241,7 @@ protected:
|
|||||||
|
|
||||||
doc.shrinkToFit();
|
doc.shrinkToFit();
|
||||||
|
|
||||||
char filename[64];
|
this->webServer->sendHeader(F("Content-Disposition"), F("attachment; filename=\"backup.json\""));
|
||||||
getFilename(filename, sizeof(filename), "backup");
|
|
||||||
|
|
||||||
char contentDispositionHeaderValue[128];
|
|
||||||
snprintf_P(
|
|
||||||
contentDispositionHeaderValue,
|
|
||||||
sizeof(contentDispositionHeaderValue),
|
|
||||||
PSTR("attachment; filename=\"%s\""),
|
|
||||||
filename
|
|
||||||
);
|
|
||||||
this->webServer->sendHeader(F("Content-Disposition"), contentDispositionHeaderValue);
|
|
||||||
this->bufferedWebServer->send(200, F("application/json"), doc);
|
this->bufferedWebServer->send(200, F("application/json"), doc);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -302,14 +286,12 @@ protected:
|
|||||||
networkSettings.staticConfig.gateway,
|
networkSettings.staticConfig.gateway,
|
||||||
networkSettings.staticConfig.subnet,
|
networkSettings.staticConfig.subnet,
|
||||||
networkSettings.staticConfig.dns
|
networkSettings.staticConfig.dns
|
||||||
)
|
);
|
||||||
->setEthernet(networkSettings.ethernet.enabled);
|
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!doc[FPSTR(S_SETTINGS)].isNull() && jsonToSettings(doc[FPSTR(S_SETTINGS)], settings)) {
|
if (!doc[FPSTR(S_SETTINGS)].isNull() && jsonToSettings(doc[FPSTR(S_SETTINGS)], settings)) {
|
||||||
fsSettings.update();
|
fsSettings.update();
|
||||||
applyEthernetSettings();
|
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,7 +331,6 @@ protected:
|
|||||||
|
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
networkSettingsToJson(networkSettings, doc);
|
networkSettingsToJson(networkSettings, doc);
|
||||||
this->ethernetToJson(doc);
|
|
||||||
doc.shrinkToFit();
|
doc.shrinkToFit();
|
||||||
|
|
||||||
this->bufferedWebServer->send(200, F("application/json"), doc);
|
this->bufferedWebServer->send(200, F("application/json"), doc);
|
||||||
@@ -385,18 +366,10 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool changed = jsonToNetworkSettings(doc, networkSettings);
|
bool changed = jsonToNetworkSettings(doc, networkSettings);
|
||||||
|
|
||||||
// ethernet is only usable with a complete W5500 pin set
|
|
||||||
if (!this->isEthernetConfigured() && networkSettings.ethernet.enabled) {
|
|
||||||
networkSettings.ethernet.enabled = false;
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
doc.clear();
|
doc.clear();
|
||||||
doc.shrinkToFit();
|
doc.shrinkToFit();
|
||||||
|
|
||||||
networkSettingsToJson(networkSettings, doc);
|
networkSettingsToJson(networkSettings, doc);
|
||||||
this->ethernetToJson(doc);
|
|
||||||
doc.shrinkToFit();
|
doc.shrinkToFit();
|
||||||
|
|
||||||
this->bufferedWebServer->send(changed ? 201 : 200, F("application/json"), doc);
|
this->bufferedWebServer->send(changed ? 201 : 200, F("application/json"), doc);
|
||||||
@@ -416,10 +389,7 @@ protected:
|
|||||||
networkSettings.staticConfig.subnet,
|
networkSettings.staticConfig.subnet,
|
||||||
networkSettings.staticConfig.dns
|
networkSettings.staticConfig.dns
|
||||||
)
|
)
|
||||||
->setEthernet(networkSettings.ethernet.enabled)
|
|
||||||
->reconnect();
|
->reconnect();
|
||||||
|
|
||||||
this->applyEthernetSettings();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -428,12 +398,6 @@ protected:
|
|||||||
return this->webServer->send(401);
|
return this->webServer->send(401);
|
||||||
}
|
}
|
||||||
|
|
||||||
// scanning needs WiFi, which is not the uplink while ethernet carries the traffic
|
|
||||||
if (network->getUplink() == NetworkMgr::Uplink::Ethernet) {
|
|
||||||
this->webServer->send(409);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto apCount = WiFi.scanComplete();
|
auto apCount = WiFi.scanComplete();
|
||||||
if (apCount <= 0) {
|
if (apCount <= 0) {
|
||||||
if (apCount != WIFI_SCAN_RUNNING) {
|
if (apCount != WIFI_SCAN_RUNNING) {
|
||||||
@@ -527,7 +491,6 @@ protected:
|
|||||||
doc.shrinkToFit();
|
doc.shrinkToFit();
|
||||||
|
|
||||||
fsSettings.update();
|
fsSettings.update();
|
||||||
applyEthernetSettings();
|
|
||||||
tMqtt->resetPublishedSettingsTime();
|
tMqtt->resetPublishedSettingsTime();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -717,16 +680,6 @@ protected:
|
|||||||
|
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
|
|
||||||
// capabilities: only the flags this build actually has; the UI shows features on an explicit true
|
|
||||||
auto docFeatures = doc[FPSTR(S_FEATURES)].to<JsonObject>();
|
|
||||||
#if USE_ETHERNET
|
|
||||||
docFeatures[FPSTR(S_ETHERNET)] = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if USE_BLE
|
|
||||||
docFeatures[FPSTR(S_BLE)] = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
auto docSystem = doc[FPSTR(S_SYSTEM)].to<JsonObject>();
|
auto docSystem = doc[FPSTR(S_SYSTEM)].to<JsonObject>();
|
||||||
docSystem[FPSTR(S_RESET_REASON)] = getResetReason();
|
docSystem[FPSTR(S_RESET_REASON)] = getResetReason();
|
||||||
docSystem[FPSTR(S_UPTIME)] = millis() / 1000;
|
docSystem[FPSTR(S_UPTIME)] = millis() / 1000;
|
||||||
@@ -735,15 +688,9 @@ protected:
|
|||||||
docNetwork[FPSTR(S_HOSTNAME)] = networkSettings.hostname;
|
docNetwork[FPSTR(S_HOSTNAME)] = networkSettings.hostname;
|
||||||
docNetwork[FPSTR(S_MAC)] = network->getStaMac();
|
docNetwork[FPSTR(S_MAC)] = network->getStaMac();
|
||||||
docNetwork[FPSTR(S_CONNECTED)] = isConnected;
|
docNetwork[FPSTR(S_CONNECTED)] = isConnected;
|
||||||
docNetwork[FPSTR(S_CONNECTION_TYPE)] = network->getConnectionType();
|
docNetwork[FPSTR(S_SSID)] = network->getStaSsid();
|
||||||
// SSID, signal and channel describe the WiFi uplink only: with ethernet up the radio is
|
docNetwork[FPSTR(S_SIGNAL_QUALITY)] = isConnected ? NetworkMgr::rssiToSignalQuality(network->getRssi()) : 0;
|
||||||
// parked and those readings are stale, so report them as not applicable rather than 0 dBm
|
docNetwork[FPSTR(S_CHANNEL)] = isConnected ? network->getStaChannel() : 0;
|
||||||
const bool wifiUplink = network->getUplink() == NetworkMgr::Uplink::Wifi;
|
|
||||||
const char* staSsid = network->getStaSsid();
|
|
||||||
|
|
||||||
docNetwork[FPSTR(S_SSID)] = (wifiUplink && staSsid) ? staSsid : "";
|
|
||||||
docNetwork[FPSTR(S_SIGNAL_QUALITY)] = network->getSignalQuality();
|
|
||||||
docNetwork[FPSTR(S_CHANNEL)] = wifiUplink ? network->getStaChannel() : 0;
|
|
||||||
docNetwork[FPSTR(S_IP)] = isConnected ? network->getStaIp().toString() : "";
|
docNetwork[FPSTR(S_IP)] = isConnected ? network->getStaIp().toString() : "";
|
||||||
docNetwork[FPSTR(S_SUBNET)] = isConnected ? network->getStaSubnet().toString() : "";
|
docNetwork[FPSTR(S_SUBNET)] = isConnected ? network->getStaSubnet().toString() : "";
|
||||||
docNetwork[FPSTR(S_GATEWAY)] = isConnected ? network->getStaGateway().toString() : "";
|
docNetwork[FPSTR(S_GATEWAY)] = isConnected ? network->getStaGateway().toString() : "";
|
||||||
@@ -809,9 +756,6 @@ protected:
|
|||||||
this->webServer->on(F("/api/debug"), HTTP_GET, [this]() {
|
this->webServer->on(F("/api/debug"), HTTP_GET, [this]() {
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
|
|
||||||
auto docNetwork = doc[FPSTR(S_NETWORK)].to<JsonObject>();
|
|
||||||
docNetwork[FPSTR(S_CONNECTION_TYPE)] = network->getConnectionType();
|
|
||||||
|
|
||||||
auto docBuild = doc[FPSTR(S_BUILD)].to<JsonObject>();
|
auto docBuild = doc[FPSTR(S_BUILD)].to<JsonObject>();
|
||||||
docBuild[FPSTR(S_VERSION)] = BUILD_VERSION;
|
docBuild[FPSTR(S_VERSION)] = BUILD_VERSION;
|
||||||
docBuild[FPSTR(S_DATE)] = __DATE__ " " __TIME__;
|
docBuild[FPSTR(S_DATE)] = __DATE__ " " __TIME__;
|
||||||
@@ -895,18 +839,7 @@ protected:
|
|||||||
|
|
||||||
doc.shrinkToFit();
|
doc.shrinkToFit();
|
||||||
|
|
||||||
char filename[64];
|
this->webServer->sendHeader(F("Content-Disposition"), F("attachment; filename=\"debug.json\""));
|
||||||
getFilename(filename, sizeof(filename), "debug");
|
|
||||||
|
|
||||||
char contentDispositionHeaderValue[128];
|
|
||||||
snprintf_P(
|
|
||||||
contentDispositionHeaderValue,
|
|
||||||
sizeof(contentDispositionHeaderValue),
|
|
||||||
PSTR("attachment; filename=\"%s\""),
|
|
||||||
filename
|
|
||||||
);
|
|
||||||
|
|
||||||
this->webServer->sendHeader(F("Content-Disposition"), contentDispositionHeaderValue);
|
|
||||||
this->bufferedWebServer->send(200, F("application/json"), doc, true);
|
this->bufferedWebServer->send(200, F("application/json"), doc, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -940,23 +873,46 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
this->startWebServer();
|
this->startWebServer();
|
||||||
Log.straceln(FPSTR(L_PORTAL_WEBSERVER), F("Started: AP up or network connected"));
|
Log.straceln(FPSTR(L_PORTAL_WEBSERVER), F("Started: AP up or STA connected"));
|
||||||
|
|
||||||
|
// Enabling mDNS
|
||||||
|
if (!this->mDnsState && settings.portal.mdns) {
|
||||||
|
if (MDNS.begin(networkSettings.hostname)) {
|
||||||
|
MDNS.addService("http", "tcp", 80);
|
||||||
|
this->mDnsState = true;
|
||||||
|
|
||||||
|
Log.straceln(FPSTR(L_PORTAL_WEBSERVER), F("mDNS enabled and service added"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP8266
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
::optimistic_yield(1000);
|
::optimistic_yield(1000);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else if (this->stateWebServer() && !network->isApEnabled() && !network->isConnected()) {
|
} else if (this->stateWebServer() && !network->isApEnabled() && !network->isStaEnabled()) {
|
||||||
this->stopWebServer();
|
this->stopWebServer();
|
||||||
Log.straceln(FPSTR(L_PORTAL_WEBSERVER), F("Stopped: no network"));
|
Log.straceln(FPSTR(L_PORTAL_WEBSERVER), F("Stopped: AP and STA down"));
|
||||||
|
|
||||||
|
// Disabling mDNS
|
||||||
|
if (this->mDnsState) {
|
||||||
|
MDNS.end();
|
||||||
|
this->mDnsState = false;
|
||||||
|
|
||||||
|
Log.straceln(FPSTR(L_PORTAL_WEBSERVER), F("mDNS disabled"));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP8266
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
::optimistic_yield(1000);
|
::optimistic_yield(1000);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// mDNS
|
// Disabling mDNS if disabled in settings
|
||||||
this->loopMdns();
|
if (this->mDnsState && !settings.portal.mdns) {
|
||||||
|
MDNS.end();
|
||||||
|
this->mDnsState = false;
|
||||||
|
|
||||||
|
Log.straceln(FPSTR(L_PORTAL_WEBSERVER), F("mDNS disabled"));
|
||||||
|
}
|
||||||
|
|
||||||
// dns server
|
// dns server
|
||||||
if (!this->stateDnsServer() && !network->isConnected() && network->isApEnabled() && this->stateWebServer()) {
|
if (!this->stateDnsServer() && !network->isConnected() && network->isApEnabled() && this->stateWebServer()) {
|
||||||
@@ -1005,99 +961,6 @@ protected:
|
|||||||
return !network->isApEnabled() && settings.portal.auth && strlen(settings.portal.password);
|
return !network->isApEnabled() && settings.portal.auth && strlen(settings.portal.password);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Keep mDNS in sync with the active uplink
|
|
||||||
* @details The responder binds its records to the interface that is up when it starts, so when
|
|
||||||
* switching between interfaces, mDNS must be restarted
|
|
||||||
*/
|
|
||||||
void loopMdns() {
|
|
||||||
#if USE_ETHERNET
|
|
||||||
const NetworkMgr::Uplink connectionType = network->getUplink();
|
|
||||||
|
|
||||||
if (connectionType != this->mdnsConnectionType) {
|
|
||||||
this->mdnsConnectionType = connectionType;
|
|
||||||
|
|
||||||
if (this->mDnsState) {
|
|
||||||
MDNS.end();
|
|
||||||
this->mDnsState = false;
|
|
||||||
|
|
||||||
Log.straceln(FPSTR(L_PORTAL_WEBSERVER), F("mDNS restarting: connection is now %s"), NetworkMgr::uplinkName(connectionType));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!settings.portal.mdns || !this->stateWebServer()) {
|
|
||||||
if (this->mDnsState) {
|
|
||||||
MDNS.end();
|
|
||||||
this->mDnsState = false;
|
|
||||||
|
|
||||||
Log.straceln(FPSTR(L_PORTAL_WEBSERVER), F("mDNS disabled"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->mDnsState || millis() - this->mDnsRetryTime < this->mDnsRetryInterval) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->mDnsRetryTime = millis();
|
|
||||||
|
|
||||||
if (MDNS.begin(networkSettings.hostname)) {
|
|
||||||
MDNS.addService("http", "tcp", 80);
|
|
||||||
this->mDnsState = true;
|
|
||||||
|
|
||||||
Log.straceln(FPSTR(L_PORTAL_WEBSERVER), F("mDNS enabled and service added"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Add the computed W5500 state to a network settings document
|
|
||||||
* @details The key is absent entirely on builds without ethernet, rather than an empty object:
|
|
||||||
* presence of the section is what tells a client the target can do it. The stored fields
|
|
||||||
* (enabled flag, pinout) come from networkSettingsToJson, this adds only what is derived.
|
|
||||||
*/
|
|
||||||
void ethernetToJson(JsonDocument& dst) {
|
|
||||||
#if USE_ETHERNET
|
|
||||||
dst[FPSTR(S_ETHERNET)][FPSTR(S_CONFIGURED)] = this->isEthernetConfigured();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Ethernet can only be used when all six W5500 pins are configured
|
|
||||||
*/
|
|
||||||
bool isEthernetConfigured() {
|
|
||||||
#if USE_ETHERNET
|
|
||||||
return networkSettings.ethernet.w5500.clk != GPIO_IS_NOT_CONFIGURED
|
|
||||||
&& networkSettings.ethernet.w5500.mosi != GPIO_IS_NOT_CONFIGURED
|
|
||||||
&& networkSettings.ethernet.w5500.miso != GPIO_IS_NOT_CONFIGURED
|
|
||||||
&& networkSettings.ethernet.w5500.cs != GPIO_IS_NOT_CONFIGURED
|
|
||||||
&& networkSettings.ethernet.w5500.irq != GPIO_IS_NOT_CONFIGURED
|
|
||||||
&& networkSettings.ethernet.w5500.rst != GPIO_IS_NOT_CONFIGURED;
|
|
||||||
#else
|
|
||||||
// nothing to configure: the W5500 driver is not compiled into this target
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Push the W5500 wiring from the settings into the network manager
|
|
||||||
*/
|
|
||||||
void applyEthernetSettings() {
|
|
||||||
#if USE_ETHERNET
|
|
||||||
network
|
|
||||||
->setEthernet(networkSettings.ethernet.enabled)
|
|
||||||
->setEthernetPins(
|
|
||||||
networkSettings.ethernet.w5500.clk,
|
|
||||||
networkSettings.ethernet.w5500.mosi,
|
|
||||||
networkSettings.ethernet.w5500.miso,
|
|
||||||
networkSettings.ethernet.w5500.cs,
|
|
||||||
networkSettings.ethernet.w5500.irq,
|
|
||||||
networkSettings.ethernet.w5500.rst
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isValidCredentials() {
|
bool isValidCredentials() {
|
||||||
return this->webServer->authenticate(settings.portal.login, settings.portal.password);
|
return this->webServer->authenticate(settings.portal.login, settings.portal.password);
|
||||||
}
|
}
|
||||||
@@ -1183,12 +1046,4 @@ protected:
|
|||||||
this->dnsServer->stop();
|
this->dnsServer->stop();
|
||||||
this->dnsServerEnabled = false;
|
this->dnsServerEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getFilename(char* filename, size_t maxSizeFilename, const char* type) {
|
|
||||||
const time_t now = time(nullptr);
|
|
||||||
const tm* localNow = localtime(&now);
|
|
||||||
char localNowValue[20];
|
|
||||||
strftime(localNowValue, sizeof(localNowValue), PSTR("%Y-%m-%d-%H-%M-%S"), localNow);
|
|
||||||
snprintf_P(filename, maxSizeFilename, PSTR("%s_%s_%s.json"), networkSettings.hostname, localNowValue, type);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
+9
-15
@@ -37,7 +37,7 @@ protected:
|
|||||||
this->indoorSensorsConnected = Sensors::existsConnectedSensorsByPurpose(Sensors::Purpose::INDOOR_TEMP);
|
this->indoorSensorsConnected = Sensors::existsConnectedSensorsByPurpose(Sensors::Purpose::INDOOR_TEMP);
|
||||||
//this->outdoorSensorsConnected = Sensors::existsConnectedSensorsByPurpose(Sensors::Purpose::OUTDOOR_TEMP);
|
//this->outdoorSensorsConnected = Sensors::existsConnectedSensorsByPurpose(Sensors::Purpose::OUTDOOR_TEMP);
|
||||||
|
|
||||||
if (settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeOTC) {
|
if (settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeHeatingControl) {
|
||||||
vars.master.heating.indoorTempControl = true;
|
vars.master.heating.indoorTempControl = true;
|
||||||
vars.master.heating.minTemp = THERMOSTAT_INDOOR_MIN_TEMP;
|
vars.master.heating.minTemp = THERMOSTAT_INDOOR_MIN_TEMP;
|
||||||
vars.master.heating.maxTemp = THERMOSTAT_INDOOR_MAX_TEMP;
|
vars.master.heating.maxTemp = THERMOSTAT_INDOOR_MAX_TEMP;
|
||||||
@@ -90,15 +90,15 @@ protected:
|
|||||||
|
|
||||||
void hysteresis() {
|
void hysteresis() {
|
||||||
bool useHyst = false;
|
bool useHyst = false;
|
||||||
if (settings.heating.hysteresis.enabled && this->indoorSensorsConnected) {
|
if (settings.heating.hysteresis > 0.01f && this->indoorSensorsConnected) {
|
||||||
useHyst = settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeOTC;
|
useHyst = settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeHeatingControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useHyst) {
|
if (useHyst) {
|
||||||
if (!vars.master.heating.blocking && vars.master.heating.indoorTemp - settings.heating.target + 0.0001f >= settings.heating.hysteresis.value) {
|
if (!vars.master.heating.blocking && vars.master.heating.indoorTemp - settings.heating.target + 0.0001f >= settings.heating.hysteresis) {
|
||||||
vars.master.heating.blocking = true;
|
vars.master.heating.blocking = true;
|
||||||
|
|
||||||
} else if (vars.master.heating.blocking && vars.master.heating.indoorTemp - settings.heating.target - 0.0001f <= -(settings.heating.hysteresis.value)) {
|
} else if (vars.master.heating.blocking && vars.master.heating.indoorTemp - settings.heating.target - 0.0001f <= -(settings.heating.hysteresis)) {
|
||||||
vars.master.heating.blocking = false;
|
vars.master.heating.blocking = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,13 +108,13 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline float getHeatingMinSetpointTemp() {
|
inline float getHeatingMinSetpointTemp() {
|
||||||
return settings.opentherm.options.nativeOTC
|
return settings.opentherm.options.nativeHeatingControl
|
||||||
? vars.master.heating.minTemp
|
? vars.master.heating.minTemp
|
||||||
: settings.heating.minTemp;
|
: settings.heating.minTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline float getHeatingMaxSetpointTemp() {
|
inline float getHeatingMaxSetpointTemp() {
|
||||||
return settings.opentherm.options.nativeOTC
|
return settings.opentherm.options.nativeHeatingControl
|
||||||
? vars.master.heating.maxTemp
|
? vars.master.heating.maxTemp
|
||||||
: settings.heating.maxTemp;
|
: settings.heating.maxTemp;
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ protected:
|
|||||||
if (vars.emergency.state) {
|
if (vars.emergency.state) {
|
||||||
return settings.emergency.target;
|
return settings.emergency.target;
|
||||||
|
|
||||||
} else if (settings.opentherm.options.nativeOTC) {
|
} else if (settings.opentherm.options.nativeHeatingControl) {
|
||||||
return settings.heating.target;
|
return settings.heating.target;
|
||||||
|
|
||||||
} else if (!settings.equitherm.enabled && !settings.pid.enabled) {
|
} else if (!settings.equitherm.enabled && !settings.pid.enabled) {
|
||||||
@@ -204,8 +204,7 @@ protected:
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
float error = pidRegulator.setpoint - pidRegulator.input;
|
float error = pidRegulator.setpoint - pidRegulator.input;
|
||||||
bool hasDeadband = settings.pid.deadband.enabled
|
bool hasDeadband = (error > -(settings.pid.deadband.thresholdHigh))
|
||||||
&& (error > -(settings.pid.deadband.thresholdHigh))
|
|
||||||
&& (error < settings.pid.deadband.thresholdLow);
|
&& (error < settings.pid.deadband.thresholdLow);
|
||||||
|
|
||||||
if (hasDeadband) {
|
if (hasDeadband) {
|
||||||
@@ -240,11 +239,6 @@ protected:
|
|||||||
) * settings.heating.turboFactor;
|
) * settings.heating.turboFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If freezing, set temperature to no lower than low temp provided by freeze protection
|
|
||||||
if (vars.master.heating.freezing && fabsf(settings.heating.freezeProtection.lowTemp - newTemp) < 0.0001f) {
|
|
||||||
newTemp = settings.heating.freezeProtection.lowTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
return newTemp;
|
return newTemp;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
+5
-6
@@ -34,7 +34,6 @@ public:
|
|||||||
OT_DHW_BURNER_HOURS = 24,
|
OT_DHW_BURNER_HOURS = 24,
|
||||||
OT_HEATING_PUMP_HOURS = 25,
|
OT_HEATING_PUMP_HOURS = 25,
|
||||||
OT_DHW_PUMP_HOURS = 26,
|
OT_DHW_PUMP_HOURS = 26,
|
||||||
OT_COOLING_HOURS = 27,
|
|
||||||
|
|
||||||
NTC_10K_TEMP = 50,
|
NTC_10K_TEMP = 50,
|
||||||
DALLAS_TEMP = 51,
|
DALLAS_TEMP = 51,
|
||||||
@@ -150,7 +149,7 @@ public:
|
|||||||
|
|
||||||
static int16_t getIdByName(const char* name) {
|
static int16_t getIdByName(const char* name) {
|
||||||
if (settings == nullptr) {
|
if (settings == nullptr) {
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t id = 0; id <= getMaxSensorId(); id++) {
|
for (uint8_t id = 0; id <= getMaxSensorId(); id++) {
|
||||||
@@ -164,7 +163,7 @@ public:
|
|||||||
|
|
||||||
static int16_t getIdByObjectId(const char* objectId) {
|
static int16_t getIdByObjectId(const char* objectId) {
|
||||||
if (settings == nullptr) {
|
if (settings == nullptr) {
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
String refObjectId;
|
String refObjectId;
|
||||||
@@ -330,12 +329,12 @@ public:
|
|||||||
|
|
||||||
static float getMeanValueByPurpose(Purpose purpose, const ValueType valueType, bool onlyConnected = true) {
|
static float getMeanValueByPurpose(Purpose purpose, const ValueType valueType, bool onlyConnected = true) {
|
||||||
if (settings == nullptr || results == nullptr) {
|
if (settings == nullptr || results == nullptr) {
|
||||||
return 0.0f;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t valueId = (uint8_t) valueType;
|
uint8_t valueId = (uint8_t) valueType;
|
||||||
if (!isValidValueId(valueId)) {
|
if (!isValidValueId(valueId)) {
|
||||||
return 0.0f;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
float value = 0.0f;
|
float value = 0.0f;
|
||||||
@@ -364,7 +363,7 @@ public:
|
|||||||
|
|
||||||
static bool existsConnectedSensorsByPurpose(Purpose purpose) {
|
static bool existsConnectedSensorsByPurpose(Purpose purpose) {
|
||||||
if (settings == nullptr || results == nullptr) {
|
if (settings == nullptr || results == nullptr) {
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t id = 0; id <= getMaxSensorId(); id++) {
|
for (uint8_t id = 0; id <= getMaxSensorId(); id++) {
|
||||||
|
|||||||
+95
-117
@@ -8,45 +8,6 @@
|
|||||||
|
|
||||||
extern FileData fsSensorsSettings;
|
extern FileData fsSensorsSettings;
|
||||||
|
|
||||||
#if USE_BLE
|
|
||||||
class BluetoothClientCallbacks : public NimBLEClientCallbacks {
|
|
||||||
public:
|
|
||||||
BluetoothClientCallbacks(uint8_t sensorId) : sensorId(sensorId) {}
|
|
||||||
|
|
||||||
void onConnect(NimBLEClient* pClient) {
|
|
||||||
auto& sSensor = Sensors::settings[this->sensorId];
|
|
||||||
|
|
||||||
Log.sinfoln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': connected to %s"),
|
|
||||||
sensorId, sSensor.name, pClient->getPeerAddress().toString().c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void onDisconnect(NimBLEClient* pClient, int reason) {
|
|
||||||
auto& sSensor = Sensors::settings[this->sensorId];
|
|
||||||
|
|
||||||
Log.sinfoln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': disconnected, reason %i"),
|
|
||||||
sensorId, sSensor.name, reason
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void onConnectFail(NimBLEClient* pClient, int reason) {
|
|
||||||
auto& sSensor = Sensors::settings[this->sensorId];
|
|
||||||
|
|
||||||
Log.sinfoln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to connect, reason %i"),
|
|
||||||
sensorId, sSensor.name, reason
|
|
||||||
);
|
|
||||||
|
|
||||||
pClient->cancelConnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
uint8_t sensorId;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class SensorsTask : public LeanTask {
|
class SensorsTask : public LeanTask {
|
||||||
public:
|
public:
|
||||||
SensorsTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {
|
SensorsTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {
|
||||||
@@ -66,8 +27,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const unsigned int wiredDisconnectTimeout = 180000u;
|
const unsigned int disconnectedTimeout = 120000;
|
||||||
const unsigned int wirelessDisconnectTimeout = 600000u;
|
|
||||||
const unsigned short dallasSearchInterval = 60000;
|
const unsigned short dallasSearchInterval = 60000;
|
||||||
const unsigned short dallasPollingInterval = 10000;
|
const unsigned short dallasPollingInterval = 10000;
|
||||||
const unsigned short globalPollingInterval = 15000;
|
const unsigned short globalPollingInterval = 15000;
|
||||||
@@ -81,7 +41,6 @@ protected:
|
|||||||
std::unordered_map<uint8_t, bool> dallasPolling;
|
std::unordered_map<uint8_t, bool> dallasPolling;
|
||||||
std::unordered_map<uint8_t, unsigned long> dallasLastPollingTime;
|
std::unordered_map<uint8_t, unsigned long> dallasLastPollingTime;
|
||||||
#if USE_BLE
|
#if USE_BLE
|
||||||
std::unordered_map<uint8_t, NimBLEClient*> bleClients;
|
|
||||||
std::unordered_map<uint8_t, bool> bleSubscribed;
|
std::unordered_map<uint8_t, bool> bleSubscribed;
|
||||||
std::unordered_map<uint8_t, unsigned long> bleLastSetDtTime;
|
std::unordered_map<uint8_t, unsigned long> bleLastSetDtTime;
|
||||||
#endif
|
#endif
|
||||||
@@ -426,7 +385,7 @@ protected:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float sensorResistance = value > 1
|
const float sensorResistance = value > 0.001f
|
||||||
? DEFAULT_NTC_REF_RESISTANCE / (DEFAULT_NTC_VREF / (float) value - 1.0f)
|
? DEFAULT_NTC_REF_RESISTANCE / (DEFAULT_NTC_VREF / (float) value - 1.0f)
|
||||||
: 0.0f;
|
: 0.0f;
|
||||||
const float rawTemp = 1.0f / (
|
const float rawTemp = 1.0f / (
|
||||||
@@ -446,35 +405,47 @@ protected:
|
|||||||
|
|
||||||
#if USE_BLE
|
#if USE_BLE
|
||||||
void cleanBleInstances() {
|
void cleanBleInstances() {
|
||||||
|
#if USE_BLE
|
||||||
if (!NimBLEDevice::isInitialized()) {
|
if (!NimBLEDevice::isInitialized()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& [sensorId, pClient]: this->bleClients) {
|
for (auto client : NimBLEDevice::getConnectedClients()) {
|
||||||
if (pClient == nullptr) {
|
auto address = client->getPeerAddress();
|
||||||
|
bool used = false;
|
||||||
|
|
||||||
|
for (uint8_t sensorId = 0; sensorId <= Sensors::getMaxSensorId(); sensorId++) {
|
||||||
|
auto& sSensor = Sensors::settings[sensorId];
|
||||||
|
|
||||||
|
if (!sSensor.enabled || sSensor.type != Sensors::Type::BLUETOOTH || sSensor.purpose == Sensors::Purpose::NOT_CONFIGURED) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
auto pAddress = address.getVal();
|
||||||
const auto sAddress = NimBLEAddress(sSensor.address, 0);
|
uint8_t addr[] = {
|
||||||
|
pAddress[5], pAddress[4], pAddress[3],
|
||||||
|
pAddress[2], pAddress[1], pAddress[0]
|
||||||
|
};
|
||||||
|
|
||||||
if (sAddress.isNull() || !sSensor.enabled || sSensor.type != Sensors::Type::BLUETOOTH || sSensor.purpose == Sensors::Purpose::NOT_CONFIGURED) {
|
if (isEqualAddress(addr, sSensor.address, sizeof(addr))) {
|
||||||
|
used = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!used) {
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s', deleted unused client"),
|
FPSTR(L_SENSORS_BLE), F("Deleted unused client connected to %s"),
|
||||||
sensorId, sSensor.name
|
address.toString().c_str()
|
||||||
);
|
);
|
||||||
|
|
||||||
NimBLEDevice::deleteClient(pClient);
|
NimBLEDevice::deleteClient(client);
|
||||||
pClient = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void pollingBleSensors() {
|
void pollingBleSensors() {
|
||||||
if (!Sensors::getAmountByType(Sensors::Type::BLUETOOTH, true)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!NimBLEDevice::isInitialized() && millis() > 5000) {
|
if (!NimBLEDevice::isInitialized() && millis() > 5000) {
|
||||||
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Initialized"));
|
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Initialized"));
|
||||||
BLEDevice::init("");
|
BLEDevice::init("");
|
||||||
@@ -489,47 +460,38 @@ protected:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto address = NimBLEAddress(sSensor.address, 0);
|
auto client = this->getBleClient(sensorId);
|
||||||
if (address.isNull()) {
|
if (client == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pClient = this->getBleClient(sensorId);
|
if (!client->isConnected()) {
|
||||||
if (pClient == nullptr) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pClient->getPeerAddress() != address) {
|
|
||||||
if (pClient->isConnected()) {
|
|
||||||
if (!pClient->disconnect()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pClient->setPeerAddress(address);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pClient->isConnected()) {
|
|
||||||
this->bleSubscribed[sensorId] = false;
|
this->bleSubscribed[sensorId] = false;
|
||||||
this->bleLastSetDtTime[sensorId] = 0;
|
this->bleLastSetDtTime[sensorId] = 0;
|
||||||
|
|
||||||
if (pClient->connect(false, true, true)) {
|
if (client->connect()) {
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': trying connecting to %s..."),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': connected to %s"),
|
||||||
sensorId, sSensor.name, pClient->getPeerAddress().toString().c_str()
|
sensorId, sSensor.name, client->getPeerAddress().toString().c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log.swarningln(
|
||||||
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed connecting to %s"),
|
||||||
|
sensorId, sSensor.name, client->getPeerAddress().toString().c_str()
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!this->bleSubscribed[sensorId]) {
|
if (!this->bleSubscribed[sensorId]) {
|
||||||
if (this->subscribeToBleDevice(sensorId, pClient)) {
|
if (this->subscribeToBleDevice(sensorId, client)) {
|
||||||
this->bleSubscribed[sensorId] = true;
|
this->bleSubscribed[sensorId] = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this->bleSubscribed[sensorId] = false;
|
this->bleSubscribed[sensorId] = false;
|
||||||
pClient->disconnect();
|
client->disconnect();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -541,7 +503,7 @@ protected:
|
|||||||
struct tm ti;
|
struct tm ti;
|
||||||
|
|
||||||
if (getLocalTime(&ti)) {
|
if (getLocalTime(&ti)) {
|
||||||
if (this->setDateOnBleSensor(pClient, &ti)) {
|
if (this->setDateOnBleSensor(client, &ti)) {
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s', successfully set date: %02d.%02d.%04d %02d:%02d:%02d"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s', successfully set date: %02d.%02d.%04d %02d:%02d:%02d"),
|
||||||
sensorId, sSensor.name,
|
sensorId, sSensor.name,
|
||||||
@@ -574,28 +536,48 @@ protected:
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->bleClients[sensorId] && this->bleClients[sensorId] != nullptr) {
|
uint8_t addr[6] = {
|
||||||
return this->bleClients[sensorId];
|
sSensor.address[0], sSensor.address[1], sSensor.address[2],
|
||||||
|
sSensor.address[3], sSensor.address[4], sSensor.address[5]
|
||||||
|
};
|
||||||
|
const auto address = NimBLEAddress(addr, 0);
|
||||||
|
|
||||||
|
NimBLEClient* pClient = NimBLEDevice::getClientByPeerAddress(address);
|
||||||
|
if (pClient == nullptr) {
|
||||||
|
pClient = NimBLEDevice::getDisconnectedClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto pClient = NimBLEDevice::createClient();
|
if (pClient == nullptr) {
|
||||||
|
if (NimBLEDevice::getCreatedClientCount() >= NIMBLE_MAX_CONNECTIONS) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
pClient = NimBLEDevice::createClient();
|
||||||
if (pClient == nullptr) {
|
if (pClient == nullptr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//pClient->setConnectionParams(BLE_GAP_CONN_ITVL_MS(10), BLE_GAP_CONN_ITVL_MS(100), 10, 150);
|
/**
|
||||||
pClient->setConnectTimeout(30000);
|
* Set initial connection parameters:
|
||||||
pClient->setSelfDelete(false, false);
|
* These settings are safe for 3 clients to connect reliably, can go faster if you have less
|
||||||
pClient->setClientCallbacks(new BluetoothClientCallbacks(sensorId), true);
|
* connections. Timeout should be a multiple of the interval, minimum is 100ms.
|
||||||
|
* Min interval: 12 * 1.25ms = 15, Max interval: 12 * 1.25ms = 15, 0 latency, 1000 * 10ms = 10000ms timeout
|
||||||
|
*/
|
||||||
|
pClient->setConnectionParams(12, 12, 0, 1000);
|
||||||
|
pClient->setConnectTimeout(5000);
|
||||||
|
pClient->setSelfDelete(false, true);
|
||||||
|
}
|
||||||
|
|
||||||
this->bleClients[sensorId] = pClient;
|
if (!pClient->isConnected()) {
|
||||||
|
pClient->setPeerAddress(address);
|
||||||
|
}
|
||||||
|
|
||||||
return pClient;
|
return pClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subscribeToBleDevice(const uint8_t sensorId, NimBLEClient* pClient) {
|
bool subscribeToBleDevice(const uint8_t sensorId, NimBLEClient* pClient) {
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
auto& sSensor = Sensors::settings[sensorId];
|
||||||
auto pAddress = pClient->getPeerAddress().toString();
|
auto pAddress = pClient->getPeerAddress().toString().c_str();
|
||||||
|
|
||||||
NimBLERemoteService* pService = nullptr;
|
NimBLERemoteService* pService = nullptr;
|
||||||
NimBLERemoteCharacteristic* pChar = nullptr;
|
NimBLERemoteCharacteristic* pChar = nullptr;
|
||||||
@@ -606,13 +588,13 @@ protected:
|
|||||||
if (!pService) {
|
if (!pService) {
|
||||||
Log.straceln(
|
Log.straceln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to find env service (%s) on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to find env service (%s) on device %s"),
|
||||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
|
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.straceln(
|
Log.straceln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found env service (%s) on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found env service (%s) on device %s"),
|
||||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
|
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
// 0x2A6E - Notify temperature x0.01C (pvvx)
|
// 0x2A6E - Notify temperature x0.01C (pvvx)
|
||||||
@@ -624,7 +606,7 @@ protected:
|
|||||||
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
||||||
Log.straceln(
|
Log.straceln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found temp char (%s) in env service on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found temp char (%s) in env service on device %s"),
|
||||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
|
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
pChar->unsubscribe();
|
pChar->unsubscribe();
|
||||||
@@ -679,14 +661,14 @@ protected:
|
|||||||
Log.straceln(
|
Log.straceln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to temp char (%s) in env service on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to temp char (%s) in env service on device %s"),
|
||||||
sensorId, sSensor.name,
|
sensorId, sSensor.name,
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
charUuid.toString().c_str(), pAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.swarningln(
|
Log.swarningln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to temp char (%s) in env service on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to temp char (%s) in env service on device %s"),
|
||||||
sensorId, sSensor.name,
|
sensorId, sSensor.name,
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
charUuid.toString().c_str(), pAddress
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -701,7 +683,7 @@ protected:
|
|||||||
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
||||||
Log.straceln(
|
Log.straceln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found temp char (%s) in env service on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found temp char (%s) in env service on device %s"),
|
||||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
|
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
pChar->unsubscribe();
|
pChar->unsubscribe();
|
||||||
@@ -756,14 +738,14 @@ protected:
|
|||||||
Log.straceln(
|
Log.straceln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to temp char (%s) in env service on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to temp char (%s) in env service on device %s"),
|
||||||
sensorId, sSensor.name,
|
sensorId, sSensor.name,
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
charUuid.toString().c_str(), pAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.swarningln(
|
Log.swarningln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to temp char (%s) in env service on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to temp char (%s) in env service on device %s"),
|
||||||
sensorId, sSensor.name,
|
sensorId, sSensor.name,
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
charUuid.toString().c_str(), pAddress
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -772,7 +754,7 @@ protected:
|
|||||||
if (!tempNotifyCreated) {
|
if (!tempNotifyCreated) {
|
||||||
Log.swarningln(
|
Log.swarningln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported temp chars in env service on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported temp chars in env service on device %s"),
|
||||||
sensorId, sSensor.name, pAddress.c_str()
|
sensorId, sSensor.name, pAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
pClient->disconnect();
|
pClient->disconnect();
|
||||||
@@ -790,7 +772,7 @@ protected:
|
|||||||
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
||||||
Log.straceln(
|
Log.straceln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found humidity char (%s) in env service on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found humidity char (%s) in env service on device %s"),
|
||||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
|
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
pChar->unsubscribe();
|
pChar->unsubscribe();
|
||||||
@@ -845,14 +827,14 @@ protected:
|
|||||||
Log.straceln(
|
Log.straceln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to humidity char (%s) in env service on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to humidity char (%s) in env service on device %s"),
|
||||||
sensorId, sSensor.name,
|
sensorId, sSensor.name,
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
charUuid.toString().c_str(), pAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.swarningln(
|
Log.swarningln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to humidity char (%s) in env service on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to humidity char (%s) in env service on device %s"),
|
||||||
sensorId, sSensor.name,
|
sensorId, sSensor.name,
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
charUuid.toString().c_str(), pAddress
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -861,7 +843,7 @@ protected:
|
|||||||
if (!humidityNotifyCreated) {
|
if (!humidityNotifyCreated) {
|
||||||
Log.swarningln(
|
Log.swarningln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported humidity chars in env service on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported humidity chars in env service on device %s"),
|
||||||
sensorId, sSensor.name, pAddress.c_str()
|
sensorId, sSensor.name, pAddress
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -875,13 +857,13 @@ protected:
|
|||||||
if (!pService) {
|
if (!pService) {
|
||||||
Log.straceln(
|
Log.straceln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to find battery service (%s) on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to find battery service (%s) on device %s"),
|
||||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
|
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.straceln(
|
Log.straceln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found battery service (%s) on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found battery service (%s) on device %s"),
|
||||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
|
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
// 0x2A19 - Notify the battery charge level 0..99% (pvvx)
|
// 0x2A19 - Notify the battery charge level 0..99% (pvvx)
|
||||||
@@ -893,7 +875,7 @@ protected:
|
|||||||
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
||||||
Log.straceln(
|
Log.straceln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found battery char (%s) in battery service on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found battery char (%s) in battery service on device %s"),
|
||||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
|
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
pChar->unsubscribe();
|
pChar->unsubscribe();
|
||||||
@@ -948,14 +930,14 @@ protected:
|
|||||||
Log.straceln(
|
Log.straceln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to battery char (%s) in battery service on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to battery char (%s) in battery service on device %s"),
|
||||||
sensorId, sSensor.name,
|
sensorId, sSensor.name,
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
charUuid.toString().c_str(), pAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.swarningln(
|
Log.swarningln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to battery char (%s) in battery service on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to battery char (%s) in battery service on device %s"),
|
||||||
sensorId, sSensor.name,
|
sensorId, sSensor.name,
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
charUuid.toString().c_str(), pAddress
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -964,7 +946,7 @@ protected:
|
|||||||
if (!batteryNotifyCreated) {
|
if (!batteryNotifyCreated) {
|
||||||
Log.swarningln(
|
Log.swarningln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported battery chars in battery service on device %s"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported battery chars in battery service on device %s"),
|
||||||
sensorId, sSensor.name, pAddress.c_str()
|
sensorId, sSensor.name, pAddress
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1005,16 +987,12 @@ protected:
|
|||||||
} else if (rSensor.connected && sSensor.purpose == Sensors::Purpose::NOT_CONFIGURED) {
|
} else if (rSensor.connected && sSensor.purpose == Sensors::Purpose::NOT_CONFIGURED) {
|
||||||
Sensors::setConnectionStatusById(sensorId, false, false);
|
Sensors::setConnectionStatusById(sensorId, false, false);
|
||||||
|
|
||||||
} else if (rSensor.connected) {
|
} else if (sSensor.type != Sensors::Type::MANUAL && rSensor.connected && (millis() - rSensor.activityTime) > this->disconnectedTimeout) {
|
||||||
if (sSensor.type == Sensors::Type::MANUAL || sSensor.type == Sensors::Type::BLUETOOTH) {
|
|
||||||
if ((millis() - rSensor.activityTime) > this->wirelessDisconnectTimeout) {
|
|
||||||
Sensors::setConnectionStatusById(sensorId, false, false);
|
Sensors::setConnectionStatusById(sensorId, false, false);
|
||||||
}
|
|
||||||
|
|
||||||
} else if ((millis() - rSensor.activityTime) > this->wiredDisconnectTimeout) {
|
}/* else if (!rSensor.connected) {
|
||||||
Sensors::setConnectionStatusById(sensorId, false, false);
|
rSensor.connected = true;
|
||||||
}
|
}*/
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+19
-51
@@ -1,5 +1,3 @@
|
|||||||
// NetworkSettings struct is append-only. The file is persisted across updates,
|
|
||||||
// and removing/modifying existing keys will lead to file corruption.
|
|
||||||
struct NetworkSettings {
|
struct NetworkSettings {
|
||||||
char hostname[25] = DEFAULT_HOSTNAME;
|
char hostname[25] = DEFAULT_HOSTNAME;
|
||||||
bool useDhcp = true;
|
bool useDhcp = true;
|
||||||
@@ -14,30 +12,14 @@ struct NetworkSettings {
|
|||||||
struct {
|
struct {
|
||||||
char ssid[33] = DEFAULT_AP_SSID;
|
char ssid[33] = DEFAULT_AP_SSID;
|
||||||
char password[65] = DEFAULT_AP_PASSWORD;
|
char password[65] = DEFAULT_AP_PASSWORD;
|
||||||
uint8_t channel = 6;
|
byte channel = 6;
|
||||||
} ap;
|
} ap;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
char ssid[33] = DEFAULT_STA_SSID;
|
char ssid[33] = DEFAULT_STA_SSID;
|
||||||
char password[65] = DEFAULT_STA_PASSWORD;
|
char password[65] = DEFAULT_STA_PASSWORD;
|
||||||
uint8_t channel = 0;
|
byte channel = 0;
|
||||||
} sta;
|
} sta;
|
||||||
|
|
||||||
struct {
|
|
||||||
bool enabled = DEFAULT_ETHERNET_ENABLED;
|
|
||||||
|
|
||||||
// nothing reads this yet: the W5500 is the only implementation the firmware can drive
|
|
||||||
EthernetImplementation implementation = EthernetImplementation::W5500;
|
|
||||||
|
|
||||||
struct {
|
|
||||||
uint8_t clk = DEFAULT_ETH_CLK_GPIO;
|
|
||||||
uint8_t mosi = DEFAULT_ETH_MOSI_GPIO;
|
|
||||||
uint8_t miso = DEFAULT_ETH_MISO_GPIO;
|
|
||||||
uint8_t cs = DEFAULT_ETH_CS_GPIO;
|
|
||||||
uint8_t irq = DEFAULT_ETH_IRQ_GPIO;
|
|
||||||
uint8_t rst = DEFAULT_ETH_RST_GPIO;
|
|
||||||
} w5500;
|
|
||||||
} ethernet;
|
|
||||||
} networkSettings;
|
} networkSettings;
|
||||||
|
|
||||||
struct Settings {
|
struct Settings {
|
||||||
@@ -60,7 +42,7 @@ struct Settings {
|
|||||||
} ntp;
|
} ntp;
|
||||||
|
|
||||||
UnitSystem unitSystem = UnitSystem::METRIC;
|
UnitSystem unitSystem = UnitSystem::METRIC;
|
||||||
uint8_t statusLedGpio = DEFAULT_STATUS_LED_GPIO;
|
byte statusLedGpio = DEFAULT_STATUS_LED_GPIO;
|
||||||
} system;
|
} system;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@@ -72,9 +54,9 @@ struct Settings {
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
UnitSystem unitSystem = UnitSystem::METRIC;
|
UnitSystem unitSystem = UnitSystem::METRIC;
|
||||||
uint8_t inGpio = DEFAULT_OT_IN_GPIO;
|
byte inGpio = DEFAULT_OT_IN_GPIO;
|
||||||
uint8_t outGpio = DEFAULT_OT_OUT_GPIO;
|
byte outGpio = DEFAULT_OT_OUT_GPIO;
|
||||||
uint8_t rxLedGpio = DEFAULT_OT_RX_LED_GPIO;
|
byte rxLedGpio = DEFAULT_OT_RX_LED_GPIO;
|
||||||
uint8_t memberId = 0;
|
uint8_t memberId = 0;
|
||||||
uint8_t flags = 0;
|
uint8_t flags = 0;
|
||||||
float minPower = 0.0f;
|
float minPower = 0.0f;
|
||||||
@@ -96,8 +78,7 @@ struct Settings {
|
|||||||
bool autoFaultReset = false;
|
bool autoFaultReset = false;
|
||||||
bool autoDiagReset = false;
|
bool autoDiagReset = false;
|
||||||
bool setDateAndTime = false;
|
bool setDateAndTime = false;
|
||||||
bool alwaysSendIndoorTemp = true;
|
bool nativeHeatingControl = false;
|
||||||
bool nativeOTC = false;
|
|
||||||
bool immergasFix = false;
|
bool immergasFix = false;
|
||||||
} options;
|
} options;
|
||||||
} opentherm;
|
} opentherm;
|
||||||
@@ -122,33 +103,28 @@ struct Settings {
|
|||||||
bool enabled = true;
|
bool enabled = true;
|
||||||
bool turbo = false;
|
bool turbo = false;
|
||||||
float target = DEFAULT_HEATING_TARGET_TEMP;
|
float target = DEFAULT_HEATING_TARGET_TEMP;
|
||||||
|
float hysteresis = 0.5f;
|
||||||
float turboFactor = 7.5f;
|
float turboFactor = 7.5f;
|
||||||
uint8_t minTemp = DEFAULT_HEATING_MIN_TEMP;
|
byte minTemp = DEFAULT_HEATING_MIN_TEMP;
|
||||||
uint8_t maxTemp = DEFAULT_HEATING_MAX_TEMP;
|
byte maxTemp = DEFAULT_HEATING_MAX_TEMP;
|
||||||
uint8_t maxModulation = 100;
|
uint8_t maxModulation = 100;
|
||||||
|
|
||||||
struct {
|
|
||||||
bool enabled = true;
|
|
||||||
float value = 0.5f;
|
|
||||||
HysteresisAction action = HysteresisAction::DISABLE_HEATING;
|
|
||||||
} hysteresis;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint8_t highTemp = 95;
|
uint8_t highTemp = 95;
|
||||||
uint8_t lowTemp = 90;
|
uint8_t lowTemp = 90;
|
||||||
} overheatProtection;
|
} overheatProtection;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint8_t highTemp = 15;
|
|
||||||
uint8_t lowTemp = 10;
|
uint8_t lowTemp = 10;
|
||||||
|
unsigned short thresholdTime = 600;
|
||||||
} freezeProtection;
|
} freezeProtection;
|
||||||
} heating;
|
} heating;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool enabled = true;
|
bool enabled = true;
|
||||||
float target = DEFAULT_DHW_TARGET_TEMP;
|
float target = DEFAULT_DHW_TARGET_TEMP;
|
||||||
uint8_t minTemp = DEFAULT_DHW_MIN_TEMP;
|
byte minTemp = DEFAULT_DHW_MIN_TEMP;
|
||||||
uint8_t maxTemp = DEFAULT_DHW_MAX_TEMP;
|
byte maxTemp = DEFAULT_DHW_MAX_TEMP;
|
||||||
uint8_t maxModulation = 100;
|
uint8_t maxModulation = 100;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@@ -186,8 +162,7 @@ struct Settings {
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool use = false;
|
bool use = false;
|
||||||
uint8_t gpio = DEFAULT_EXT_PUMP_GPIO;
|
byte gpio = DEFAULT_EXT_PUMP_GPIO;
|
||||||
bool invertState = false;
|
|
||||||
unsigned short postCirculationTime = 600;
|
unsigned short postCirculationTime = 600;
|
||||||
unsigned int antiStuckInterval = 2592000;
|
unsigned int antiStuckInterval = 2592000;
|
||||||
unsigned short antiStuckTime = 300;
|
unsigned short antiStuckTime = 300;
|
||||||
@@ -196,15 +171,15 @@ struct Settings {
|
|||||||
struct {
|
struct {
|
||||||
struct {
|
struct {
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
uint8_t gpio = GPIO_IS_NOT_CONFIGURED;
|
byte gpio = GPIO_IS_NOT_CONFIGURED;
|
||||||
bool invertState = false;
|
byte invertState = false;
|
||||||
unsigned short thresholdTime = 60;
|
unsigned short thresholdTime = 60;
|
||||||
} input;
|
} input;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
uint8_t gpio = GPIO_IS_NOT_CONFIGURED;
|
byte gpio = GPIO_IS_NOT_CONFIGURED;
|
||||||
bool invertState = false;
|
byte invertState = false;
|
||||||
unsigned short thresholdTime = 60;
|
unsigned short thresholdTime = 60;
|
||||||
bool onFault = true;
|
bool onFault = true;
|
||||||
bool onLossConnection = true;
|
bool onLossConnection = true;
|
||||||
@@ -290,7 +265,6 @@ struct Variables {
|
|||||||
struct {
|
struct {
|
||||||
bool connected = false;
|
bool connected = false;
|
||||||
int8_t rssi = 0;
|
int8_t rssi = 0;
|
||||||
NetworkUtils::NetworkMgr::Uplink connectionType = NetworkUtils::NetworkMgr::Uplink::None;
|
|
||||||
} network;
|
} network;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
@@ -323,7 +297,6 @@ struct Variables {
|
|||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
bool indoorTempControl = false;
|
bool indoorTempControl = false;
|
||||||
bool overheat = false;
|
bool overheat = false;
|
||||||
bool freezing = false;
|
|
||||||
float setpointTemp = 0.0f;
|
float setpointTemp = 0.0f;
|
||||||
float targetTemp = 0.0f;
|
float targetTemp = 0.0f;
|
||||||
float currentTemp = 0.0f;
|
float currentTemp = 0.0f;
|
||||||
@@ -357,14 +330,10 @@ struct Variables {
|
|||||||
|
|
||||||
bool connected = false;
|
bool connected = false;
|
||||||
bool flame = false;
|
bool flame = false;
|
||||||
|
bool cooling = false;
|
||||||
float pressure = 0.0f;
|
float pressure = 0.0f;
|
||||||
float heatExchangerTemp = 0.0f;
|
float heatExchangerTemp = 0.0f;
|
||||||
|
|
||||||
struct {
|
|
||||||
bool active = false;
|
|
||||||
uint8_t setpoint = 0;
|
|
||||||
} cooling;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool active = false;
|
bool active = false;
|
||||||
uint8_t code = 0;
|
uint8_t code = 0;
|
||||||
@@ -409,7 +378,6 @@ struct Variables {
|
|||||||
uint16_t dhwBurnerStarts = 0;
|
uint16_t dhwBurnerStarts = 0;
|
||||||
uint16_t heatingPumpStarts = 0;
|
uint16_t heatingPumpStarts = 0;
|
||||||
uint16_t dhwPumpStarts = 0;
|
uint16_t dhwPumpStarts = 0;
|
||||||
uint16_t coolingHours = 0;
|
|
||||||
uint16_t burnerHours = 0;
|
uint16_t burnerHours = 0;
|
||||||
uint16_t dhwBurnerHours = 0;
|
uint16_t dhwBurnerHours = 0;
|
||||||
uint16_t heatingPumpHours = 0;
|
uint16_t heatingPumpHours = 0;
|
||||||
|
|||||||
@@ -54,11 +54,6 @@
|
|||||||
#define USE_BLE false
|
#define USE_BLE false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ethernet (W5500 over SPI) is only validated on the esp32_c6 target: off everywhere else
|
|
||||||
#ifndef USE_ETHERNET
|
|
||||||
#define USE_ETHERNET false
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DEFAULT_HOSTNAME
|
#ifndef DEFAULT_HOSTNAME
|
||||||
#define DEFAULT_HOSTNAME ""
|
#define DEFAULT_HOSTNAME ""
|
||||||
#endif
|
#endif
|
||||||
@@ -87,34 +82,6 @@
|
|||||||
#define DEFAULT_STATUS_LED_GPIO GPIO_IS_NOT_CONFIGURED
|
#define DEFAULT_STATUS_LED_GPIO GPIO_IS_NOT_CONFIGURED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DEFAULT_ETHERNET_ENABLED
|
|
||||||
#define DEFAULT_ETHERNET_ENABLED false
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DEFAULT_ETH_CLK_GPIO
|
|
||||||
#define DEFAULT_ETH_CLK_GPIO GPIO_IS_NOT_CONFIGURED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DEFAULT_ETH_MOSI_GPIO
|
|
||||||
#define DEFAULT_ETH_MOSI_GPIO GPIO_IS_NOT_CONFIGURED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DEFAULT_ETH_MISO_GPIO
|
|
||||||
#define DEFAULT_ETH_MISO_GPIO GPIO_IS_NOT_CONFIGURED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DEFAULT_ETH_CS_GPIO
|
|
||||||
#define DEFAULT_ETH_CS_GPIO GPIO_IS_NOT_CONFIGURED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DEFAULT_ETH_IRQ_GPIO
|
|
||||||
#define DEFAULT_ETH_IRQ_GPIO GPIO_IS_NOT_CONFIGURED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DEFAULT_ETH_RST_GPIO
|
|
||||||
#define DEFAULT_ETH_RST_GPIO GPIO_IS_NOT_CONFIGURED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DEFAULT_PORTAL_LOGIN
|
#ifndef DEFAULT_PORTAL_LOGIN
|
||||||
#define DEFAULT_PORTAL_LOGIN ""
|
#define DEFAULT_PORTAL_LOGIN ""
|
||||||
#endif
|
#endif
|
||||||
@@ -196,14 +163,4 @@ enum class UnitSystem : uint8_t {
|
|||||||
IMPERIAL = 1
|
IMPERIAL = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class HysteresisAction : uint8_t {
|
|
||||||
DISABLE_HEATING = 0,
|
|
||||||
SET_ZERO_TARGET = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class EthernetImplementation : uint8_t {
|
|
||||||
NONE = 0,
|
|
||||||
W5500 = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
char buffer[255];
|
char buffer[255];
|
||||||
@@ -84,9 +84,6 @@ void setup() {
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Network settings
|
// Network settings
|
||||||
// The network file has to survive updates, this ensures it doesn't get wiped when the structure is modified
|
|
||||||
fsNetworkSettings.addWithoutWipe(true);
|
|
||||||
|
|
||||||
switch (fsNetworkSettings.read()) {
|
switch (fsNetworkSettings.read()) {
|
||||||
case FD_FS_ERR:
|
case FD_FS_ERR:
|
||||||
Log.swarningln(FPSTR(L_NETWORK_SETTINGS), F("Filesystem error, load default"));
|
Log.swarningln(FPSTR(L_NETWORK_SETTINGS), F("Filesystem error, load default"));
|
||||||
@@ -157,18 +154,6 @@ void setup() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ethernet (W5500) is configured from the network settings, after they are loaded
|
|
||||||
network
|
|
||||||
->setEthernet(networkSettings.ethernet.enabled)
|
|
||||||
->setEthernetPins(
|
|
||||||
networkSettings.ethernet.w5500.clk,
|
|
||||||
networkSettings.ethernet.w5500.mosi,
|
|
||||||
networkSettings.ethernet.w5500.miso,
|
|
||||||
networkSettings.ethernet.w5500.cs,
|
|
||||||
networkSettings.ethernet.w5500.irq,
|
|
||||||
networkSettings.ethernet.w5500.rst
|
|
||||||
);
|
|
||||||
|
|
||||||
// generate mqtt prefix if it is empty
|
// generate mqtt prefix if it is empty
|
||||||
if (!strlen(settings.mqtt.prefix)) {
|
if (!strlen(settings.mqtt.prefix)) {
|
||||||
strcpy(settings.mqtt.prefix, getChipId("otgateway_").c_str());
|
strcpy(settings.mqtt.prefix, getChipId("otgateway_").c_str());
|
||||||
|
|||||||
+1
-18
@@ -34,7 +34,6 @@ const char L_CASCADE_OUTPUT[] PROGMEM = "CASCADE.OUTPUT";
|
|||||||
const char L_EXTPUMP[] PROGMEM = "EXTPUMP";
|
const char L_EXTPUMP[] PROGMEM = "EXTPUMP";
|
||||||
|
|
||||||
|
|
||||||
const char S_ACTION[] PROGMEM = "action";
|
|
||||||
const char S_ACTIONS[] PROGMEM = "actions";
|
const char S_ACTIONS[] PROGMEM = "actions";
|
||||||
const char S_ACTIVE[] PROGMEM = "active";
|
const char S_ACTIVE[] PROGMEM = "active";
|
||||||
const char S_ADDRESS[] PROGMEM = "address";
|
const char S_ADDRESS[] PROGMEM = "address";
|
||||||
@@ -48,7 +47,6 @@ const char S_AUTO_FAULT_RESET[] PROGMEM = "autoFaultReset";
|
|||||||
const char S_BACKTRACE[] PROGMEM = "backtrace";
|
const char S_BACKTRACE[] PROGMEM = "backtrace";
|
||||||
const char S_BATTERY[] PROGMEM = "battery";
|
const char S_BATTERY[] PROGMEM = "battery";
|
||||||
const char S_BAUDRATE[] PROGMEM = "baudrate";
|
const char S_BAUDRATE[] PROGMEM = "baudrate";
|
||||||
const char S_BLE[] PROGMEM = "ble";
|
|
||||||
const char S_BLOCKING[] PROGMEM = "blocking";
|
const char S_BLOCKING[] PROGMEM = "blocking";
|
||||||
const char S_BSSID[] PROGMEM = "bssid";
|
const char S_BSSID[] PROGMEM = "bssid";
|
||||||
const char S_BUILD[] PROGMEM = "build";
|
const char S_BUILD[] PROGMEM = "build";
|
||||||
@@ -56,18 +54,14 @@ const char S_CASCADE_CONTROL[] PROGMEM = "cascadeControl";
|
|||||||
const char S_CHANNEL[] PROGMEM = "channel";
|
const char S_CHANNEL[] PROGMEM = "channel";
|
||||||
const char S_CH2_ALWAYS_ENABLED[] PROGMEM = "ch2AlwaysEnabled";
|
const char S_CH2_ALWAYS_ENABLED[] PROGMEM = "ch2AlwaysEnabled";
|
||||||
const char S_CHIP[] PROGMEM = "chip";
|
const char S_CHIP[] PROGMEM = "chip";
|
||||||
const char S_CLK[] PROGMEM = "clk";
|
|
||||||
const char S_CODE[] PROGMEM = "code";
|
const char S_CODE[] PROGMEM = "code";
|
||||||
const char S_CONNECTED[] PROGMEM = "connected";
|
const char S_CONNECTED[] PROGMEM = "connected";
|
||||||
const char S_CONFIGURED[] PROGMEM = "configured";
|
|
||||||
const char S_CONNECTION_TYPE[] PROGMEM = "connectionType";
|
|
||||||
const char S_CONTINUES[] PROGMEM = "continues";
|
const char S_CONTINUES[] PROGMEM = "continues";
|
||||||
const char S_COOLING[] PROGMEM = "cooling";
|
const char S_COOLING[] PROGMEM = "cooling";
|
||||||
const char S_COOLING_SUPPORT[] PROGMEM = "coolingSupport";
|
const char S_COOLING_SUPPORT[] PROGMEM = "coolingSupport";
|
||||||
const char S_CORE[] PROGMEM = "core";
|
const char S_CORE[] PROGMEM = "core";
|
||||||
const char S_CORES[] PROGMEM = "cores";
|
const char S_CORES[] PROGMEM = "cores";
|
||||||
const char S_CRASH[] PROGMEM = "crash";
|
const char S_CRASH[] PROGMEM = "crash";
|
||||||
const char S_CS[] PROGMEM = "cs";
|
|
||||||
const char S_CURRENT_TEMP[] PROGMEM = "currentTemp";
|
const char S_CURRENT_TEMP[] PROGMEM = "currentTemp";
|
||||||
const char S_DATA[] PROGMEM = "data";
|
const char S_DATA[] PROGMEM = "data";
|
||||||
const char S_DATE[] PROGMEM = "date";
|
const char S_DATE[] PROGMEM = "date";
|
||||||
@@ -87,14 +81,11 @@ const char S_ENABLED[] PROGMEM = "enabled";
|
|||||||
const char S_ENV[] PROGMEM = "env";
|
const char S_ENV[] PROGMEM = "env";
|
||||||
const char S_EPC[] PROGMEM = "epc";
|
const char S_EPC[] PROGMEM = "epc";
|
||||||
const char S_EQUITHERM[] PROGMEM = "equitherm";
|
const char S_EQUITHERM[] PROGMEM = "equitherm";
|
||||||
const char S_ETHERNET[] PROGMEM = "ethernet";
|
|
||||||
const char S_EXPONENT[] PROGMEM = "exponent";
|
const char S_EXPONENT[] PROGMEM = "exponent";
|
||||||
const char S_EXTERNAL_PUMP[] PROGMEM = "externalPump";
|
const char S_EXTERNAL_PUMP[] PROGMEM = "externalPump";
|
||||||
const char S_FACTOR[] PROGMEM = "factor";
|
const char S_FACTOR[] PROGMEM = "factor";
|
||||||
const char S_FAULT[] PROGMEM = "fault";
|
const char S_FAULT[] PROGMEM = "fault";
|
||||||
const char S_FEATURES[] PROGMEM = "features";
|
|
||||||
const char S_FREEZE_PROTECTION[] PROGMEM = "freezeProtection";
|
const char S_FREEZE_PROTECTION[] PROGMEM = "freezeProtection";
|
||||||
const char S_FREEZING[] PROGMEM = "freezing";
|
|
||||||
const char S_FILTERING[] PROGMEM = "filtering";
|
const char S_FILTERING[] PROGMEM = "filtering";
|
||||||
const char S_FILTERING_FACTOR[] PROGMEM = "filteringFactor";
|
const char S_FILTERING_FACTOR[] PROGMEM = "filteringFactor";
|
||||||
const char S_FLAGS[] PROGMEM = "flags";
|
const char S_FLAGS[] PROGMEM = "flags";
|
||||||
@@ -118,7 +109,6 @@ const char S_HYSTERESIS[] PROGMEM = "hysteresis";
|
|||||||
const char S_ID[] PROGMEM = "id";
|
const char S_ID[] PROGMEM = "id";
|
||||||
const char S_IGNORE_DIAG_STATE[] PROGMEM = "ignoreDiagState";
|
const char S_IGNORE_DIAG_STATE[] PROGMEM = "ignoreDiagState";
|
||||||
const char S_IMMERGAS_FIX[] PROGMEM = "immergasFix";
|
const char S_IMMERGAS_FIX[] PROGMEM = "immergasFix";
|
||||||
const char S_ALWAYS_SEND_INDOOR_TEMP[] PROGMEM = "alwaysSendIndoorTemp";
|
|
||||||
const char S_INDOOR_TEMP[] PROGMEM = "indoorTemp";
|
const char S_INDOOR_TEMP[] PROGMEM = "indoorTemp";
|
||||||
const char S_INDOOR_TEMP_CONTROL[] PROGMEM = "indoorTempControl";
|
const char S_INDOOR_TEMP_CONTROL[] PROGMEM = "indoorTempControl";
|
||||||
const char S_IN_GPIO[] PROGMEM = "inGpio";
|
const char S_IN_GPIO[] PROGMEM = "inGpio";
|
||||||
@@ -126,7 +116,6 @@ const char S_INPUT[] PROGMEM = "input";
|
|||||||
const char S_INTERVAL[] PROGMEM = "interval";
|
const char S_INTERVAL[] PROGMEM = "interval";
|
||||||
const char S_INVERT_STATE[] PROGMEM = "invertState";
|
const char S_INVERT_STATE[] PROGMEM = "invertState";
|
||||||
const char S_IP[] PROGMEM = "ip";
|
const char S_IP[] PROGMEM = "ip";
|
||||||
const char S_IRQ[] PROGMEM = "irq";
|
|
||||||
const char S_I_FACTOR[] PROGMEM = "i_factor";
|
const char S_I_FACTOR[] PROGMEM = "i_factor";
|
||||||
const char S_I_MULTIPLIER[] PROGMEM = "i_multiplier";
|
const char S_I_MULTIPLIER[] PROGMEM = "i_multiplier";
|
||||||
const char S_LOGIN[] PROGMEM = "login";
|
const char S_LOGIN[] PROGMEM = "login";
|
||||||
@@ -147,13 +136,11 @@ const char S_MIN_FREE[] PROGMEM = "minFree";
|
|||||||
const char S_MIN_MAX_FREE_BLOCK[] PROGMEM = "minMaxFreeBlock";
|
const char S_MIN_MAX_FREE_BLOCK[] PROGMEM = "minMaxFreeBlock";
|
||||||
const char S_MIN_POWER[] PROGMEM = "minPower";
|
const char S_MIN_POWER[] PROGMEM = "minPower";
|
||||||
const char S_MIN_TEMP[] PROGMEM = "minTemp";
|
const char S_MIN_TEMP[] PROGMEM = "minTemp";
|
||||||
const char S_MISO[] PROGMEM = "miso";
|
|
||||||
const char S_MODEL[] PROGMEM = "model";
|
const char S_MODEL[] PROGMEM = "model";
|
||||||
const char S_MOSI[] PROGMEM = "mosi";
|
|
||||||
const char S_MODULATION[] PROGMEM = "modulation";
|
const char S_MODULATION[] PROGMEM = "modulation";
|
||||||
const char S_MQTT[] PROGMEM = "mqtt";
|
const char S_MQTT[] PROGMEM = "mqtt";
|
||||||
const char S_NAME[] PROGMEM = "name";
|
const char S_NAME[] PROGMEM = "name";
|
||||||
const char S_NATIVE_OTC[] PROGMEM = "nativeOTC";
|
const char S_NATIVE_HEATING_CONTROL[] PROGMEM = "nativeHeatingControl";
|
||||||
const char S_NETWORK[] PROGMEM = "network";
|
const char S_NETWORK[] PROGMEM = "network";
|
||||||
const char S_NTP[] PROGMEM = "ntp";
|
const char S_NTP[] PROGMEM = "ntp";
|
||||||
const char S_OFFSET[] PROGMEM = "offset";
|
const char S_OFFSET[] PROGMEM = "offset";
|
||||||
@@ -170,7 +157,6 @@ const char S_OVERHEAT_PROTECTION[] PROGMEM = "overheatProtectio
|
|||||||
const char S_PASSWORD[] PROGMEM = "password";
|
const char S_PASSWORD[] PROGMEM = "password";
|
||||||
const char S_PID[] PROGMEM = "pid";
|
const char S_PID[] PROGMEM = "pid";
|
||||||
const char S_PORT[] PROGMEM = "port";
|
const char S_PORT[] PROGMEM = "port";
|
||||||
const char S_PINS[] PROGMEM = "pins";
|
|
||||||
const char S_PORTAL[] PROGMEM = "portal";
|
const char S_PORTAL[] PROGMEM = "portal";
|
||||||
const char S_POST_CIRCULATION_TIME[] PROGMEM = "postCirculationTime";
|
const char S_POST_CIRCULATION_TIME[] PROGMEM = "postCirculationTime";
|
||||||
const char S_POWER[] PROGMEM = "power";
|
const char S_POWER[] PROGMEM = "power";
|
||||||
@@ -188,7 +174,6 @@ const char S_RESTART[] PROGMEM = "restart";
|
|||||||
const char S_RETURN_TEMP[] PROGMEM = "returnTemp";
|
const char S_RETURN_TEMP[] PROGMEM = "returnTemp";
|
||||||
const char S_REV[] PROGMEM = "rev";
|
const char S_REV[] PROGMEM = "rev";
|
||||||
const char S_RSSI[] PROGMEM = "rssi";
|
const char S_RSSI[] PROGMEM = "rssi";
|
||||||
const char S_RST[] PROGMEM = "rst";
|
|
||||||
const char S_RX_LED_GPIO[] PROGMEM = "rxLedGpio";
|
const char S_RX_LED_GPIO[] PROGMEM = "rxLedGpio";
|
||||||
const char S_SDK[] PROGMEM = "sdk";
|
const char S_SDK[] PROGMEM = "sdk";
|
||||||
const char S_SENSORS[] PROGMEM = "sensors";
|
const char S_SENSORS[] PROGMEM = "sensors";
|
||||||
@@ -202,12 +187,10 @@ const char S_SIZE[] PROGMEM = "size";
|
|||||||
const char S_SLAVE[] PROGMEM = "slave";
|
const char S_SLAVE[] PROGMEM = "slave";
|
||||||
const char S_SLOPE[] PROGMEM = "slope";
|
const char S_SLOPE[] PROGMEM = "slope";
|
||||||
const char S_SSID[] PROGMEM = "ssid";
|
const char S_SSID[] PROGMEM = "ssid";
|
||||||
const char S_STARTED[] PROGMEM = "started";
|
|
||||||
const char S_STA[] PROGMEM = "sta";
|
const char S_STA[] PROGMEM = "sta";
|
||||||
const char S_STATE[] PROGMEM = "state";
|
const char S_STATE[] PROGMEM = "state";
|
||||||
const char S_STATIC_CONFIG[] PROGMEM = "staticConfig";
|
const char S_STATIC_CONFIG[] PROGMEM = "staticConfig";
|
||||||
const char S_STATUS_LED_GPIO[] PROGMEM = "statusLedGpio";
|
const char S_STATUS_LED_GPIO[] PROGMEM = "statusLedGpio";
|
||||||
const char S_SETPOINT[] PROGMEM = "setpoint";
|
|
||||||
const char S_SETPOINT_TEMP[] PROGMEM = "setpointTemp";
|
const char S_SETPOINT_TEMP[] PROGMEM = "setpointTemp";
|
||||||
const char S_SUBNET[] PROGMEM = "subnet";
|
const char S_SUBNET[] PROGMEM = "subnet";
|
||||||
const char S_SUMMER_WINTER_MODE[] PROGMEM = "summerWinterMode";
|
const char S_SUMMER_WINTER_MODE[] PROGMEM = "summerWinterMode";
|
||||||
|
|||||||
+44
-191
@@ -72,7 +72,7 @@ time_t mkgmtime(const struct tm *ptm) {
|
|||||||
|
|
||||||
inline bool isDigit(const char* ptr) {
|
inline bool isDigit(const char* ptr) {
|
||||||
char* endPtr;
|
char* endPtr;
|
||||||
auto tmp = strtol(ptr, &endPtr, 10);
|
strtol(ptr, &endPtr, 10);
|
||||||
return *endPtr == 0;
|
return *endPtr == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,24 +296,8 @@ void networkSettingsToJson(const NetworkSettings& src, JsonVariant dst) {
|
|||||||
dst[FPSTR(S_STA)][FPSTR(S_SSID)] = src.sta.ssid;
|
dst[FPSTR(S_STA)][FPSTR(S_SSID)] = src.sta.ssid;
|
||||||
dst[FPSTR(S_STA)][FPSTR(S_PASSWORD)] = src.sta.password;
|
dst[FPSTR(S_STA)][FPSTR(S_PASSWORD)] = src.sta.password;
|
||||||
dst[FPSTR(S_STA)][FPSTR(S_CHANNEL)] = src.sta.channel;
|
dst[FPSTR(S_STA)][FPSTR(S_CHANNEL)] = src.sta.channel;
|
||||||
|
|
||||||
#if USE_ETHERNET
|
|
||||||
auto ethernet = dst[FPSTR(S_ETHERNET)].to<JsonObject>();
|
|
||||||
|
|
||||||
ethernet[FPSTR(S_ENABLED)] = src.ethernet.enabled;
|
|
||||||
|
|
||||||
auto pins = ethernet[FPSTR(S_PINS)].to<JsonObject>();
|
|
||||||
pins[FPSTR(S_CLK)] = src.ethernet.w5500.clk;
|
|
||||||
pins[FPSTR(S_MOSI)] = src.ethernet.w5500.mosi;
|
|
||||||
pins[FPSTR(S_MISO)] = src.ethernet.w5500.miso;
|
|
||||||
pins[FPSTR(S_CS)] = src.ethernet.w5500.cs;
|
|
||||||
pins[FPSTR(S_IRQ)] = src.ethernet.w5500.irq;
|
|
||||||
pins[FPSTR(S_RST)] = src.ethernet.w5500.rst;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool jsonToEthernetPins(const JsonVariantConst src, NetworkSettings& dst, bool& changed);
|
|
||||||
|
|
||||||
bool jsonToNetworkSettings(const JsonVariantConst src, NetworkSettings& dst) {
|
bool jsonToNetworkSettings(const JsonVariantConst src, NetworkSettings& dst) {
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
@@ -429,19 +413,6 @@ bool jsonToNetworkSettings(const JsonVariantConst src, NetworkSettings& dst) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ethernet
|
|
||||||
if (src[FPSTR(S_ETHERNET)][FPSTR(S_ENABLED)].is<bool>()) {
|
|
||||||
bool value = src[FPSTR(S_ETHERNET)][FPSTR(S_ENABLED)].as<bool>();
|
|
||||||
|
|
||||||
if (value != dst.ethernet.enabled) {
|
|
||||||
dst.ethernet.enabled = value;
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jsonToEthernetPins(src[FPSTR(S_ETHERNET)][FPSTR(S_PINS)], dst, changed);
|
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,11 +468,9 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
|
|||||||
otOptions[FPSTR(S_AUTO_FAULT_RESET)] = src.opentherm.options.autoFaultReset;
|
otOptions[FPSTR(S_AUTO_FAULT_RESET)] = src.opentherm.options.autoFaultReset;
|
||||||
otOptions[FPSTR(S_AUTO_DIAG_RESET)] = src.opentherm.options.autoDiagReset;
|
otOptions[FPSTR(S_AUTO_DIAG_RESET)] = src.opentherm.options.autoDiagReset;
|
||||||
otOptions[FPSTR(S_SET_DATE_AND_TIME)] = src.opentherm.options.setDateAndTime;
|
otOptions[FPSTR(S_SET_DATE_AND_TIME)] = src.opentherm.options.setDateAndTime;
|
||||||
otOptions[FPSTR(S_ALWAYS_SEND_INDOOR_TEMP)] = src.opentherm.options.alwaysSendIndoorTemp;
|
otOptions[FPSTR(S_NATIVE_HEATING_CONTROL)] = src.opentherm.options.nativeHeatingControl;
|
||||||
otOptions[FPSTR(S_NATIVE_OTC)] = src.opentherm.options.nativeOTC;
|
|
||||||
otOptions[FPSTR(S_IMMERGAS_FIX)] = src.opentherm.options.immergasFix;
|
otOptions[FPSTR(S_IMMERGAS_FIX)] = src.opentherm.options.immergasFix;
|
||||||
|
|
||||||
|
|
||||||
auto mqtt = dst[FPSTR(S_MQTT)].to<JsonObject>();
|
auto mqtt = dst[FPSTR(S_MQTT)].to<JsonObject>();
|
||||||
mqtt[FPSTR(S_ENABLED)] = src.mqtt.enabled;
|
mqtt[FPSTR(S_ENABLED)] = src.mqtt.enabled;
|
||||||
mqtt[FPSTR(S_SERVER)] = src.mqtt.server;
|
mqtt[FPSTR(S_SERVER)] = src.mqtt.server;
|
||||||
@@ -521,9 +490,7 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
|
|||||||
heating[FPSTR(S_ENABLED)] = src.heating.enabled;
|
heating[FPSTR(S_ENABLED)] = src.heating.enabled;
|
||||||
heating[FPSTR(S_TURBO)] = src.heating.turbo;
|
heating[FPSTR(S_TURBO)] = src.heating.turbo;
|
||||||
heating[FPSTR(S_TARGET)] = roundf(src.heating.target, 2);
|
heating[FPSTR(S_TARGET)] = roundf(src.heating.target, 2);
|
||||||
heating[FPSTR(S_HYSTERESIS)][FPSTR(S_ENABLED)] = src.heating.hysteresis.enabled;
|
heating[FPSTR(S_HYSTERESIS)] = roundf(src.heating.hysteresis, 3);
|
||||||
heating[FPSTR(S_HYSTERESIS)][FPSTR(S_VALUE)] = roundf(src.heating.hysteresis.value, 3);
|
|
||||||
heating[FPSTR(S_HYSTERESIS)][FPSTR(S_ACTION)] = static_cast<uint8_t>(src.heating.hysteresis.action);
|
|
||||||
heating[FPSTR(S_TURBO_FACTOR)] = roundf(src.heating.turboFactor, 3);
|
heating[FPSTR(S_TURBO_FACTOR)] = roundf(src.heating.turboFactor, 3);
|
||||||
heating[FPSTR(S_MIN_TEMP)] = src.heating.minTemp;
|
heating[FPSTR(S_MIN_TEMP)] = src.heating.minTemp;
|
||||||
heating[FPSTR(S_MAX_TEMP)] = src.heating.maxTemp;
|
heating[FPSTR(S_MAX_TEMP)] = src.heating.maxTemp;
|
||||||
@@ -534,8 +501,8 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
|
|||||||
heatingOverheatProtection[FPSTR(S_LOW_TEMP)] = src.heating.overheatProtection.lowTemp;
|
heatingOverheatProtection[FPSTR(S_LOW_TEMP)] = src.heating.overheatProtection.lowTemp;
|
||||||
|
|
||||||
auto freezeProtection = heating[FPSTR(S_FREEZE_PROTECTION)].to<JsonObject>();
|
auto freezeProtection = heating[FPSTR(S_FREEZE_PROTECTION)].to<JsonObject>();
|
||||||
freezeProtection[FPSTR(S_HIGH_TEMP)] = src.heating.freezeProtection.highTemp;
|
|
||||||
freezeProtection[FPSTR(S_LOW_TEMP)] = src.heating.freezeProtection.lowTemp;
|
freezeProtection[FPSTR(S_LOW_TEMP)] = src.heating.freezeProtection.lowTemp;
|
||||||
|
freezeProtection[FPSTR(S_THRESHOLD_TIME)] = src.heating.freezeProtection.thresholdTime;
|
||||||
|
|
||||||
auto dhw = dst[FPSTR(S_DHW)].to<JsonObject>();
|
auto dhw = dst[FPSTR(S_DHW)].to<JsonObject>();
|
||||||
dhw[FPSTR(S_ENABLED)] = src.dhw.enabled;
|
dhw[FPSTR(S_ENABLED)] = src.dhw.enabled;
|
||||||
@@ -576,7 +543,6 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
|
|||||||
auto externalPump = dst[FPSTR(S_EXTERNAL_PUMP)].to<JsonObject>();
|
auto externalPump = dst[FPSTR(S_EXTERNAL_PUMP)].to<JsonObject>();
|
||||||
externalPump[FPSTR(S_USE)] = src.externalPump.use;
|
externalPump[FPSTR(S_USE)] = src.externalPump.use;
|
||||||
externalPump[FPSTR(S_GPIO)] = src.externalPump.gpio;
|
externalPump[FPSTR(S_GPIO)] = src.externalPump.gpio;
|
||||||
externalPump[FPSTR(S_INVERT_STATE)] = src.externalPump.invertState;
|
|
||||||
externalPump[FPSTR(S_POST_CIRCULATION_TIME)] = roundf(src.externalPump.postCirculationTime / 60, 0);
|
externalPump[FPSTR(S_POST_CIRCULATION_TIME)] = roundf(src.externalPump.postCirculationTime / 60, 0);
|
||||||
externalPump[FPSTR(S_ANTI_STUCK_INTERVAL)] = roundf(src.externalPump.antiStuckInterval / 86400, 0);
|
externalPump[FPSTR(S_ANTI_STUCK_INTERVAL)] = roundf(src.externalPump.antiStuckInterval / 86400, 0);
|
||||||
externalPump[FPSTR(S_ANTI_STUCK_TIME)] = roundf(src.externalPump.antiStuckTime / 60, 0);
|
externalPump[FPSTR(S_ANTI_STUCK_TIME)] = roundf(src.externalPump.antiStuckTime / 60, 0);
|
||||||
@@ -602,55 +568,6 @@ inline void safeSettingsToJson(const Settings& src, JsonVariant dst) {
|
|||||||
settingsToJson(src, dst, true);
|
settingsToJson(src, dst, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Parse a single GPIO value: an empty string means "not configured"
|
|
||||||
*
|
|
||||||
* @return true if the key existed in the source document
|
|
||||||
*/
|
|
||||||
bool jsonToGpioValue(const JsonVariantConst src, const __FlashStringHelper* key, uint8_t& dst, bool& changed) {
|
|
||||||
if (src[key].isNull()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (src[key].is<JsonString>() && src[key].as<JsonString>().size() == 0) {
|
|
||||||
if (dst != GPIO_IS_NOT_CONFIGURED) {
|
|
||||||
dst = GPIO_IS_NOT_CONFIGURED;
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned char value = src[key].as<unsigned char>();
|
|
||||||
|
|
||||||
if (GPIO_IS_VALID(value) && value != dst) {
|
|
||||||
dst = value;
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Parse the W5500 pinout from an object holding clk/mosi/miso/cs/irq/rst
|
|
||||||
*
|
|
||||||
* @return true if the source object exists
|
|
||||||
*/
|
|
||||||
bool jsonToEthernetPins(const JsonVariantConst src, NetworkSettings& dst, bool& changed) {
|
|
||||||
if (src.isNull()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
jsonToGpioValue(src, FPSTR(S_CLK), dst.ethernet.w5500.clk, changed);
|
|
||||||
jsonToGpioValue(src, FPSTR(S_MOSI), dst.ethernet.w5500.mosi, changed);
|
|
||||||
jsonToGpioValue(src, FPSTR(S_MISO), dst.ethernet.w5500.miso, changed);
|
|
||||||
jsonToGpioValue(src, FPSTR(S_CS), dst.ethernet.w5500.cs, changed);
|
|
||||||
jsonToGpioValue(src, FPSTR(S_IRQ), dst.ethernet.w5500.irq, changed);
|
|
||||||
jsonToGpioValue(src, FPSTR(S_RST), dst.ethernet.w5500.rst, changed);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false) {
|
bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false) {
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
@@ -775,6 +692,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// portal
|
// portal
|
||||||
if (src[FPSTR(S_PORTAL)][FPSTR(S_AUTH)].is<bool>()) {
|
if (src[FPSTR(S_PORTAL)][FPSTR(S_AUTH)].is<bool>()) {
|
||||||
bool value = src[FPSTR(S_PORTAL)][FPSTR(S_AUTH)].as<bool>();
|
bool value = src[FPSTR(S_PORTAL)][FPSTR(S_AUTH)].as<bool>();
|
||||||
@@ -1082,20 +1000,11 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_ALWAYS_SEND_INDOOR_TEMP)].is<bool>()) {
|
if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_NATIVE_HEATING_CONTROL)].is<bool>()) {
|
||||||
bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_ALWAYS_SEND_INDOOR_TEMP)].as<bool>();
|
bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_NATIVE_HEATING_CONTROL)].as<bool>();
|
||||||
|
|
||||||
if (value != dst.opentherm.options.alwaysSendIndoorTemp) {
|
if (value != dst.opentherm.options.nativeHeatingControl) {
|
||||||
dst.opentherm.options.alwaysSendIndoorTemp = value;
|
dst.opentherm.options.nativeHeatingControl = value;
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_NATIVE_OTC)].is<bool>()) {
|
|
||||||
bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_NATIVE_OTC)].as<bool>();
|
|
||||||
|
|
||||||
if (value != dst.opentherm.options.nativeOTC) {
|
|
||||||
dst.opentherm.options.nativeOTC = value;
|
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
dst.equitherm.enabled = false;
|
dst.equitherm.enabled = false;
|
||||||
@@ -1115,6 +1024,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// mqtt
|
// mqtt
|
||||||
if (src[FPSTR(S_MQTT)][FPSTR(S_ENABLED)].is<bool>()) {
|
if (src[FPSTR(S_MQTT)][FPSTR(S_ENABLED)].is<bool>()) {
|
||||||
bool value = src[FPSTR(S_MQTT)][FPSTR(S_ENABLED)].as<bool>();
|
bool value = src[FPSTR(S_MQTT)][FPSTR(S_ENABLED)].as<bool>();
|
||||||
@@ -1205,7 +1115,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
if (src[FPSTR(S_EQUITHERM)][FPSTR(S_ENABLED)].is<bool>()) {
|
if (src[FPSTR(S_EQUITHERM)][FPSTR(S_ENABLED)].is<bool>()) {
|
||||||
bool value = src[FPSTR(S_EQUITHERM)][FPSTR(S_ENABLED)].as<bool>();
|
bool value = src[FPSTR(S_EQUITHERM)][FPSTR(S_ENABLED)].as<bool>();
|
||||||
|
|
||||||
if (!dst.opentherm.options.nativeOTC) {
|
if (!dst.opentherm.options.nativeHeatingControl) {
|
||||||
if (value != dst.equitherm.enabled) {
|
if (value != dst.equitherm.enabled) {
|
||||||
dst.equitherm.enabled = value;
|
dst.equitherm.enabled = value;
|
||||||
changed = true;
|
changed = true;
|
||||||
@@ -1258,7 +1168,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
if (src[FPSTR(S_PID)][FPSTR(S_ENABLED)].is<bool>()) {
|
if (src[FPSTR(S_PID)][FPSTR(S_ENABLED)].is<bool>()) {
|
||||||
bool value = src[FPSTR(S_PID)][FPSTR(S_ENABLED)].as<bool>();
|
bool value = src[FPSTR(S_PID)][FPSTR(S_ENABLED)].as<bool>();
|
||||||
|
|
||||||
if (!dst.opentherm.options.nativeOTC) {
|
if (!dst.opentherm.options.nativeHeatingControl) {
|
||||||
if (value != dst.pid.enabled) {
|
if (value != dst.pid.enabled) {
|
||||||
dst.pid.enabled = value;
|
dst.pid.enabled = value;
|
||||||
changed = true;
|
changed = true;
|
||||||
@@ -1403,41 +1313,15 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_ENABLED)].is<bool>()) {
|
if (!src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)].isNull()) {
|
||||||
bool value = src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_ENABLED)].as<bool>();
|
float value = src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)].as<float>();
|
||||||
|
|
||||||
if (value != dst.heating.hysteresis.enabled) {
|
if (value >= 0.0f && value <= 15.0f && fabsf(value - dst.heating.hysteresis) > 0.0001f) {
|
||||||
dst.heating.hysteresis.enabled = value;
|
dst.heating.hysteresis = roundf(value, 2);
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_VALUE)].isNull()) {
|
|
||||||
float value = src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_VALUE)].as<float>();
|
|
||||||
|
|
||||||
if (value >= 0.0f && value <= 15.0f && fabsf(value - dst.heating.hysteresis.value) > 0.0001f) {
|
|
||||||
dst.heating.hysteresis.value = roundf(value, 2);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_ACTION)].isNull()) {
|
|
||||||
uint8_t value = src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_ACTION)].as<uint8_t>();
|
|
||||||
|
|
||||||
switch (value) {
|
|
||||||
case static_cast<uint8_t>(HysteresisAction::DISABLE_HEATING):
|
|
||||||
case static_cast<uint8_t>(HysteresisAction::SET_ZERO_TARGET):
|
|
||||||
if (static_cast<uint8_t>(dst.heating.hysteresis.action) != value) {
|
|
||||||
dst.heating.hysteresis.action = static_cast<HysteresisAction>(value);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!src[FPSTR(S_HEATING)][FPSTR(S_TURBO_FACTOR)].isNull()) {
|
if (!src[FPSTR(S_HEATING)][FPSTR(S_TURBO_FACTOR)].isNull()) {
|
||||||
float value = src[FPSTR(S_HEATING)][FPSTR(S_TURBO_FACTOR)].as<float>();
|
float value = src[FPSTR(S_HEATING)][FPSTR(S_TURBO_FACTOR)].as<float>();
|
||||||
|
|
||||||
@@ -1450,7 +1334,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
if (!src[FPSTR(S_HEATING)][FPSTR(S_MIN_TEMP)].isNull()) {
|
if (!src[FPSTR(S_HEATING)][FPSTR(S_MIN_TEMP)].isNull()) {
|
||||||
unsigned char value = src[FPSTR(S_HEATING)][FPSTR(S_MIN_TEMP)].as<unsigned char>();
|
unsigned char value = src[FPSTR(S_HEATING)][FPSTR(S_MIN_TEMP)].as<unsigned char>();
|
||||||
|
|
||||||
if (value != dst.heating.minTemp && value >= vars.slave.heating.minTemp && value < vars.slave.heating.maxTemp && value != dst.heating.maxTemp) {
|
if (value != dst.heating.minTemp && value >= vars.slave.heating.minTemp && value < vars.slave.heating.maxTemp && value != dst.heating.minTemp) {
|
||||||
dst.heating.minTemp = value;
|
dst.heating.minTemp = value;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@@ -1459,7 +1343,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
if (!src[FPSTR(S_HEATING)][FPSTR(S_MAX_TEMP)].isNull()) {
|
if (!src[FPSTR(S_HEATING)][FPSTR(S_MAX_TEMP)].isNull()) {
|
||||||
unsigned char value = src[FPSTR(S_HEATING)][FPSTR(S_MAX_TEMP)].as<unsigned char>();
|
unsigned char value = src[FPSTR(S_HEATING)][FPSTR(S_MAX_TEMP)].as<unsigned char>();
|
||||||
|
|
||||||
if (value != dst.heating.maxTemp && value > vars.slave.heating.minTemp && value <= vars.slave.heating.maxTemp && value != dst.heating.minTemp) {
|
if (value != dst.heating.maxTemp && value > vars.slave.heating.minTemp && value <= vars.slave.heating.maxTemp && value != dst.heating.maxTemp) {
|
||||||
dst.heating.maxTemp = value;
|
dst.heating.maxTemp = value;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@@ -1503,15 +1387,6 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!src[FPSTR(S_HEATING)][FPSTR(S_FREEZE_PROTECTION)][FPSTR(S_HIGH_TEMP)].isNull()) {
|
|
||||||
unsigned short value = src[FPSTR(S_HEATING)][FPSTR(S_FREEZE_PROTECTION)][FPSTR(S_HIGH_TEMP)].as<uint8_t>();
|
|
||||||
|
|
||||||
if (isValidTemp(value, dst.system.unitSystem, 1, 50) && value != dst.heating.freezeProtection.highTemp) {
|
|
||||||
dst.heating.freezeProtection.highTemp = value;
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!src[FPSTR(S_HEATING)][FPSTR(S_FREEZE_PROTECTION)][FPSTR(S_LOW_TEMP)].isNull()) {
|
if (!src[FPSTR(S_HEATING)][FPSTR(S_FREEZE_PROTECTION)][FPSTR(S_LOW_TEMP)].isNull()) {
|
||||||
unsigned short value = src[FPSTR(S_HEATING)][FPSTR(S_FREEZE_PROTECTION)][FPSTR(S_LOW_TEMP)].as<uint8_t>();
|
unsigned short value = src[FPSTR(S_HEATING)][FPSTR(S_FREEZE_PROTECTION)][FPSTR(S_LOW_TEMP)].as<uint8_t>();
|
||||||
|
|
||||||
@@ -1521,10 +1396,16 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dst.heating.freezeProtection.highTemp < dst.heating.freezeProtection.lowTemp) {
|
if (!src[FPSTR(S_HEATING)][FPSTR(S_FREEZE_PROTECTION)][FPSTR(S_THRESHOLD_TIME)].isNull()) {
|
||||||
dst.heating.freezeProtection.highTemp = dst.heating.freezeProtection.lowTemp;
|
unsigned short value = src[FPSTR(S_HEATING)][FPSTR(S_FREEZE_PROTECTION)][FPSTR(S_THRESHOLD_TIME)].as<unsigned short>();
|
||||||
|
|
||||||
|
if (value >= 30 && value <= 1800) {
|
||||||
|
if (value != dst.heating.freezeProtection.thresholdTime) {
|
||||||
|
dst.heating.freezeProtection.thresholdTime = value;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// dhw
|
// dhw
|
||||||
@@ -1621,15 +1502,6 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src[FPSTR(S_EXTERNAL_PUMP)][FPSTR(S_INVERT_STATE)].is<bool>()) {
|
|
||||||
bool value = src[FPSTR(S_EXTERNAL_PUMP)][FPSTR(S_INVERT_STATE)].as<bool>();
|
|
||||||
|
|
||||||
if (value != dst.externalPump.invertState) {
|
|
||||||
dst.externalPump.invertState = value;
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!src[FPSTR(S_EXTERNAL_PUMP)][FPSTR(S_POST_CIRCULATION_TIME)].isNull()) {
|
if (!src[FPSTR(S_EXTERNAL_PUMP)][FPSTR(S_POST_CIRCULATION_TIME)].isNull()) {
|
||||||
unsigned short value = src[FPSTR(S_EXTERNAL_PUMP)][FPSTR(S_POST_CIRCULATION_TIME)].as<unsigned short>();
|
unsigned short value = src[FPSTR(S_EXTERNAL_PUMP)][FPSTR(S_POST_CIRCULATION_TIME)].as<unsigned short>();
|
||||||
|
|
||||||
@@ -1794,7 +1666,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
// force check emergency target
|
// force check emergency target
|
||||||
{
|
{
|
||||||
float value = !src[FPSTR(S_EMERGENCY)][FPSTR(S_TARGET)].isNull() ? src[FPSTR(S_EMERGENCY)][FPSTR(S_TARGET)].as<float>() : dst.emergency.target;
|
float value = !src[FPSTR(S_EMERGENCY)][FPSTR(S_TARGET)].isNull() ? src[FPSTR(S_EMERGENCY)][FPSTR(S_TARGET)].as<float>() : dst.emergency.target;
|
||||||
bool noRegulators = !dst.opentherm.options.nativeOTC;
|
bool noRegulators = !dst.opentherm.options.nativeHeatingControl;
|
||||||
bool valid = isValidTemp(
|
bool valid = isValidTemp(
|
||||||
value,
|
value,
|
||||||
dst.system.unitSystem,
|
dst.system.unitSystem,
|
||||||
@@ -1819,7 +1691,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
|||||||
|
|
||||||
// force check heating target
|
// force check heating target
|
||||||
{
|
{
|
||||||
bool indoorTempControl = dst.equitherm.enabled || dst.pid.enabled || dst.opentherm.options.nativeOTC;
|
bool indoorTempControl = dst.equitherm.enabled || dst.pid.enabled || dst.opentherm.options.nativeHeatingControl;
|
||||||
float minTemp = indoorTempControl ? THERMOSTAT_INDOOR_MIN_TEMP : dst.heating.minTemp;
|
float minTemp = indoorTempControl ? THERMOSTAT_INDOOR_MIN_TEMP : dst.heating.minTemp;
|
||||||
float maxTemp = indoorTempControl ? THERMOSTAT_INDOOR_MAX_TEMP : dst.heating.maxTemp;
|
float maxTemp = indoorTempControl ? THERMOSTAT_INDOOR_MAX_TEMP : dst.heating.maxTemp;
|
||||||
|
|
||||||
@@ -2012,7 +1884,6 @@ bool jsonToSensorSettings(const uint8_t sensorId, const JsonVariantConst src, Se
|
|||||||
case static_cast<uint8_t>(Sensors::Type::OT_DHW_BURNER_HOURS):
|
case static_cast<uint8_t>(Sensors::Type::OT_DHW_BURNER_HOURS):
|
||||||
case static_cast<uint8_t>(Sensors::Type::OT_HEATING_PUMP_HOURS):
|
case static_cast<uint8_t>(Sensors::Type::OT_HEATING_PUMP_HOURS):
|
||||||
case static_cast<uint8_t>(Sensors::Type::OT_DHW_PUMP_HOURS):
|
case static_cast<uint8_t>(Sensors::Type::OT_DHW_PUMP_HOURS):
|
||||||
case static_cast<uint8_t>(Sensors::Type::OT_COOLING_HOURS):
|
|
||||||
|
|
||||||
case static_cast<uint8_t>(Sensors::Type::NTC_10K_TEMP):
|
case static_cast<uint8_t>(Sensors::Type::NTC_10K_TEMP):
|
||||||
case static_cast<uint8_t>(Sensors::Type::DALLAS_TEMP):
|
case static_cast<uint8_t>(Sensors::Type::DALLAS_TEMP):
|
||||||
@@ -2033,7 +1904,7 @@ bool jsonToSensorSettings(const uint8_t sensorId, const JsonVariantConst src, Se
|
|||||||
|
|
||||||
// gpio
|
// gpio
|
||||||
if (!src[FPSTR(S_GPIO)].isNull()) {
|
if (!src[FPSTR(S_GPIO)].isNull()) {
|
||||||
if (dst.type != Sensors::Type::DALLAS_TEMP && dst.type != Sensors::Type::NTC_10K_TEMP) {
|
if (dst.type != Sensors::Type::DALLAS_TEMP && dst.type == Sensors::Type::BLUETOOTH && dst.type == Sensors::Type::NTC_10K_TEMP) {
|
||||||
if (dst.gpio != GPIO_IS_NOT_CONFIGURED) {
|
if (dst.gpio != GPIO_IS_NOT_CONFIGURED) {
|
||||||
dst.gpio = GPIO_IS_NOT_CONFIGURED;
|
dst.gpio = GPIO_IS_NOT_CONFIGURED;
|
||||||
changed = true;
|
changed = true;
|
||||||
@@ -2069,20 +1940,12 @@ bool jsonToSensorSettings(const uint8_t sensorId, const JsonVariantConst src, Se
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (parsed == 8) {
|
if (parsed == 8) {
|
||||||
for (uint8_t i = 0; i < parsed; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
if (dst.address[i] != tmp[i]) {
|
if (dst.address[i] != tmp[i]) {
|
||||||
dst.address[i] = tmp[i];
|
dst.address[i] = tmp[i];
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
// reset
|
|
||||||
for (uint8_t i = 0; i < sizeof(dst.address); i++) {
|
|
||||||
dst.address[i] = 0x00;
|
|
||||||
}
|
|
||||||
|
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (dst.type == Sensors::Type::BLUETOOTH) {
|
} else if (dst.type == Sensors::Type::BLUETOOTH) {
|
||||||
@@ -2095,20 +1958,12 @@ bool jsonToSensorSettings(const uint8_t sensorId, const JsonVariantConst src, Se
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (parsed == 6) {
|
if (parsed == 6) {
|
||||||
for (uint8_t i = 0; i < parsed; i++) {
|
for (uint8_t i = 0; i < 6; i++) {
|
||||||
if (dst.address[i] != tmp[i]) {
|
if (dst.address[i] != tmp[i]) {
|
||||||
dst.address[i] = tmp[i];
|
dst.address[i] = tmp[i];
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
// reset
|
|
||||||
for (uint8_t i = 0; i < sizeof(dst.address); i++) {
|
|
||||||
dst.address[i] = 0x00;
|
|
||||||
}
|
|
||||||
|
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2189,18 +2044,21 @@ bool jsonToSensorResult(const uint8_t sensorId, const JsonVariantConst src) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto& dst = Sensors::results[sensorId];
|
||||||
|
bool changed = false;
|
||||||
|
|
||||||
// value
|
// value
|
||||||
if (!src[FPSTR(S_VALUE)].isNull()) {
|
if (!src[FPSTR(S_VALUE)].isNull()) {
|
||||||
return Sensors::setValueById(
|
float value = src[FPSTR(S_VALUE)].as<float>();
|
||||||
sensorId,
|
|
||||||
src[FPSTR(S_VALUE)].as<float>(),
|
uint8_t vType = static_cast<uint8_t>(Sensors::ValueType::PRIMARY);
|
||||||
Sensors::ValueType::PRIMARY,
|
if (fabsf(value - dst.values[vType]) > 0.0001f) {
|
||||||
true,
|
dst.values[vType] = roundf(value, 2);
|
||||||
true
|
changed = true;
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void varsToJson(const Variables& src, JsonVariant dst) {
|
void varsToJson(const Variables& src, JsonVariant dst) {
|
||||||
@@ -2209,13 +2067,10 @@ void varsToJson(const Variables& src, JsonVariant dst) {
|
|||||||
slave[FPSTR(S_FLAGS)] = src.slave.flags;
|
slave[FPSTR(S_FLAGS)] = src.slave.flags;
|
||||||
slave[FPSTR(S_TYPE)] = src.slave.type;
|
slave[FPSTR(S_TYPE)] = src.slave.type;
|
||||||
slave[FPSTR(S_APP_VERSION)] = src.slave.appVersion;
|
slave[FPSTR(S_APP_VERSION)] = src.slave.appVersion;
|
||||||
slave[FPSTR(S_PROTOCOL_VERSION)] = src.slave.protocolVersion;
|
slave[FPSTR(S_PROTOCOL_VERSION)] = src.slave.appVersion;
|
||||||
slave[FPSTR(S_CONNECTED)] = src.slave.connected;
|
slave[FPSTR(S_CONNECTED)] = src.slave.connected;
|
||||||
slave[FPSTR(S_FLAME)] = src.slave.flame;
|
slave[FPSTR(S_FLAME)] = src.slave.flame;
|
||||||
|
slave[FPSTR(S_COOLING)] = src.slave.cooling;
|
||||||
auto sCooling = slave[FPSTR(S_COOLING)].to<JsonObject>();
|
|
||||||
sCooling[FPSTR(S_ACTIVE)] = src.slave.cooling.active;
|
|
||||||
sCooling[FPSTR(S_SETPOINT)] = src.slave.cooling.setpoint;
|
|
||||||
|
|
||||||
auto sModulation = slave[FPSTR(S_MODULATION)].to<JsonObject>();
|
auto sModulation = slave[FPSTR(S_MODULATION)].to<JsonObject>();
|
||||||
sModulation[FPSTR(S_MIN)] = src.slave.modulation.min;
|
sModulation[FPSTR(S_MIN)] = src.slave.modulation.min;
|
||||||
@@ -2250,7 +2105,6 @@ void varsToJson(const Variables& src, JsonVariant dst) {
|
|||||||
mHeating[FPSTR(S_BLOCKING)] = src.master.heating.blocking;
|
mHeating[FPSTR(S_BLOCKING)] = src.master.heating.blocking;
|
||||||
mHeating[FPSTR(S_INDOOR_TEMP_CONTROL)] = src.master.heating.indoorTempControl;
|
mHeating[FPSTR(S_INDOOR_TEMP_CONTROL)] = src.master.heating.indoorTempControl;
|
||||||
mHeating[FPSTR(S_OVERHEAT)] = src.master.heating.overheat;
|
mHeating[FPSTR(S_OVERHEAT)] = src.master.heating.overheat;
|
||||||
mHeating[FPSTR(S_FREEZING)] = src.master.heating.freezing;
|
|
||||||
mHeating[FPSTR(S_SETPOINT_TEMP)] = roundf(src.master.heating.setpointTemp, 2);
|
mHeating[FPSTR(S_SETPOINT_TEMP)] = roundf(src.master.heating.setpointTemp, 2);
|
||||||
mHeating[FPSTR(S_TARGET_TEMP)] = roundf(src.master.heating.targetTemp, 2);
|
mHeating[FPSTR(S_TARGET_TEMP)] = roundf(src.master.heating.targetTemp, 2);
|
||||||
mHeating[FPSTR(S_CURRENT_TEMP)] = roundf(src.master.heating.currentTemp, 2);
|
mHeating[FPSTR(S_CURRENT_TEMP)] = roundf(src.master.heating.currentTemp, 2);
|
||||||
@@ -2271,7 +2125,6 @@ void varsToJson(const Variables& src, JsonVariant dst) {
|
|||||||
|
|
||||||
master[FPSTR(S_NETWORK)][FPSTR(S_CONNECTED)] = src.network.connected;
|
master[FPSTR(S_NETWORK)][FPSTR(S_CONNECTED)] = src.network.connected;
|
||||||
master[FPSTR(S_NETWORK)][FPSTR(S_RSSI)] = src.network.rssi;
|
master[FPSTR(S_NETWORK)][FPSTR(S_RSSI)] = src.network.rssi;
|
||||||
master[FPSTR(S_NETWORK)][FPSTR(S_CONNECTION_TYPE)] = NetworkUtils::NetworkMgr::uplinkName(src.network.connectionType);
|
|
||||||
master[FPSTR(S_MQTT)][FPSTR(S_CONNECTED)] = src.mqtt.connected;
|
master[FPSTR(S_MQTT)][FPSTR(S_CONNECTED)] = src.mqtt.connected;
|
||||||
master[FPSTR(S_EMERGENCY)][FPSTR(S_STATE)] = src.emergency.state;
|
master[FPSTR(S_EMERGENCY)][FPSTR(S_STATE)] = src.emergency.state;
|
||||||
master[FPSTR(S_EXTERNAL_PUMP)][FPSTR(S_STATE)] = src.externalPump.state;
|
master[FPSTR(S_EXTERNAL_PUMP)][FPSTR(S_STATE)] = src.externalPump.state;
|
||||||
|
|||||||
+16
-71
@@ -109,8 +109,7 @@
|
|||||||
|
|
||||||
"sConnected": "OpenTherm 通讯状态",
|
"sConnected": "OpenTherm 通讯状态",
|
||||||
"sFlame": "火焰",
|
"sFlame": "火焰",
|
||||||
"sCoolingActive": "制冷",
|
"sCooling": "制冷",
|
||||||
"sCoolingSetpoint": "冷却设定点",
|
|
||||||
"sFaultActive": "报警状态",
|
"sFaultActive": "报警状态",
|
||||||
"sFaultCode": "报警代码",
|
"sFaultCode": "报警代码",
|
||||||
"sDiagActive": "诊断状态",
|
"sDiagActive": "诊断状态",
|
||||||
@@ -151,7 +150,6 @@
|
|||||||
|
|
||||||
"section": {
|
"section": {
|
||||||
"static": "静态设置",
|
"static": "静态设置",
|
||||||
"ethernet": "以太网",
|
|
||||||
"availableNetworks": "可用网络",
|
"availableNetworks": "可用网络",
|
||||||
"staSettings": "WiFi 设置",
|
"staSettings": "WiFi 设置",
|
||||||
"apSettings": "AP 设置"
|
"apSettings": "AP 设置"
|
||||||
@@ -159,20 +157,7 @@
|
|||||||
|
|
||||||
"scan": {
|
"scan": {
|
||||||
"pos": "#",
|
"pos": "#",
|
||||||
"info": "Info",
|
"info": "Info"
|
||||||
"unavailable": "请启用 WiFi 以扫描网络"
|
|
||||||
},
|
|
||||||
|
|
||||||
"ethernet": {
|
|
||||||
"enable": "启用以太网",
|
|
||||||
"notConfigured": "填写全部六个 GPIO 引脚后才能启用以太网。",
|
|
||||||
"clk": "SPI 时钟 GPIO",
|
|
||||||
"mosi": "SPI MOSI GPIO",
|
|
||||||
"miso": "SPI MISO GPIO",
|
|
||||||
"cs": "SPI CS GPIO",
|
|
||||||
"irq": "中断 GPIO",
|
|
||||||
"rst": "复位 GPIO",
|
|
||||||
"note": "W5500 SPI 接线"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"wifi": {
|
"wifi": {
|
||||||
@@ -190,14 +175,7 @@
|
|||||||
"ip": "IP",
|
"ip": "IP",
|
||||||
"subnet": "子网掩码",
|
"subnet": "子网掩码",
|
||||||
"gateway": "网关",
|
"gateway": "网关",
|
||||||
"dns": "DNS 服务器",
|
"dns": "DNS 服务器"
|
||||||
"connection": "连接",
|
|
||||||
"connectionType": {
|
|
||||||
"ethernet": "以太网",
|
|
||||||
"wifi": "WiFi",
|
|
||||||
"wifi-ap": "WiFi 接入点",
|
|
||||||
"none": "无"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"sta": {
|
"sta": {
|
||||||
@@ -264,7 +242,6 @@
|
|||||||
"otDhwBurnerHours": "OpenTherm, number of burner operating hours (DHW)",
|
"otDhwBurnerHours": "OpenTherm, number of burner operating hours (DHW)",
|
||||||
"otHeatingPumpHours": "OpenTherm, number of pump operating hours (heating)",
|
"otHeatingPumpHours": "OpenTherm, number of pump operating hours (heating)",
|
||||||
"otDhwPumpHours": "OpenTherm, number of pump operating hours (DHW)",
|
"otDhwPumpHours": "OpenTherm, number of pump operating hours (DHW)",
|
||||||
"otCoolingHours": "OpenTherm, number of cooling hours",
|
|
||||||
|
|
||||||
"ntcTemp": "NTC 传感器",
|
"ntcTemp": "NTC 传感器",
|
||||||
"dallasTemp": "DALLAS 传感器",
|
"dallasTemp": "DALLAS 传感器",
|
||||||
@@ -341,15 +318,9 @@
|
|||||||
},
|
},
|
||||||
"freezeProtection": {
|
"freezeProtection": {
|
||||||
"title": "防冻保护",
|
"title": "防冻保护",
|
||||||
"desc": "如果热载体或室内温度低于 <b>低温</b>,加热将被强制开启。",
|
"desc": "当热媒或室内温度在<b>等待时间</b> 内降至<b>低温阈值</b>以下时,系统将强制启动加热功能。",
|
||||||
"highTemp": {
|
"lowTemp": "低温阈值",
|
||||||
"title": "高温阈值",
|
"thresholdTime": "等待时间<small>(秒)</small>"
|
||||||
"note": "防冻保护激活后系统恢复正常模式的阈值"
|
|
||||||
},
|
|
||||||
"lowTemp": {
|
|
||||||
"title": "低温阈值",
|
|
||||||
"note": "强制开启加热的阈值"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"portal": {
|
"portal": {
|
||||||
@@ -384,16 +355,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"heating": {
|
"heating": {
|
||||||
"hyst": {
|
"hyst": "滞后值<small>(单位:度)</small>",
|
||||||
"title": "滞回",
|
|
||||||
"desc": "滞回有助于维持设定的室内温度(在使用«Equitherm»和/或«PID»时)。强制禁用加热当<code>current indoor > target + value</code>,启用加热当<code>current indoor < (target - value)</code>。",
|
|
||||||
"value": "值 <small>(以度为单位)</small>",
|
|
||||||
"action": {
|
|
||||||
"title": "行动",
|
|
||||||
"disableHeating": "禁用加热",
|
|
||||||
"set0target": "设置空目标"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"turboFactor": "Turbo 模式系数"
|
"turboFactor": "Turbo 模式系数"
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -408,26 +370,11 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"equitherm": {
|
"equitherm": {
|
||||||
"slope": {
|
"n": "N 系数",
|
||||||
"title": "斜率",
|
"k": "K 系数",
|
||||||
"note": "热损失补偿。主要调谐参数。"
|
"t": {
|
||||||
},
|
"title": "T 系数",
|
||||||
"exponent": {
|
"note": "启用PID时此参数无效"
|
||||||
"title": "指数",
|
|
||||||
"note": "散热器效率。典型值:<code>1.1</code> - 地板采暖,<code>1.2</code> - 铸铁,<code>1.3</code> - 面板散热器,<code>1.4</code> - 对流器。"
|
|
||||||
},
|
|
||||||
"shift": {
|
|
||||||
"title": "偏移",
|
|
||||||
"note": "补偿额外热损失(例如,在管道中)或额外热源。"
|
|
||||||
},
|
|
||||||
"targetDiffFactor": {
|
|
||||||
"title": "T 因子",
|
|
||||||
"note": "如果启用 PID,则不使用。将目标和当前室内温度之间的差值添加到设定点:<code>setpoint = setpoint + ((target - indoor) * T)</code>。"
|
|
||||||
},
|
|
||||||
"chart": {
|
|
||||||
"targetTemp": "目标室内温度",
|
|
||||||
"setpointTemp": "热载体温度",
|
|
||||||
"outdoorTemp": "室外温度"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -485,13 +432,12 @@
|
|||||||
"autoFaultReset": "自动报警复位 <small>(不推荐!)</small>",
|
"autoFaultReset": "自动报警复位 <small>(不推荐!)</small>",
|
||||||
"autoDiagReset": "自动诊断复位 <small>(不推荐!)</small>",
|
"autoDiagReset": "自动诊断复位 <small>(不推荐!)</small>",
|
||||||
"setDateAndTime": "同步设置锅炉日期与时间",
|
"setDateAndTime": "同步设置锅炉日期与时间",
|
||||||
"immergasFix": "针对Immergas锅炉的兼容性修复",
|
"immergasFix": "针对Immergas锅炉的兼容性修复"
|
||||||
"alwaysSendIndoorTemp": "向锅炉发送当前室内温度"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"nativeOTC": {
|
"nativeHeating": {
|
||||||
"title": "原生热载体温度计算模式",
|
"title": "原生锅炉供暖控制",
|
||||||
"note": "仅在锅炉处于 OTC 模式时<u>才</u>工作:需要并接受目标室内温度,并基于内置曲线模式自行调节热载体温度。与 PID 和 Equitherm 不兼容。"
|
"note": "<u>注意:</u> 仅适用于锅炉需接收目标室温并自主调节载热介质温度的场景,与固件中的PID及Equithermq气候补偿功能不兼容。"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -508,7 +454,6 @@
|
|||||||
"extPump": {
|
"extPump": {
|
||||||
"use": "使用外置循环泵",
|
"use": "使用外置循环泵",
|
||||||
"gpio": "继电器 GPIO引脚",
|
"gpio": "继电器 GPIO引脚",
|
||||||
"invertState": "切换 GPIO 状态",
|
|
||||||
"postCirculationTime": "后循环时间 <small>(分钟)</small>",
|
"postCirculationTime": "后循环时间 <small>(分钟)</small>",
|
||||||
"antiStuckInterval": "防卡死间隔时间<small>(天)</small>",
|
"antiStuckInterval": "防卡死间隔时间<small>(天)</small>",
|
||||||
"antiStuckTime": "防卡死运行时长<small>(分钟)</small>"
|
"antiStuckTime": "防卡死运行时长<small>(分钟)</small>"
|
||||||
|
|||||||
+13
-54
@@ -109,8 +109,7 @@
|
|||||||
|
|
||||||
"sConnected": "OpenTherm connection",
|
"sConnected": "OpenTherm connection",
|
||||||
"sFlame": "Flame",
|
"sFlame": "Flame",
|
||||||
"sCoolingActive": "Cooling",
|
"sCooling": "Cooling",
|
||||||
"sCoolingSetpoint": "Cooling setpoint",
|
|
||||||
"sFaultActive": "Fault",
|
"sFaultActive": "Fault",
|
||||||
"sFaultCode": "Fault code",
|
"sFaultCode": "Fault code",
|
||||||
"sDiagActive": "Diagnostic",
|
"sDiagActive": "Diagnostic",
|
||||||
@@ -119,7 +118,6 @@
|
|||||||
"mHeatEnabled": "Heating enabled",
|
"mHeatEnabled": "Heating enabled",
|
||||||
"mHeatBlocking": "Heating blocked",
|
"mHeatBlocking": "Heating blocked",
|
||||||
"mHeatOverheat": "Heating overheat",
|
"mHeatOverheat": "Heating overheat",
|
||||||
"mHeatFreezing": "Heating freezing",
|
|
||||||
"sHeatActive": "Heating active",
|
"sHeatActive": "Heating active",
|
||||||
"mHeatSetpointTemp": "Heating setpoint temp",
|
"mHeatSetpointTemp": "Heating setpoint temp",
|
||||||
"mHeatTargetTemp": "Heating target temp",
|
"mHeatTargetTemp": "Heating target temp",
|
||||||
@@ -152,7 +150,6 @@
|
|||||||
|
|
||||||
"section": {
|
"section": {
|
||||||
"static": "Static settings",
|
"static": "Static settings",
|
||||||
"ethernet": "Ethernet",
|
|
||||||
"availableNetworks": "Available networks",
|
"availableNetworks": "Available networks",
|
||||||
"staSettings": "WiFi settings",
|
"staSettings": "WiFi settings",
|
||||||
"apSettings": "AP settings"
|
"apSettings": "AP settings"
|
||||||
@@ -160,20 +157,7 @@
|
|||||||
|
|
||||||
"scan": {
|
"scan": {
|
||||||
"pos": "#",
|
"pos": "#",
|
||||||
"info": "Info",
|
"info": "Info"
|
||||||
"unavailable": "Please enable WiFi to scan for networks"
|
|
||||||
},
|
|
||||||
|
|
||||||
"ethernet": {
|
|
||||||
"enable": "Enable ethernet",
|
|
||||||
"notConfigured": "Fill in all six GPIO pins to enable ethernet.",
|
|
||||||
"clk": "SPI clock GPIO",
|
|
||||||
"mosi": "SPI MOSI GPIO",
|
|
||||||
"miso": "SPI MISO GPIO",
|
|
||||||
"cs": "SPI CS GPIO",
|
|
||||||
"irq": "Interrupt GPIO",
|
|
||||||
"rst": "Reset GPIO",
|
|
||||||
"note": "W5500 SPI wiring"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"wifi": {
|
"wifi": {
|
||||||
@@ -191,14 +175,7 @@
|
|||||||
"ip": "IP",
|
"ip": "IP",
|
||||||
"subnet": "Subnet",
|
"subnet": "Subnet",
|
||||||
"gateway": "Gateway",
|
"gateway": "Gateway",
|
||||||
"dns": "DNS",
|
"dns": "DNS"
|
||||||
"connection": "Connection",
|
|
||||||
"connectionType": {
|
|
||||||
"ethernet": "Ethernet",
|
|
||||||
"wifi": "WiFi",
|
|
||||||
"wifi-ap": "WiFi AP",
|
|
||||||
"none": "None"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"sta": {
|
"sta": {
|
||||||
@@ -265,7 +242,6 @@
|
|||||||
"otDhwBurnerHours": "OpenTherm, number of burner operating hours (DHW)",
|
"otDhwBurnerHours": "OpenTherm, number of burner operating hours (DHW)",
|
||||||
"otHeatingPumpHours": "OpenTherm, number of pump operating hours (heating)",
|
"otHeatingPumpHours": "OpenTherm, number of pump operating hours (heating)",
|
||||||
"otDhwPumpHours": "OpenTherm, number of pump operating hours (DHW)",
|
"otDhwPumpHours": "OpenTherm, number of pump operating hours (DHW)",
|
||||||
"otCoolingHours": "OpenTherm, number of cooling hours",
|
|
||||||
|
|
||||||
"ntcTemp": "NTC sensor",
|
"ntcTemp": "NTC sensor",
|
||||||
"dallasTemp": "DALLAS sensor",
|
"dallasTemp": "DALLAS sensor",
|
||||||
@@ -342,15 +318,9 @@
|
|||||||
},
|
},
|
||||||
"freezeProtection": {
|
"freezeProtection": {
|
||||||
"title": "Freeze protection",
|
"title": "Freeze protection",
|
||||||
"desc": "Heating will be forced to turn on if the heat carrier or indoor temperature drops below <b>Low temperature</b>.",
|
"desc": "Heating will be forced to turn on if the heat carrier or indoor temperature drops below <b>Low temperature</b> during <b>Waiting time</b>.",
|
||||||
"highTemp": {
|
"lowTemp": "Low temperature threshold",
|
||||||
"title": "High temperature threshold",
|
"thresholdTime": "Waiting time <small>(sec)</small>"
|
||||||
"note": "Threshold when the system returns to normal mode after freeze protection activation"
|
|
||||||
},
|
|
||||||
"lowTemp": {
|
|
||||||
"title": "Low temperature threshold",
|
|
||||||
"note": "Threshold when heating is forced to turn on"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"portal": {
|
"portal": {
|
||||||
@@ -385,16 +355,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"heating": {
|
"heating": {
|
||||||
"hyst": {
|
"hyst": "Hysteresis <small>(in degrees)</small>",
|
||||||
"title": "Hysteresis",
|
|
||||||
"desc": "Hysteresis is useful for maintaining a set indoor temp (when using «Equitherm» and/or «PID»). Forces disable heating when <code>current indoor > target + value</code> and enable heating when <code>current indoor < (target - value)</code>.",
|
|
||||||
"value": "Value <small>(in degrees)</small>",
|
|
||||||
"action": {
|
|
||||||
"title": "Action",
|
|
||||||
"disableHeating": "Disable heating",
|
|
||||||
"set0target": "Set null target"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"turboFactor": "Turbo mode coeff."
|
"turboFactor": "Turbo mode coeff."
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -415,7 +376,7 @@
|
|||||||
},
|
},
|
||||||
"exponent": {
|
"exponent": {
|
||||||
"title": "Exponent",
|
"title": "Exponent",
|
||||||
"note": "Radiator efficiency. Typical values: <code>1.1</code> - Floor heating, <code>1.2</code> - Cast iron, <code>1.3</code> - Panel radiators, <code>1.4</code> - Convectors."
|
"note": "Radiator efficiency. Typical values: 1.1 - Floor heating, 1.2 - Cast iron, 1.3 - Panel radiators, 1.4 - Convectors."
|
||||||
},
|
},
|
||||||
"shift": {
|
"shift": {
|
||||||
"title": "Shift",
|
"title": "Shift",
|
||||||
@@ -423,7 +384,7 @@
|
|||||||
},
|
},
|
||||||
"targetDiffFactor": {
|
"targetDiffFactor": {
|
||||||
"title": "T factor",
|
"title": "T factor",
|
||||||
"note": "Not used if PID is enabled. Adds to the setpoint the difference between the target and current indoor temp: <code>setpoint = setpoint + ((target - indoor) * T)</code>."
|
"note": "Not used if PID is enabled"
|
||||||
},
|
},
|
||||||
"chart": {
|
"chart": {
|
||||||
"targetTemp": "Target indoor temperature",
|
"targetTemp": "Target indoor temperature",
|
||||||
@@ -486,13 +447,12 @@
|
|||||||
"autoFaultReset": "Auto fault reset <small>(not recommended!)</small>",
|
"autoFaultReset": "Auto fault reset <small>(not recommended!)</small>",
|
||||||
"autoDiagReset": "Auto diag reset <small>(not recommended!)</small>",
|
"autoDiagReset": "Auto diag reset <small>(not recommended!)</small>",
|
||||||
"setDateAndTime": "Set date & time on boiler",
|
"setDateAndTime": "Set date & time on boiler",
|
||||||
"immergasFix": "Fix for Immergas boilers",
|
"immergasFix": "Fix for Immergas boilers"
|
||||||
"alwaysSendIndoorTemp": "Send current indoor temp to boiler"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"nativeOTC": {
|
"nativeHeating": {
|
||||||
"title": "Native OTC mode",
|
"title": "Native heating control (boiler)",
|
||||||
"note": "Works <u>ONLY</u> if the boiler is in OTC mode: requires and accepts the target indoor temperature and self-regulates the heat carrier temperature based on the built-in curves mode. Incompatible with PID and Equitherm."
|
"note": "Works <u>ONLY</u> if the boiler requires the desired room temperature and regulates the temperature of the coolant itself. Not compatible with PID and Equitherm regulators in firmware."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -509,7 +469,6 @@
|
|||||||
"extPump": {
|
"extPump": {
|
||||||
"use": "Use external pump",
|
"use": "Use external pump",
|
||||||
"gpio": "Relay GPIO",
|
"gpio": "Relay GPIO",
|
||||||
"invertState": "Invert GPIO state",
|
|
||||||
"postCirculationTime": "Post circulation time <small>(min)</small>",
|
"postCirculationTime": "Post circulation time <small>(min)</small>",
|
||||||
"antiStuckInterval": "Anti stuck interval <small>(days)</small>",
|
"antiStuckInterval": "Anti stuck interval <small>(days)</small>",
|
||||||
"antiStuckTime": "Anti stuck time <small>(min)</small>"
|
"antiStuckTime": "Anti stuck time <small>(min)</small>"
|
||||||
|
|||||||
+17
-57
@@ -109,8 +109,7 @@
|
|||||||
|
|
||||||
"sConnected": "Connessione OpenTherm",
|
"sConnected": "Connessione OpenTherm",
|
||||||
"sFlame": "Fiamma",
|
"sFlame": "Fiamma",
|
||||||
"sCoolingActive": "Raffrescamento",
|
"sCooling": "Raffrescamento",
|
||||||
"sCoolingSetpoint": "Raffrescamento setpoint",
|
|
||||||
"sFaultActive": "Anomalia",
|
"sFaultActive": "Anomalia",
|
||||||
"sFaultCode": "Codice anomalia",
|
"sFaultCode": "Codice anomalia",
|
||||||
"sDiagActive": "Diagnostica",
|
"sDiagActive": "Diagnostica",
|
||||||
@@ -151,7 +150,6 @@
|
|||||||
|
|
||||||
"section": {
|
"section": {
|
||||||
"static": "Impostazioni statico",
|
"static": "Impostazioni statico",
|
||||||
"ethernet": "Ethernet",
|
|
||||||
"availableNetworks": "Reti disponibili",
|
"availableNetworks": "Reti disponibili",
|
||||||
"staSettings": "Impostazioni WiFi",
|
"staSettings": "Impostazioni WiFi",
|
||||||
"apSettings": "Impostazioni AP"
|
"apSettings": "Impostazioni AP"
|
||||||
@@ -159,20 +157,7 @@
|
|||||||
|
|
||||||
"scan": {
|
"scan": {
|
||||||
"pos": "#",
|
"pos": "#",
|
||||||
"info": "Info",
|
"info": "Info"
|
||||||
"unavailable": "Abilita il WiFi per cercare le reti"
|
|
||||||
},
|
|
||||||
|
|
||||||
"ethernet": {
|
|
||||||
"enable": "Abilita ethernet",
|
|
||||||
"notConfigured": "Compilare tutti e sei i pin GPIO per abilitare ethernet.",
|
|
||||||
"clk": "GPIO clock SPI",
|
|
||||||
"mosi": "GPIO MOSI SPI",
|
|
||||||
"miso": "GPIO MISO SPI",
|
|
||||||
"cs": "GPIO CS SPI",
|
|
||||||
"irq": "GPIO interrupt",
|
|
||||||
"rst": "GPIO reset",
|
|
||||||
"note": "Cablaggio SPI del W5500"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"wifi": {
|
"wifi": {
|
||||||
@@ -190,14 +175,7 @@
|
|||||||
"ip": "IP",
|
"ip": "IP",
|
||||||
"subnet": "Subnet",
|
"subnet": "Subnet",
|
||||||
"gateway": "Gateway",
|
"gateway": "Gateway",
|
||||||
"dns": "DNS",
|
"dns": "DNS"
|
||||||
"connection": "Connessione",
|
|
||||||
"connectionType": {
|
|
||||||
"ethernet": "Ethernet",
|
|
||||||
"wifi": "WiFi",
|
|
||||||
"wifi-ap": "WiFi AP",
|
|
||||||
"none": "Nessuno"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"sta": {
|
"sta": {
|
||||||
@@ -264,7 +242,6 @@
|
|||||||
"otDhwBurnerHours": "OpenTherm, numero di ore di funzionamento del bruciatore (ACS)",
|
"otDhwBurnerHours": "OpenTherm, numero di ore di funzionamento del bruciatore (ACS)",
|
||||||
"otHeatingPumpHours": "OpenTherm, numero di ore di funzionamento della pompa (riscaldamento)",
|
"otHeatingPumpHours": "OpenTherm, numero di ore di funzionamento della pompa (riscaldamento)",
|
||||||
"otDhwPumpHours": "OpenTherm, numero di ore di funzionamento della pompa (ACS)",
|
"otDhwPumpHours": "OpenTherm, numero di ore di funzionamento della pompa (ACS)",
|
||||||
"otCoolingHours": "OpenTherm, numero di ore di funzionamento della cooling",
|
|
||||||
|
|
||||||
"ntcTemp": "Sensore NTC",
|
"ntcTemp": "Sensore NTC",
|
||||||
"dallasTemp": "Sensore DALLAS",
|
"dallasTemp": "Sensore DALLAS",
|
||||||
@@ -341,15 +318,9 @@
|
|||||||
},
|
},
|
||||||
"freezeProtection": {
|
"freezeProtection": {
|
||||||
"title": "Protezione antigelo",
|
"title": "Protezione antigelo",
|
||||||
"desc": "Il riscaldamento verrà forzatamente attivato se la temperatura del vettore termico o la temperatura interna scende al di sotto della <b>Soglia di temperatura bassa</b>.",
|
"desc": "Il riscaldamento verrà attivato forzatamente se la temperatura del vettore di calore o interna scende al di sotto della <b>temperatura minima</b> durante il <b>tempo di attesa</b>.",
|
||||||
"highTemp": {
|
"lowTemp": "Soglia di temperatura minima",
|
||||||
"title": "Soglia di temperatura alta",
|
"thresholdTime": "Tempo di attesa <small>(sec)</small>"
|
||||||
"note": "Soglia quando il sistema ritorna alla modalità normale dopo l'attivazione della protezione antigelo"
|
|
||||||
},
|
|
||||||
"lowTemp": {
|
|
||||||
"title": "Soglia di temperatura bassa",
|
|
||||||
"note": "Soglia quando il riscaldamento viene forzatamente attivato"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"portal": {
|
"portal": {
|
||||||
@@ -384,16 +355,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"heating": {
|
"heating": {
|
||||||
"hyst": {
|
"hyst": "Isteresi <small>(in gradi)</small>",
|
||||||
"title": "Isteresi",
|
|
||||||
"desc": "L'isteresi è utile per mantenere una temperatura interna impostata (quando si utilizza «Equitherm» e/o «PID»). Forza la disabilitazione del riscaldamento quando <code>current indoor > target + value</code> e abilita il riscaldamento quando <code>current indoor < (target - value)</code>.",
|
|
||||||
"value": "Valore <small>(in gradi)</small>",
|
|
||||||
"action": {
|
|
||||||
"title": "Azione",
|
|
||||||
"disableHeating": "Disabilita riscaldamento",
|
|
||||||
"set0target": "Imposta target nullo"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"turboFactor": "Turbo mode coeff."
|
"turboFactor": "Turbo mode coeff."
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -410,23 +372,23 @@
|
|||||||
"equitherm": {
|
"equitherm": {
|
||||||
"slope": {
|
"slope": {
|
||||||
"title": "Pendenza",
|
"title": "Pendenza",
|
||||||
"note": "Compensazione della perdita di calore. Parametro di regolazione principale."
|
"note": "Compensazione delle perdite di calore. Principale parametro di regolazione."
|
||||||
},
|
},
|
||||||
"exponent": {
|
"exponent": {
|
||||||
"title": "Esponente",
|
"title": "Esponente",
|
||||||
"note": "Efficienza del radiatore. Valori tipici: <code>1.1</code> - Riscaldamento a pavimento, <code>1.2</code> - Ghisa, <code>1.3</code> - Radiatori a pannello, <code>1.4</code> - Convettori."
|
"note": "Efficienza del radiatore. Valori tipici: 1.1 - Riscaldamento a pavimento, 1.2 - Radiatori in ghisa, 1.3 - Radiatori a pannelli, 1.4 - Convetttori."
|
||||||
},
|
},
|
||||||
"shift": {
|
"shift": {
|
||||||
"title": "Spostamento",
|
"title": "Spostare",
|
||||||
"note": "Compensa perdite di calore aggiuntive (ad es., nelle tubature) o fonti di calore extra."
|
"note": "Compensa le perdite di calore aggiuntive (ad esempio, nelle tubature) o fonti di calore extra."
|
||||||
},
|
},
|
||||||
"targetDiffFactor": {
|
"targetDiffFactor": {
|
||||||
"title": "Fattore T",
|
"title": "Fattore T",
|
||||||
"note": "Non utilizzato se PID è abilitato. Aggiunge al setpoint la differenza tra la temperatura target e quella interna attuale: <code>setpoint = setpoint + ((target - indoor) * T)</code>."
|
"note": "Non usato se PID è attivato"
|
||||||
},
|
},
|
||||||
"chart": {
|
"chart": {
|
||||||
"targetTemp": "Temperatura interna target",
|
"targetTemp": "Temperatura interna target",
|
||||||
"setpointTemp": "Temperatura del vettore termico",
|
"setpointTemp": "Temperatura del portatore di calore",
|
||||||
"outdoorTemp": "Temperatura esterna"
|
"outdoorTemp": "Temperatura esterna"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -485,13 +447,12 @@
|
|||||||
"autoFaultReset": "Ripristino automatico degli errori <small>(sconsigliato!)</small>",
|
"autoFaultReset": "Ripristino automatico degli errori <small>(sconsigliato!)</small>",
|
||||||
"autoDiagReset": "Ripristino diagnostico automatica <small>(sconsigliato!)</small>",
|
"autoDiagReset": "Ripristino diagnostico automatica <small>(sconsigliato!)</small>",
|
||||||
"setDateAndTime": "Imposta data e ora sulla caldaia",
|
"setDateAndTime": "Imposta data e ora sulla caldaia",
|
||||||
"immergasFix": "Fix per caldiaie Immergas",
|
"immergasFix": "Fix per caldiaie Immergas"
|
||||||
"alwaysSendIndoorTemp": "Invia la temp attuale interna alla caldaia"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"nativeOTC": {
|
"nativeHeating": {
|
||||||
"title": "Modalità nativa di calcolo della temperatura del vettore termico",
|
"title": "Controllo del riscaldamento nativo (caldaia)",
|
||||||
"note": "Funziona <u>SOLO</u> se la caldaia è in modalità OTC: richiede e accetta la temperatura interna target e regola autonomamente la temperatura del vettore termico basata sulla modalità curve integrata. Incompatibile con PID e Equitherm."
|
"note": "Lavora <u>SOLO</u> se la caldaia richiede la temperatura ambiente desiderata e regola autonomamente la temperatura del fluido. Non compatiblile con regolazioni PID e Equitherm del sistema."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -508,7 +469,6 @@
|
|||||||
"extPump": {
|
"extPump": {
|
||||||
"use": "Usa pompa/circolatore esterno",
|
"use": "Usa pompa/circolatore esterno",
|
||||||
"gpio": "GPIO relè",
|
"gpio": "GPIO relè",
|
||||||
"invertState": "Inverti stato GPIO",
|
|
||||||
"postCirculationTime": "Tempo di post circolazione <small>(min)</small>",
|
"postCirculationTime": "Tempo di post circolazione <small>(min)</small>",
|
||||||
"antiStuckInterval": "Intervallo antiblocco <small>(days)</small>",
|
"antiStuckInterval": "Intervallo antiblocco <small>(days)</small>",
|
||||||
"antiStuckTime": "Tempo antiblocco <small>(min)</small>"
|
"antiStuckTime": "Tempo antiblocco <small>(min)</small>"
|
||||||
|
|||||||
@@ -1,522 +0,0 @@
|
|||||||
{
|
|
||||||
"values": {
|
|
||||||
"logo": "OpenTherm Gateway",
|
|
||||||
"nav": {
|
|
||||||
"license": "Licentie",
|
|
||||||
"source": "Broncode",
|
|
||||||
"help": "Help",
|
|
||||||
"issues": "Problemen & vragen",
|
|
||||||
"releases": "Releases"
|
|
||||||
},
|
|
||||||
"dbm": "dBm",
|
|
||||||
"kw": "kW",
|
|
||||||
"time": {
|
|
||||||
"days": "d.",
|
|
||||||
"hours": "u.",
|
|
||||||
"min": "min.",
|
|
||||||
"sec": "sec."
|
|
||||||
},
|
|
||||||
"button": {
|
|
||||||
"upgrade": "Upgraden",
|
|
||||||
"restart": "Herstarten",
|
|
||||||
"save": "Opslaan",
|
|
||||||
"saved": "Opgeslagen",
|
|
||||||
"refresh": "Vernieuwen",
|
|
||||||
"restore": "Herstellen",
|
|
||||||
"restored": "Hersteld",
|
|
||||||
"backup": "Back-up",
|
|
||||||
"wait": "Even wachten...",
|
|
||||||
"uploading": "Uploaden...",
|
|
||||||
"success": "Succes",
|
|
||||||
"error": "Fout"
|
|
||||||
},
|
|
||||||
"index": {
|
|
||||||
"title": "OpenTherm Gateway",
|
|
||||||
"section": {
|
|
||||||
"network": "Netwerk",
|
|
||||||
"system": "Systeem"
|
|
||||||
},
|
|
||||||
"system": {
|
|
||||||
"build": {
|
|
||||||
"title": "Build",
|
|
||||||
"version": "Versie",
|
|
||||||
"date": "Datum",
|
|
||||||
"core": "Core",
|
|
||||||
"sdk": "SDK"
|
|
||||||
},
|
|
||||||
"uptime": "Uptime",
|
|
||||||
"memory": {
|
|
||||||
"title": "Vrij geheugen",
|
|
||||||
"maxFreeBlock": "max. vrij blok",
|
|
||||||
"min": "min"
|
|
||||||
},
|
|
||||||
"board": "Board",
|
|
||||||
"chip": {
|
|
||||||
"model": "Chip",
|
|
||||||
"cores": "Kernen",
|
|
||||||
"freq": "frequentie"
|
|
||||||
},
|
|
||||||
"flash": {
|
|
||||||
"size": "Flash-grootte",
|
|
||||||
"realSize": "werkelijke grootte"
|
|
||||||
},
|
|
||||||
"lastResetReason": "Reden laatste herstart"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dashboard": {
|
|
||||||
"name": "Dashboard",
|
|
||||||
"title": "Dashboard - OpenTherm Gateway",
|
|
||||||
"section": {
|
|
||||||
"control": "Bediening",
|
|
||||||
"states": "Statussen",
|
|
||||||
"sensors": "Sensoren",
|
|
||||||
"diag": "OpenTherm diagnose"
|
|
||||||
},
|
|
||||||
"thermostat": {
|
|
||||||
"heating": "Verwarming",
|
|
||||||
"dhw": "Warm water",
|
|
||||||
"temp.current": "Huidig",
|
|
||||||
"enable": "Inschakelen",
|
|
||||||
"turbo": "Turbomodus"
|
|
||||||
},
|
|
||||||
"notify": {
|
|
||||||
"fault": {
|
|
||||||
"title": "Ketelstoring is actief!",
|
|
||||||
"note": "Het wordt aanbevolen de ketel te inspecteren en de documentatie te raadplegen om de storingscode te interpreteren:"
|
|
||||||
},
|
|
||||||
"diag": {
|
|
||||||
"title": "Keteldiagnose is actief!",
|
|
||||||
"note": "Heeft uw ketel misschien een inspectie nodig? Het wordt aanbevolen de documentatie te raadplegen om de diagnosecode te interpreteren:"
|
|
||||||
},
|
|
||||||
"reset": "Probeer te resetten"
|
|
||||||
},
|
|
||||||
"states": {
|
|
||||||
"mNetworkConnected": "Netwerkverbinding",
|
|
||||||
"mMqttConnected": "MQTT-verbinding",
|
|
||||||
"mEmergencyState": "Noodmodus",
|
|
||||||
"mExtPumpState": "Externe pomp",
|
|
||||||
"mCascadeControlInput": "Cascaderegeling (ingang)",
|
|
||||||
"mCascadeControlOutput": "Cascaderegeling (uitgang)",
|
|
||||||
"sConnected": "OpenTherm-verbinding",
|
|
||||||
"sFlame": "Vlam",
|
|
||||||
"sCoolingActive": "Koeling",
|
|
||||||
"sCoolingSetpoint": "Koelinstelpunt",
|
|
||||||
"sFaultActive": "Storing",
|
|
||||||
"sFaultCode": "Storingscode",
|
|
||||||
"sDiagActive": "Diagnose",
|
|
||||||
"sDiagCode": "Diagnosecode",
|
|
||||||
"mHeatEnabled": "Verwarming ingeschakeld",
|
|
||||||
"mHeatBlocking": "Verwarming geblokkeerd",
|
|
||||||
"mHeatOverheat": "Verwarming oververhit",
|
|
||||||
"sHeatActive": "Verwarming actief",
|
|
||||||
"mHeatSetpointTemp": "Insteltemperatuur verwarming",
|
|
||||||
"mHeatTargetTemp": "Doeltemperatuur verwarming",
|
|
||||||
"mHeatCurrTemp": "Huidige temperatuur verwarming",
|
|
||||||
"mHeatRetTemp": "Retourtemperatuur verwarming",
|
|
||||||
"mHeatIndoorTemp": "Verwarming, binnentemperatuur",
|
|
||||||
"mHeatOutdoorTemp": "Verwarming, buitentemperatuur",
|
|
||||||
"mDhwEnabled": "Warm water ingeschakeld",
|
|
||||||
"mDhwOverheat": "Warm water oververhit",
|
|
||||||
"sDhwActive": "Warm water actief",
|
|
||||||
"mDhwTargetTemp": "Doeltemperatuur warm water",
|
|
||||||
"mDhwCurrTemp": "Huidige temperatuur warm water",
|
|
||||||
"mDhwRetTemp": "Retourtemperatuur warm water"
|
|
||||||
},
|
|
||||||
"sensors": {
|
|
||||||
"values": {
|
|
||||||
"temp": "Temperatuur",
|
|
||||||
"humidity": "Luchtvochtigheid",
|
|
||||||
"battery": "Batterij",
|
|
||||||
"rssi": "RSSI"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"network": {
|
|
||||||
"title": "Netwerk - OpenTherm Gateway",
|
|
||||||
"name": "Netwerkinstellingen",
|
|
||||||
"section": {
|
|
||||||
"static": "Statische instellingen",
|
|
||||||
"ethernet": "Ethernet",
|
|
||||||
"availableNetworks": "Beschikbare netwerken",
|
|
||||||
"staSettings": "WiFi-instellingen",
|
|
||||||
"apSettings": "AP-instellingen"
|
|
||||||
},
|
|
||||||
"scan": {
|
|
||||||
"pos": "#",
|
|
||||||
"info": "Info",
|
|
||||||
"unavailable": "Schakel WiFi in om naar netwerken te zoeken"
|
|
||||||
},
|
|
||||||
|
|
||||||
"ethernet": {
|
|
||||||
"enable": "Ethernet inschakelen",
|
|
||||||
"notConfigured": "Vul alle zes GPIO-pinnen in om ethernet in te schakelen.",
|
|
||||||
"clk": "SPI-klok GPIO",
|
|
||||||
"mosi": "SPI MOSI GPIO",
|
|
||||||
"miso": "SPI MISO GPIO",
|
|
||||||
"cs": "SPI CS GPIO",
|
|
||||||
"irq": "Interrupt GPIO",
|
|
||||||
"rst": "Reset GPIO",
|
|
||||||
"note": "W5500 SPI-bedrading"
|
|
||||||
},
|
|
||||||
"wifi": {
|
|
||||||
"ssid": "SSID",
|
|
||||||
"password": "Wachtwoord",
|
|
||||||
"channel": "Kanaal",
|
|
||||||
"signal": "Signaal",
|
|
||||||
"connected": "Verbonden"
|
|
||||||
},
|
|
||||||
"params": {
|
|
||||||
"hostname": "Hostnaam",
|
|
||||||
"dhcp": "Gebruik DHCP",
|
|
||||||
"mac": "MAC",
|
|
||||||
"ip": "IP",
|
|
||||||
"subnet": "Subnet",
|
|
||||||
"gateway": "Gateway",
|
|
||||||
"dns": "DNS",
|
|
||||||
"connection": "Verbinding",
|
|
||||||
"connectionType": {
|
|
||||||
"ethernet": "Ethernet",
|
|
||||||
"wifi": "WiFi",
|
|
||||||
"wifi-ap": "WiFi AP",
|
|
||||||
"none": "Geen"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"sta": {
|
|
||||||
"channel.note": "zet op 0 voor automatische selectie"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"sensors": {
|
|
||||||
"title": "Sensorinstellingen - OpenTherm Gateway",
|
|
||||||
"name": "Sensorinstellingen",
|
|
||||||
"enabled": "Ingeschakeld",
|
|
||||||
"sensorName": {
|
|
||||||
"title": "Sensornaam",
|
|
||||||
"note": "Mag alleen bevatten: a-z, A-Z, 0-9, _ en spatie"
|
|
||||||
},
|
|
||||||
"purpose": "Doel",
|
|
||||||
"purposes": {
|
|
||||||
"outdoorTemp": "Buitentemperatuur",
|
|
||||||
"indoorTemp": "Binnentemperatuur",
|
|
||||||
"heatTemp": "Verwarming, temperatuur",
|
|
||||||
"heatRetTemp": "Verwarming, retourtemperatuur",
|
|
||||||
"dhwTemp": "Warm water, temperatuur",
|
|
||||||
"dhwRetTemp": "Warm water, retourtemperatuur",
|
|
||||||
"dhwFlowRate": "Warm water, doorstroomsnelheid",
|
|
||||||
"exhaustTemp": "Rookgastemperatuur",
|
|
||||||
"modLevel": "Modulatieniveau (in procenten)",
|
|
||||||
"number": "Getal (ruw)",
|
|
||||||
"powerFactor": "Vermogen (in procent)",
|
|
||||||
"power": "Vermogen (in kWt)",
|
|
||||||
"fanSpeed": "Ventilatorsnelheid",
|
|
||||||
"co2": "CO2",
|
|
||||||
"pressure": "Druk",
|
|
||||||
"humidity": "Luchtvochtigheid",
|
|
||||||
"temperature": "Temperatuur",
|
|
||||||
"notConfigured": "Niet geconfigureerd"
|
|
||||||
},
|
|
||||||
"type": "Type/bron",
|
|
||||||
"types": {
|
|
||||||
"otOutdoorTemp": "OpenTherm, buitentemp.",
|
|
||||||
"otHeatTemp": "OpenTherm, verwarming, temp.",
|
|
||||||
"otHeatRetTemp": "OpenTherm, verwarming, retourtemp.",
|
|
||||||
"otDhwTemp": "OpenTherm, warm water, temperatuur",
|
|
||||||
"otDhwTemp2": "OpenTherm, warm water, temperatuur 2",
|
|
||||||
"otDhwFlowRate": "OpenTherm, warm water, doorstroomsnelheid",
|
|
||||||
"otCh2Temp": "OpenTherm, kanaal 2, temp.",
|
|
||||||
"otExhaustTemp": "OpenTherm, rookgastemp.",
|
|
||||||
"otHeatExchangerTemp": "OpenTherm, warmtewisselaar temp.",
|
|
||||||
"otPressure": "OpenTherm, druk",
|
|
||||||
"otModLevel": "OpenTherm, modulatieniveau",
|
|
||||||
"otCurrentPower": "OpenTherm, huidig vermogen",
|
|
||||||
"otExhaustCo2": "OpenTherm, rookgas CO2",
|
|
||||||
"otExhaustFanSpeed": "OpenTherm, rookgasventilator snelheid",
|
|
||||||
"otSupplyFanSpeed": "OpenTherm, toevoerventilator snelheid",
|
|
||||||
"otSolarStorageTemp": "OpenTherm, zonneboiler opslagtemp.",
|
|
||||||
"otSolarCollectorTemp": "OpenTherm, zonnecollector temp.",
|
|
||||||
"otFanSpeedSetpoint": "OpenTherm, instelpunt ventilatorsnelheid",
|
|
||||||
"otFanSpeedCurrent": "OpenTherm, huidige ventilatorsnelheid",
|
|
||||||
"otBurnerStarts": "OpenTherm, aantal branderstarts",
|
|
||||||
"otDhwBurnerStarts": "OpenTherm, aantal branderstarts (warm water)",
|
|
||||||
"otHeatingPumpStarts": "OpenTherm, aantal pompstarts (verwarming)",
|
|
||||||
"otDhwPumpStarts": "OpenTherm, aantal pompstarts (warm water)",
|
|
||||||
"otBurnerHours": "OpenTherm, aantal branderuren",
|
|
||||||
"otDhwBurnerHours": "OpenTherm, aantal branderuren (warm water)",
|
|
||||||
"otHeatingPumpHours": "OpenTherm, aantal pompuren (verwarming)",
|
|
||||||
"otDhwPumpHours": "OpenTherm, aantal pompuren (warm water)",
|
|
||||||
"otCoolingHours": "OpenTherm, aantal cooling",
|
|
||||||
|
|
||||||
"ntcTemp": "NTC-sensor",
|
|
||||||
"dallasTemp": "DALLAS-sensor",
|
|
||||||
"bluetooth": "BLE-sensor",
|
|
||||||
"heatSetpointTemp": "Verwarming, insteltemperatuur",
|
|
||||||
"manual": "Handmatig via MQTT/API",
|
|
||||||
"notConfigured": "Niet geconfigureerd"
|
|
||||||
},
|
|
||||||
"gpio": "GPIO",
|
|
||||||
"address": {
|
|
||||||
"title": "Sensoradres",
|
|
||||||
"note": "Laat leeg voor automatische detectie van DALLAS-sensoren. Voor BLE-apparaten is een MAC-adres vereist."
|
|
||||||
},
|
|
||||||
"correction": {
|
|
||||||
"desc": "Correctie van waarden",
|
|
||||||
"offset": "Compensatie (offset)",
|
|
||||||
"factor": "Vermenigvuldiger"
|
|
||||||
},
|
|
||||||
"filtering": {
|
|
||||||
"desc": "Filteren van waarden",
|
|
||||||
"enabled": {
|
|
||||||
"title": "Filteren ingeschakeld",
|
|
||||||
"note": "Kan handig zijn bij veel scherpe ruis in de grafieken. Het gebruikte filter is \"Voortschrijdend gemiddelde\"."
|
|
||||||
},
|
|
||||||
"factor": {
|
|
||||||
"title": "Filterfactor",
|
|
||||||
"note": "Hoe lager de waarde, hoe vloeiender en <u>langer</u> de verandering in numerieke waarden."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"settings": {
|
|
||||||
"title": "Instellingen - OpenTherm Gateway",
|
|
||||||
"name": "Instellingen",
|
|
||||||
"section": {
|
|
||||||
"portal": "Portaalinstellingen",
|
|
||||||
"system": "Systeeminstellingen",
|
|
||||||
"diag": "Diagnose",
|
|
||||||
"heating": "Verwarmingsinstellingen",
|
|
||||||
"dhw": "Warmwaterinstellingen",
|
|
||||||
"emergency": "Instellingen noodmodus",
|
|
||||||
"equitherm": "Equitherm-instellingen",
|
|
||||||
"pid": "PID-instellingen",
|
|
||||||
"ot": "OpenTherm-instellingen",
|
|
||||||
"mqtt": "MQTT-instellingen",
|
|
||||||
"extPump": "Instellingen externe pomp",
|
|
||||||
"cascadeControl": "Instellingen cascaderegeling"
|
|
||||||
},
|
|
||||||
"enable": "Inschakelen",
|
|
||||||
"note": {
|
|
||||||
"restart": "Na het wijzigen van deze instellingen moet het apparaat opnieuw worden opgestart om de wijzigingen door te voeren.",
|
|
||||||
"blankNotUse": "leeg - niet gebruiken",
|
|
||||||
"bleDevice": "BLE-apparaat kan <u>alleen</u> worden gebruikt met sommige ESP32-boards met BLE-ondersteuning!"
|
|
||||||
},
|
|
||||||
"temp": {
|
|
||||||
"min": "Minimumtemperatuur",
|
|
||||||
"max": "Maximumtemperatuur"
|
|
||||||
},
|
|
||||||
"maxModulation": "Max. modulatieniveau",
|
|
||||||
"ohProtection": {
|
|
||||||
"title": "Oververhittingsbeveiliging",
|
|
||||||
"desc": "<b>Let op:</b> Deze functie kan handig zijn als de ingebouwde oververhittingsbeveiliging van de ketel niet of niet correct werkt en de warmtedrager kookt. Om uit te schakelen, stel 0 in als <b>hoge</b> en <b>lage</b> temperatuur.",
|
|
||||||
"highTemp": {
|
|
||||||
"title": "Drempelwaarde hoge temperatuur",
|
|
||||||
"note": "Drempelwaarde waarbij de brander geforceerd wordt uitgeschakeld"
|
|
||||||
},
|
|
||||||
"lowTemp": {
|
|
||||||
"title": "Drempelwaarde lage temperatuur",
|
|
||||||
"note": "Drempelwaarde waarbij de brander weer ingeschakeld kan worden"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"freezeProtection": {
|
|
||||||
"title": "Vorbeveiliging",
|
|
||||||
"desc": "Verwarming zal geforceerd worden ingeschakeld als de temperatuur van de warmtedrager of de binnentemperatuur daalt onder de <b>Lage temperatuurdrempel</b>.",
|
|
||||||
"highTemp": {
|
|
||||||
"title": "Hoge temperatuurdrempel",
|
|
||||||
"note": "Drempel waarna het systeem terugkeert naar de normale modus na activering van de vorbeveiliging"
|
|
||||||
},
|
|
||||||
"lowTemp": {
|
|
||||||
"title": "Lage temperatuurdrempel",
|
|
||||||
"note": "Drempel wanneer de verwarming geforceerd wordt ingeschakeld"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"portal": {
|
|
||||||
"login": "Gebruikersnaam",
|
|
||||||
"password": "Wachtwoord",
|
|
||||||
"auth": "Authenticatie vereisen",
|
|
||||||
"mdns": "Gebruik mDNS"
|
|
||||||
},
|
|
||||||
"system": {
|
|
||||||
"unit": "Eenheidssysteem",
|
|
||||||
"metric": "Metrisch <small>(celsius, liters, bar)</small>",
|
|
||||||
"imperial": "Imperiaal <small>(fahrenheit, gallons, psi)</small>",
|
|
||||||
"statusLedGpio": "Status LED GPIO",
|
|
||||||
"logLevel": "Logniveau",
|
|
||||||
"serial": {
|
|
||||||
"enable": "Seriële poort ingeschakeld",
|
|
||||||
"baud": "Baudrate seriële poort"
|
|
||||||
},
|
|
||||||
"telnet": {
|
|
||||||
"enable": "Telnet ingeschakeld",
|
|
||||||
"port": {
|
|
||||||
"title": "Telnet-poort",
|
|
||||||
"note": "Standaard: 23"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ntp": {
|
|
||||||
"server": "NTP-server",
|
|
||||||
"timezone": "Tijdzone",
|
|
||||||
"timezonePresets": "Selecteer voorinstelling..."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"heating": {
|
|
||||||
"hyst": {
|
|
||||||
"title": "Hysterese",
|
|
||||||
"desc": "Hysterese is nuttig voor het handhaven van een ingestelde binnentemperatuur (bij gebruik van «Equitherm» en/of «PID»). Forceert uitschakelen van verwarming wanneer <code>current indoor > target + value</code> en inschakelen van verwarming wanneer <code>current indoor < (target - value)</code>.",
|
|
||||||
"value": "Waarde <small>(in graden)</small>",
|
|
||||||
"action": {
|
|
||||||
"title": "Actie",
|
|
||||||
"disableHeating": "Verwarming uitschakelen",
|
|
||||||
"set0target": "Stel null target in"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"turboFactor": "Turbomodus coëff."
|
|
||||||
},
|
|
||||||
"emergency": {
|
|
||||||
"desc": "Noodmodus wordt automatisch geactiveerd wanneer «PID» of «Equitherm» het instelpunt van de warmtedrager niet kan berekenen:<br />- als «Equitherm» is ingeschakeld en de buitentemperatuursensor is losgekoppeld;<br />- als «PID» of OT-optie <i>«Natuurlijke verwarmingsregeling»</i> is ingeschakeld en de binnentemperatuursensor is losgekoppeld.<br /><b>Let op:</b> Bij een netwerk- of MQTT-storing krijgen sensoren van het type <i>«Handmatig via MQTT/API»</i> de status ONVERBONDEN.",
|
|
||||||
"target": {
|
|
||||||
"title": "Doeltemperatuur",
|
|
||||||
"note": "<b>Belangrijk:</b> <u>Doel binnentemperatuur</u> als OT-optie <i>«Natuurlijke verwarmingsregeling»</i> is ingeschakeld.<br />In alle andere gevallen, de <u>doel warmtedragertemperatuur</u>."
|
|
||||||
},
|
|
||||||
"treshold": "Drempeltijd <small>(sec)</small>"
|
|
||||||
},
|
|
||||||
"equitherm": {
|
|
||||||
"slope": {
|
|
||||||
"title": "Helling",
|
|
||||||
"note": "Compensatie voor warmteverlies. Hoofdafstelparameter."
|
|
||||||
},
|
|
||||||
"exponent": {
|
|
||||||
"title": "Exponent",
|
|
||||||
"note": "Radiator efficiëntie. Typische waarden: <code>1.1</code> - Vloerverwarming, <code>1.2</code> - Gietijzer, <code>1.3</code> - Paneelradiatoren, <code>1.4</code> - Convectors."
|
|
||||||
},
|
|
||||||
"shift": {
|
|
||||||
"title": "Verschuiving",
|
|
||||||
"note": "Compenseert voor extra warmteverliezen (bijv. in leidingen) of extra warmtebronnen."
|
|
||||||
},
|
|
||||||
"targetDiffFactor": {
|
|
||||||
"title": "T factor",
|
|
||||||
"note": "Niet gebruikt als PID is ingeschakeld. Voegt aan de setpoint de verschil tussen de target en huidige binnentemperatuur toe: <code>setpoint = setpoint + ((target - indoor) * T)</code>."
|
|
||||||
},
|
|
||||||
"chart": {
|
|
||||||
"targetTemp": "Doel binnentemperatuur",
|
|
||||||
"setpointTemp": "Warmtedrager temperatuur",
|
|
||||||
"outdoorTemp": "Buitentemperatuur"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"pid": {
|
|
||||||
"p": "P-factor",
|
|
||||||
"i": "I-factor",
|
|
||||||
"d": "D-factor",
|
|
||||||
"dt": "DT <small>in seconden</small>",
|
|
||||||
"limits": {
|
|
||||||
"title": "Limieten",
|
|
||||||
"note": "<b>Belangrijk:</b> Bij gelijktijdig gebruik van «Equitherm» en «PID» beperken de min- en maxtemperaturen de invloed op de resulterende «Equitherm»-temperatuur.<br />Dus, als de min-temperatuur is ingesteld op -15 en de max-temperatuur op 15, zal het uiteindelijke instelpunt van de warmtedrager liggen tussen <code>equitherm_resultaat - 15</code> en <code>equitherm_resultaat + 15</code>."
|
|
||||||
},
|
|
||||||
"deadband": {
|
|
||||||
"title": "Deadband",
|
|
||||||
"note": "Deadband is een bereik rond de doeltemperatuur waarbinnen de PID-regeling minder actief wordt. Binnen dit bereik kan het algoritme de intensiteit verminderen of aanpassingen pauzeren om overreactie op kleine schommelingen te voorkomen.<br /><br />Bijvoorbeeld, met een doeltemperatuur van 22°, een onderdrempel van 1.0 en een bovendrempel van 0.5, werkt de deadband tussen 21° en 22.5°. Als de I-coëfficiënt 0.0005 is en de I-vermenigvuldiger 0.05, dan wordt de I-coëfficiënt binnen de deadband: <code>0.0005 * 0.05 = 0.000025</code>",
|
|
||||||
"p_multiplier": "Vermenigvuldiger voor P-factor",
|
|
||||||
"i_multiplier": "Vermenigvuldiger voor I-factor",
|
|
||||||
"d_multiplier": "Vermenigvuldiger voor D-factor",
|
|
||||||
"thresholdHigh": "Bovendrempel",
|
|
||||||
"thresholdLow": "Onderdrempel"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ot": {
|
|
||||||
"advanced": "Geavanceerde instellingen",
|
|
||||||
"inGpio": "In GPIO",
|
|
||||||
"outGpio": "Uit GPIO",
|
|
||||||
"ledGpio": "RX LED GPIO",
|
|
||||||
"memberId": "Master member ID",
|
|
||||||
"flags": "Master flags",
|
|
||||||
"minPower": {
|
|
||||||
"title": "Min. ketelvermogen <small>(kW)</small>",
|
|
||||||
"note": "Deze waarde is bij 0-1% modulatieniveau van de ketel. Typisch te vinden in de ketelspecificatie als \"minimum nuttig warmtevermogen\"."
|
|
||||||
},
|
|
||||||
"maxPower": {
|
|
||||||
"title": "Max. ketelvermogen <small>(kW)</small>",
|
|
||||||
"note": "<b>0</b> - probeer automatisch te detecteren. Typisch te vinden in de ketelspecificatie als \"maximum nuttig warmtevermogen\"."
|
|
||||||
},
|
|
||||||
"options": {
|
|
||||||
"title": "Opties (aanvullende instellingen)",
|
|
||||||
"desc": "Opties kunnen de logica van de ketel veranderen. Niet alle opties zijn gedocumenteerd in het protocol, dus dezelfde optie kan verschillende effecten hebben op verschillende ketels.<br /><b>Let op:</b> Het is niet nodig om iets te veranderen als alles goed werkt.",
|
|
||||||
"dhwSupport": "Warm water ondersteuning",
|
|
||||||
"coolingSupport": "Koeling ondersteuning",
|
|
||||||
"summerWinterMode": "Zomer/wintermodus",
|
|
||||||
"heatingStateToSummerWinterMode": "Verwarmingsstatus als zomer/wintermodus",
|
|
||||||
"ch2AlwaysEnabled": "CH2 altijd ingeschakeld",
|
|
||||||
"heatingToCh2": "Dupliceer verwarming naar CH2",
|
|
||||||
"dhwToCh2": "Dupliceer warm water naar CH2",
|
|
||||||
"dhwBlocking": "Blokkering warm water",
|
|
||||||
"dhwStateAsDhwBlocking": "Status warm water als blokkering warm water",
|
|
||||||
"maxTempSyncWithTargetTemp": "Synchroniseer max. verwarmingstemp. met doeltemp.",
|
|
||||||
"getMinMaxTemp": "Haal min/max temp. op van ketel",
|
|
||||||
"ignoreDiagState": "Negeer diagnosestatus",
|
|
||||||
"autoFaultReset": "Automatische storingsreset <small>(niet aanbevolen!)</small>",
|
|
||||||
"autoDiagReset": "Automatische diagnosereset <small>(niet aanbevolen!)</small>",
|
|
||||||
"setDateAndTime": "Stel datum & tijd in op ketel",
|
|
||||||
"immergasFix": "Fix voor Immergas-ketels",
|
|
||||||
"alwaysSendIndoorTemp": "Stuur huidige binnentemp naar ketel"
|
|
||||||
},
|
|
||||||
|
|
||||||
"nativeOTC": {
|
|
||||||
"title": "Native warmtedrager temperatuur berekeningsmodus",
|
|
||||||
"note": "Werkt <u>ALLEEN</u> als de ketel in OTC-modus is: vereist en accepteert de doel binnentemperatuur en regelt zelf de warmtedrager temperatuur op basis van de ingebouwde curves modus. Incompatibel met PID en Equitherm."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mqtt": {
|
|
||||||
"homeAssistantDiscovery": "Home Assistant Discovery",
|
|
||||||
"server": "Server",
|
|
||||||
"port": "Poort",
|
|
||||||
"user": "Gebruiker",
|
|
||||||
"password": "Wachtwoord",
|
|
||||||
"prefix": "Prefix",
|
|
||||||
"interval": "Publicatie-interval <small>(sec)</small>"
|
|
||||||
},
|
|
||||||
"extPump": {
|
|
||||||
"use": "Gebruik externe pomp",
|
|
||||||
"gpio": "Relais GPIO",
|
|
||||||
"invertState": "Inverteer GPIO-status",
|
|
||||||
"postCirculationTime": "Nacirculatietijd <small>(min)</small>",
|
|
||||||
"antiStuckInterval": "Anti-vastloopinterval <small>(dagen)</small>",
|
|
||||||
"antiStuckTime": "Anti-vastlooptijd <small>(min)</small>"
|
|
||||||
},
|
|
||||||
"cascadeControl": {
|
|
||||||
"input": {
|
|
||||||
"desc": "Kan worden gebruikt om de verwarming alleen in te schakelen als een andere ketel defect is. De besturing van de andere ketel moet de status van de GPIO-ingang wijzigen in geval van een storing.",
|
|
||||||
"enable": "Ingang ingeschakeld",
|
|
||||||
"gpio": "GPIO",
|
|
||||||
"invertState": "Inverteer GPIO-status",
|
|
||||||
"thresholdTime": "Drempeltijd statuswijziging <small>(sec)</small>"
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
"desc": "Kan worden gebruikt om een andere ketel in te schakelen <u>via een relais</u>.",
|
|
||||||
"enable": "Uitgang ingeschakeld",
|
|
||||||
"gpio": "GPIO",
|
|
||||||
"invertState": "Inverteer GPIO-status",
|
|
||||||
"thresholdTime": "Drempeltijd statuswijziging <small>(sec)</small>",
|
|
||||||
"events": {
|
|
||||||
"desc": "Gebeurtenissen",
|
|
||||||
"onFault": "Als de storingsstatus actief is",
|
|
||||||
"onLossConnection": "Als de verbinding via Opentherm is verbroken",
|
|
||||||
"onEnabledHeating": "Als de verwarming is ingeschakeld"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"upgrade": {
|
|
||||||
"title": "Upgrade - OpenTherm Gateway",
|
|
||||||
"name": "Upgrade",
|
|
||||||
"section": {
|
|
||||||
"backupAndRestore": "Back-up & herstel",
|
|
||||||
"backupAndRestore.desc": "In deze sectie kunt u een back-up van ALLE instellingen opslaan en herstellen.",
|
|
||||||
"upgrade": "Upgrade",
|
|
||||||
"upgrade.desc": "In deze sectie kunt u de firmware en het bestandssysteem van uw apparaat upgraden.<br />De nieuwste releases kunnen worden gedownload van de <a href=\"https://github.com/Laxilef/OTGateway/releases\" target=\"_blank\">Releases-pagina</a> van de projectrepository."
|
|
||||||
},
|
|
||||||
"note": {
|
|
||||||
"disclaimer1": "Na een succesvolle upgrade van het bestandssysteem worden ALLE instellingen teruggezet naar de standaardwaarden! Sla een back-up op voordat u gaat upgraden.",
|
|
||||||
"disclaimer2": "Na een succesvolle upgrade zal het apparaat automatisch herstarten na 15 seconden."
|
|
||||||
},
|
|
||||||
"settingsFile": "Instellingenbestand",
|
|
||||||
"fw": "Firmware",
|
|
||||||
"fs": "Bestandssysteem"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+13
-53
@@ -109,8 +109,7 @@
|
|||||||
|
|
||||||
"sConnected": "Подключение к OpenTherm",
|
"sConnected": "Подключение к OpenTherm",
|
||||||
"sFlame": "Пламя",
|
"sFlame": "Пламя",
|
||||||
"sCoolingActive": "Охлаждение",
|
"sCooling": "Охлаждение",
|
||||||
"sCoolingSetpoint": "Охлаждение, уставка",
|
|
||||||
"sFaultActive": "Ошибка",
|
"sFaultActive": "Ошибка",
|
||||||
"sFaultCode": "Код ошибки",
|
"sFaultCode": "Код ошибки",
|
||||||
"sDiagActive": "Диагностика",
|
"sDiagActive": "Диагностика",
|
||||||
@@ -151,7 +150,6 @@
|
|||||||
|
|
||||||
"section": {
|
"section": {
|
||||||
"static": "Статические параметры",
|
"static": "Статические параметры",
|
||||||
"ethernet": "Ethernet",
|
|
||||||
"availableNetworks": "Доступные сети",
|
"availableNetworks": "Доступные сети",
|
||||||
"staSettings": "Настройки подключения",
|
"staSettings": "Настройки подключения",
|
||||||
"apSettings": "Настройки точки доступа"
|
"apSettings": "Настройки точки доступа"
|
||||||
@@ -159,20 +157,7 @@
|
|||||||
|
|
||||||
"scan": {
|
"scan": {
|
||||||
"pos": "#",
|
"pos": "#",
|
||||||
"info": "Инфо",
|
"info": "Инфо"
|
||||||
"unavailable": "Включите WiFi, чтобы искать сети"
|
|
||||||
},
|
|
||||||
|
|
||||||
"ethernet": {
|
|
||||||
"enable": "Включить ethernet",
|
|
||||||
"notConfigured": "Заполните все шесть выводов GPIO, чтобы включить ethernet.",
|
|
||||||
"clk": "GPIO тактирования SPI",
|
|
||||||
"mosi": "GPIO MOSI SPI",
|
|
||||||
"miso": "GPIO MISO SPI",
|
|
||||||
"cs": "GPIO CS SPI",
|
|
||||||
"irq": "GPIO прерывания",
|
|
||||||
"rst": "GPIO сброса",
|
|
||||||
"note": "Подключение W5500 по SPI"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"wifi": {
|
"wifi": {
|
||||||
@@ -190,14 +175,7 @@
|
|||||||
"ip": "IP адрес",
|
"ip": "IP адрес",
|
||||||
"subnet": "Адрес подсети",
|
"subnet": "Адрес подсети",
|
||||||
"gateway": "Адрес шлюза",
|
"gateway": "Адрес шлюза",
|
||||||
"dns": "DNS адрес",
|
"dns": "DNS адрес"
|
||||||
"connection": "Подключение",
|
|
||||||
"connectionType": {
|
|
||||||
"ethernet": "Ethernet",
|
|
||||||
"wifi": "WiFi",
|
|
||||||
"wifi-ap": "WiFi AP",
|
|
||||||
"none": "Нет"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"sta": {
|
"sta": {
|
||||||
@@ -264,7 +242,6 @@
|
|||||||
"otDhwBurnerHours": "OpenTherm, кол-во часов работы горелки (ГВС)",
|
"otDhwBurnerHours": "OpenTherm, кол-во часов работы горелки (ГВС)",
|
||||||
"otHeatingPumpHours": "OpenTherm, кол-во часов работы насоса (отопление)",
|
"otHeatingPumpHours": "OpenTherm, кол-во часов работы насоса (отопление)",
|
||||||
"otDhwPumpHours": "OpenTherm, кол-во часов работы насоса (ГВС)",
|
"otDhwPumpHours": "OpenTherm, кол-во часов работы насоса (ГВС)",
|
||||||
"otCoolingHours": "OpenTherm, кол-во часов работы охлаждения",
|
|
||||||
|
|
||||||
"ntcTemp": "NTC датчик",
|
"ntcTemp": "NTC датчик",
|
||||||
"dallasTemp": "DALLAS датчик",
|
"dallasTemp": "DALLAS датчик",
|
||||||
@@ -341,15 +318,9 @@
|
|||||||
},
|
},
|
||||||
"freezeProtection": {
|
"freezeProtection": {
|
||||||
"title": "Защита от замерзания",
|
"title": "Защита от замерзания",
|
||||||
"desc": "Отопление будет принудительно включено, если темп. теплоносителя или внутренняя темп. опустится ниже <b>нижнего порога</b>.",
|
"desc": "Отопление будет принудительно включено, если темп. теплоносителя или внутренняя темп. опустится ниже <b>нижнего порога</b> в течение <b>времени ожидания</b>.",
|
||||||
"highTemp": {
|
"lowTemp": "Нижний порог температуры",
|
||||||
"title": "Верхний порог температуры",
|
"thresholdTime": "Время ожидания <small>(сек)</small>"
|
||||||
"note": "Порог, при котором система вернется в нормальное состояние после активации защиты от замерзания"
|
|
||||||
},
|
|
||||||
"lowTemp": {
|
|
||||||
"title": "Нижний порог температуры",
|
|
||||||
"note": "Порог, при котором отопление будет принудительно включено"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"portal": {
|
"portal": {
|
||||||
@@ -384,16 +355,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"heating": {
|
"heating": {
|
||||||
"hyst": {
|
"hyst": "Гистерезис <small>(в градусах)</small>",
|
||||||
"title": "Гистерезис",
|
|
||||||
"desc": "Гистерезис полезен для поддержания заданной внутр. темп. (при использовании «ПЗА» и/или «ПИД»). Принудительно откл. отопление, когда <code>current indoor > target + value</code>, и вкл. отопление, когда <code>current indoor < (target - value)</code>.",
|
|
||||||
"value": "Значение <small>(в градусах)</small>",
|
|
||||||
"action": {
|
|
||||||
"title": "Действие",
|
|
||||||
"disableHeating": "Отключить отопление",
|
|
||||||
"set0target": "Установить 0 в качестве целевой темп."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"turboFactor": "Коэфф. турбо режима"
|
"turboFactor": "Коэфф. турбо режима"
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -414,7 +376,7 @@
|
|||||||
},
|
},
|
||||||
"exponent": {
|
"exponent": {
|
||||||
"title": "Экспонента",
|
"title": "Экспонента",
|
||||||
"note": "Эффективность радиатора. Типичные значения: <code>1.1</code> - Тёплый пол, <code>1.2</code> - Чугунные радиаторы, <code>1.3</code> - Панельные радиаторы, <code>1.4</code> - Конвекторы."
|
"note": "Эффективность радиатора. Типичные значения: 1.1 - Тёплый пол, 1.2 - Чугунные радиаторы, 1.3 - Панельные радиаторы, 1.4 - Конвекторы."
|
||||||
},
|
},
|
||||||
"shift": {
|
"shift": {
|
||||||
"title": "Смещение",
|
"title": "Смещение",
|
||||||
@@ -422,7 +384,7 @@
|
|||||||
},
|
},
|
||||||
"targetDiffFactor": {
|
"targetDiffFactor": {
|
||||||
"title": "Коэффициент T",
|
"title": "Коэффициент T",
|
||||||
"note": "Не используется, если ПИД включен. Добавляет разницу между целевой и текущей температурой в помещении: <code>setpoint = setpoint + ((target - indoor) * T)</code>."
|
"note": "Не используется, если ПИД включен"
|
||||||
},
|
},
|
||||||
"chart": {
|
"chart": {
|
||||||
"targetTemp": "Целевая внутренняя температура",
|
"targetTemp": "Целевая внутренняя температура",
|
||||||
@@ -485,13 +447,12 @@
|
|||||||
"autoFaultReset": "Автоматический сброс ошибок <small>(не рекомендуется!)</small>",
|
"autoFaultReset": "Автоматический сброс ошибок <small>(не рекомендуется!)</small>",
|
||||||
"autoDiagReset": "Автоматический сброс диагностики <small>(не рекомендуется!)</small>",
|
"autoDiagReset": "Автоматический сброс диагностики <small>(не рекомендуется!)</small>",
|
||||||
"setDateAndTime": "Устанавливать время и дату на котле",
|
"setDateAndTime": "Устанавливать время и дату на котле",
|
||||||
"immergasFix": "Фикс для котлов Immergas",
|
"immergasFix": "Фикс для котлов Immergas"
|
||||||
"alwaysSendIndoorTemp": "Передавать текущую темп. в помещении котлу"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"nativeOTC": {
|
"nativeHeating": {
|
||||||
"title": "Нативный режим OTC (расчёт температуры теплоносителя)",
|
"title": "Передать управление отоплением котлу",
|
||||||
"note": "Работает <u>ТОЛЬКО</u> если котел в режиме OTC: требует и принимает целевую температуру в помещении и сам регулирует температуру теплоносителя на основе встроенного режима кривых. Несовместимо с ПИД и ПЗА."
|
"note": "Работает <u>ТОЛЬКО</u> если котел требует и принимает целевую температуру в помещении и сам регулирует температуру теплоносителя на основе встроенного режима кривых. Несовместимо с ПИД и ПЗА."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -508,7 +469,6 @@
|
|||||||
"extPump": {
|
"extPump": {
|
||||||
"use": "Использовать доп. насос",
|
"use": "Использовать доп. насос",
|
||||||
"gpio": "GPIO реле",
|
"gpio": "GPIO реле",
|
||||||
"invertState": "Инвертировать состояние GPIO",
|
|
||||||
"postCirculationTime": "Время постциркуляции <small>(в минутах)</small>",
|
"postCirculationTime": "Время постциркуляции <small>(в минутах)</small>",
|
||||||
"antiStuckInterval": "Интервал защиты от блокировки <small>(в днях)</small>",
|
"antiStuckInterval": "Интервал защиты от блокировки <small>(в днях)</small>",
|
||||||
"antiStuckTime": "Время работы насоса <small>(в минутах)</small>"
|
"antiStuckTime": "Время работы насоса <small>(в минутах)</small>"
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
<option value="en" selected>EN</option>
|
<option value="en" selected>EN</option>
|
||||||
<option value="cn">CN</option>
|
<option value="cn">CN</option>
|
||||||
<option value="it">IT</option>
|
<option value="it">IT</option>
|
||||||
<option value="nl">NL</option>
|
|
||||||
<option value="ru">RU</option>
|
<option value="ru">RU</option>
|
||||||
</select>
|
</select>
|
||||||
</li>
|
</li>
|
||||||
@@ -154,14 +153,9 @@
|
|||||||
<th scope="row" data-i18n>dashboard.states.sFlame</th>
|
<th scope="row" data-i18n>dashboard.states.sFlame</th>
|
||||||
<td><i class="sFlame"></i></td>
|
<td><i class="sFlame"></i></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row" data-i18n>dashboard.states.sCoolingActive</th>
|
<th scope="row" data-i18n>dashboard.states.sCooling</th>
|
||||||
<td><i class="sCoolingActive"></i></td>
|
<td><i class="sCooling"></i></td>
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row" data-i18n>dashboard.states.sCoolingSetpoint</th>
|
|
||||||
<td><b class="sCoolingSetpoint"></b> %</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
@@ -195,10 +189,6 @@
|
|||||||
<th scope="row" data-i18n>dashboard.states.mHeatOverheat</th>
|
<th scope="row" data-i18n>dashboard.states.mHeatOverheat</th>
|
||||||
<td><i class="mHeatOverheat"></i></td>
|
<td><i class="mHeatOverheat"></i></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<th scope="row" data-i18n>dashboard.states.mHeatFreezing</th>
|
|
||||||
<td><i class="mHeatFreezing"></i></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row" data-i18n>dashboard.states.sHeatActive</th>
|
<th scope="row" data-i18n>dashboard.states.sHeatActive</th>
|
||||||
<td><i class="sHeatActive"></i></td>
|
<td><i class="sHeatActive"></i></td>
|
||||||
@@ -324,7 +314,7 @@
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
const lang = new Lang(document.getElementById('lang'));
|
const lang = new Lang(document.getElementById('lang'));
|
||||||
await lang.build();
|
lang.build();
|
||||||
|
|
||||||
let actionTimer = null;
|
let actionTimer = null;
|
||||||
let actionLongPress = false;
|
let actionLongPress = false;
|
||||||
@@ -567,9 +557,7 @@
|
|||||||
result.slave.connected ? "green" : "red"
|
result.slave.connected ? "green" : "red"
|
||||||
);
|
);
|
||||||
setState('.sFlame', result.slave.flame);
|
setState('.sFlame', result.slave.flame);
|
||||||
|
setState('.sCooling', result.slave.cooling);
|
||||||
setState('.sCoolingActive', result.slave.cooling.active);
|
|
||||||
setValue('.sCoolingSetpoint', result.slave.cooling.setpoint);
|
|
||||||
|
|
||||||
setValue('.sModMin', result.slave.modulation.min);
|
setValue('.sModMin', result.slave.modulation.min);
|
||||||
setValue('.sModMax', result.slave.modulation.max);
|
setValue('.sModMax', result.slave.modulation.max);
|
||||||
@@ -637,11 +625,6 @@
|
|||||||
result.master.heating.overheat ? "success" : "error",
|
result.master.heating.overheat ? "success" : "error",
|
||||||
result.master.heating.overheat ? "red" : "green"
|
result.master.heating.overheat ? "red" : "green"
|
||||||
);
|
);
|
||||||
setStatus(
|
|
||||||
'.mHeatFreezing',
|
|
||||||
result.master.heating.freezing ? "success" : "error",
|
|
||||||
result.master.heating.freezing ? "red" : "green"
|
|
||||||
);
|
|
||||||
setValue('.mHeatSetpointTemp', result.master.heating.setpointTemp);
|
setValue('.mHeatSetpointTemp', result.master.heating.setpointTemp);
|
||||||
setValue('.mHeatTargetTemp', result.master.heating.targetTemp);
|
setValue('.mHeatTargetTemp', result.master.heating.targetTemp);
|
||||||
setValue('.mHeatCurrTemp', result.master.heating.currentTemp);
|
setValue('.mHeatCurrTemp', result.master.heating.currentTemp);
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
<option value="en" selected>EN</option>
|
<option value="en" selected>EN</option>
|
||||||
<option value="cn">CN</option>
|
<option value="cn">CN</option>
|
||||||
<option value="it">IT</option>
|
<option value="it">IT</option>
|
||||||
<option value="nl">NL</option>
|
|
||||||
<option value="ru">RU</option>
|
<option value="ru">RU</option>
|
||||||
</select>
|
</select>
|
||||||
</li>
|
</li>
|
||||||
@@ -50,19 +49,15 @@
|
|||||||
<th scope="row" data-i18n>network.params.mac</th>
|
<th scope="row" data-i18n>network.params.mac</th>
|
||||||
<td><b id="network-mac"></b></td>
|
<td><b id="network-mac"></b></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<th scope="row" data-i18n>network.params.connection</th>
|
|
||||||
<td><b id="network-connection"></b></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row" data-i18n>network.wifi.connected</th>
|
<th scope="row" data-i18n>network.wifi.connected</th>
|
||||||
<td><i id="network-connected"></i></td>
|
<td><i id="network-connected"></i></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="network-ssid-row">
|
<tr>
|
||||||
<th scope="row" data-i18n>network.wifi.ssid</th>
|
<th scope="row" data-i18n>network.wifi.ssid</th>
|
||||||
<td><b id="network-ssid"></b></td>
|
<td><b id="network-ssid"></b></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="network-signal-row">
|
<tr>
|
||||||
<th scope="row" data-i18n>network.wifi.signal</th>
|
<th scope="row" data-i18n>network.wifi.signal</th>
|
||||||
<td><b id="network-signal"></b> %</td>
|
<td><b id="network-signal"></b> %</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -173,7 +168,7 @@
|
|||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
const lang = new Lang(document.getElementById('lang'));
|
const lang = new Lang(document.getElementById('lang'));
|
||||||
await lang.build();
|
lang.build();
|
||||||
|
|
||||||
setTimeout(async function onLoadPage() {
|
setTimeout(async function onLoadPage() {
|
||||||
try {
|
try {
|
||||||
@@ -196,7 +191,6 @@
|
|||||||
|
|
||||||
setValue('#network-hostname', result.network.hostname);
|
setValue('#network-hostname', result.network.hostname);
|
||||||
setValue('#network-mac', result.network.mac);
|
setValue('#network-mac', result.network.mac);
|
||||||
setValue('#network-connection', i18n(`network.params.connectionType.${result.network.connectionType}`));
|
|
||||||
setStatus(
|
setStatus(
|
||||||
'#network-connected',
|
'#network-connected',
|
||||||
result.network.connected ? "success" : "error",
|
result.network.connected ? "success" : "error",
|
||||||
@@ -204,14 +198,6 @@
|
|||||||
);
|
);
|
||||||
setValue('#network-ssid', result.network.ssid);
|
setValue('#network-ssid', result.network.ssid);
|
||||||
setValue('#network-signal', result.network.signalQuality);
|
setValue('#network-signal', result.network.signalQuality);
|
||||||
|
|
||||||
// SSID and signal strength only describe the uplink when WiFi carries it; with
|
|
||||||
// ethernet up the radio is parked and both values are meaningless
|
|
||||||
const wifiUplink = result.network.connectionType === "wifi";
|
|
||||||
|
|
||||||
document.getElementById("network-ssid-row")?.classList.toggle("hidden", !wifiUplink);
|
|
||||||
document.getElementById("network-signal-row")?.classList.toggle("hidden", !wifiUplink);
|
|
||||||
|
|
||||||
setValue('#network-ip', result.network.ip);
|
setValue('#network-ip', result.network.ip);
|
||||||
setValue('#network-subnet', result.network.subnet);
|
setValue('#network-subnet', result.network.subnet);
|
||||||
setValue('#network-gateway', result.network.gateway);
|
setValue('#network-gateway', result.network.gateway);
|
||||||
|
|||||||
+4
-114
@@ -23,7 +23,6 @@
|
|||||||
<option value="en" selected>EN</option>
|
<option value="en" selected>EN</option>
|
||||||
<option value="cn">CN</option>
|
<option value="cn">CN</option>
|
||||||
<option value="it">IT</option>
|
<option value="it">IT</option>
|
||||||
<option value="nl">NL</option>
|
|
||||||
<option value="ru">RU</option>
|
<option value="ru">RU</option>
|
||||||
</select>
|
</select>
|
||||||
</li>
|
</li>
|
||||||
@@ -79,7 +78,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
<div>
|
<div>
|
||||||
<hgroup>
|
<hgroup>
|
||||||
@@ -101,7 +99,6 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p id="scan-unavailable" class="hidden" data-i18n>network.scan.unavailable</p>
|
|
||||||
<button type="submit" data-i18n>button.refresh</button>
|
<button type="submit" data-i18n>button.refresh</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@@ -164,62 +161,6 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<article id="ethernet-section" class="hidden">
|
|
||||||
<div>
|
|
||||||
<hgroup>
|
|
||||||
<h3 data-i18n>network.section.ethernet</h3>
|
|
||||||
<p></p>
|
|
||||||
</hgroup>
|
|
||||||
|
|
||||||
<div id="ethernet-settings-busy" aria-busy="true"></div>
|
|
||||||
<form action="/api/network/settings" id="ethernet-settings" class="hidden">
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" name="ethernet[enabled]" value="true">
|
|
||||||
<span data-i18n>network.ethernet.enable</span>
|
|
||||||
</label>
|
|
||||||
<small id="ethernet-not-configured" class="hidden" data-i18n>network.ethernet.notConfigured</small>
|
|
||||||
|
|
||||||
<div class="grid">
|
|
||||||
<label>
|
|
||||||
<span data-i18n>network.ethernet.clk</span>
|
|
||||||
<input type="number" inputmode="numeric" name="ethernet[pins][clk]" min="0" max="254" step="1">
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label>
|
|
||||||
<span data-i18n>network.ethernet.mosi</span>
|
|
||||||
<input type="number" inputmode="numeric" name="ethernet[pins][mosi]" min="0" max="254" step="1">
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label>
|
|
||||||
<span data-i18n>network.ethernet.miso</span>
|
|
||||||
<input type="number" inputmode="numeric" name="ethernet[pins][miso]" min="0" max="254" step="1">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid">
|
|
||||||
<label>
|
|
||||||
<span data-i18n>network.ethernet.cs</span>
|
|
||||||
<input type="number" inputmode="numeric" name="ethernet[pins][cs]" min="0" max="254" step="1">
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label>
|
|
||||||
<span data-i18n>network.ethernet.irq</span>
|
|
||||||
<input type="number" inputmode="numeric" name="ethernet[pins][irq]" min="0" max="254" step="1">
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label>
|
|
||||||
<span data-i18n>network.ethernet.rst</span>
|
|
||||||
<input type="number" inputmode="numeric" name="ethernet[pins][rst]" min="0" max="254" step="1">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<small data-i18n>network.ethernet.note</small>
|
|
||||||
|
|
||||||
<button type="submit" data-i18n>button.save</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer class="container">
|
<footer class="container">
|
||||||
@@ -237,7 +178,7 @@
|
|||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
const lang = new Lang(document.getElementById('lang'));
|
const lang = new Lang(document.getElementById('lang'));
|
||||||
await lang.build();
|
lang.build();
|
||||||
|
|
||||||
const fillData = (data) => {
|
const fillData = (data) => {
|
||||||
setInputValue("[name='hostname']", data.hostname);
|
setInputValue("[name='hostname']", data.hostname);
|
||||||
@@ -248,29 +189,6 @@
|
|||||||
setInputValue("[name='staticConfig[dns]']", data.staticConfig.dns);
|
setInputValue("[name='staticConfig[dns]']", data.staticConfig.dns);
|
||||||
setBusy('#network-settings-busy', '#network-settings', false);
|
setBusy('#network-settings-busy', '#network-settings', false);
|
||||||
|
|
||||||
const ethernet = data.ethernet || {};
|
|
||||||
const ethernetConfigured = !!ethernet.configured;
|
|
||||||
const ethernetPins = ethernet.pins || {};
|
|
||||||
const pinValue = (value) => (value ?? 255) < 255 ? value : '';
|
|
||||||
|
|
||||||
setInputValue("[name='ethernet[pins][clk]']", pinValue(ethernetPins.clk));
|
|
||||||
setInputValue("[name='ethernet[pins][mosi]']", pinValue(ethernetPins.mosi));
|
|
||||||
setInputValue("[name='ethernet[pins][miso]']", pinValue(ethernetPins.miso));
|
|
||||||
setInputValue("[name='ethernet[pins][cs]']", pinValue(ethernetPins.cs));
|
|
||||||
setInputValue("[name='ethernet[pins][irq]']", pinValue(ethernetPins.irq));
|
|
||||||
setInputValue("[name='ethernet[pins][rst]']", pinValue(ethernetPins.rst));
|
|
||||||
|
|
||||||
setCheckboxValue("[name='ethernet[enabled]']", ethernetConfigured ? !!ethernet.enabled : false);
|
|
||||||
|
|
||||||
const ethernetCheckbox = document.querySelector("[name='ethernet[enabled]']");
|
|
||||||
if (ethernetCheckbox) {
|
|
||||||
ethernetCheckbox.disabled = !ethernetConfigured;
|
|
||||||
}
|
|
||||||
|
|
||||||
document.getElementById('ethernet-not-configured')?.classList.toggle('hidden', ethernetConfigured);
|
|
||||||
|
|
||||||
setBusy('#ethernet-settings-busy', '#ethernet-settings', false);
|
|
||||||
|
|
||||||
setInputValue("[name='sta[ssid]']", data.sta.ssid);
|
setInputValue("[name='sta[ssid]']", data.sta.ssid);
|
||||||
setInputValue("[name='sta[password]']", data.sta.password);
|
setInputValue("[name='sta[password]']", data.sta.password);
|
||||||
setInputValue("[name='sta[channel]']", data.sta.channel);
|
setInputValue("[name='sta[channel]']", data.sta.channel);
|
||||||
@@ -282,49 +200,21 @@
|
|||||||
setBusy('#ap-settings-busy', '#ap-settings', false);
|
setBusy('#ap-settings-busy', '#ap-settings', false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const applyCapabilities = (info) => {
|
|
||||||
// pages and firmware ship together: the section stays hidden unless the build says it can do ethernet
|
|
||||||
const supported = info?.features?.ethernet === true;
|
|
||||||
|
|
||||||
document.getElementById('ethernet-section')?.classList.toggle('hidden', !supported);
|
|
||||||
|
|
||||||
return supported;
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const [response, infoResponse] = await Promise.all([
|
const response = await fetch("/api/network/settings", {
|
||||||
fetch("/api/network/settings", {
|
|
||||||
cache: "no-cache",
|
cache: "no-cache",
|
||||||
credentials: "include"
|
credentials: "include"
|
||||||
}),
|
});
|
||||||
fetch("/api/info", {
|
|
||||||
cache: "no-cache",
|
|
||||||
credentials: "include"
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error('Response not valid');
|
throw new Error('Response not valid');
|
||||||
}
|
}
|
||||||
|
|
||||||
const info = infoResponse.ok ? await infoResponse.json() : null;
|
|
||||||
const ethernetSupported = applyCapabilities(info);
|
|
||||||
|
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
fillData(result);
|
fillData(result);
|
||||||
|
|
||||||
setupForm('#network-settings', fillData, ['hostname']);
|
setupForm('#network-settings', fillData, ['hostname']);
|
||||||
|
setupNetworkScanForm('#network-scan', '#networks');
|
||||||
// scanning needs the radio, which stays parked while ethernet carries the uplink
|
|
||||||
const radioParked = info?.network?.connectionType === 'ethernet';
|
|
||||||
setupNetworkScanForm('#network-scan', '#networks', !radioParked);
|
|
||||||
document.querySelector('#network-scan button[type="submit"]').disabled = radioParked;
|
|
||||||
document.querySelector('#scan-unavailable').classList.toggle('hidden', !radioParked);
|
|
||||||
|
|
||||||
if (ethernetSupported) {
|
|
||||||
setupForm('#ethernet-settings', fillData);
|
|
||||||
}
|
|
||||||
|
|
||||||
setupForm('#sta-settings', fillData, ['sta.ssid', 'sta.password']);
|
setupForm('#sta-settings', fillData, ['sta.ssid', 'sta.password']);
|
||||||
setupForm('#ap-settings', fillData, ['ap.ssid', 'ap.password']);
|
setupForm('#ap-settings', fillData, ['ap.ssid', 'ap.password']);
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
<option value="en" selected>EN</option>
|
<option value="en" selected>EN</option>
|
||||||
<option value="cn">CN</option>
|
<option value="cn">CN</option>
|
||||||
<option value="it">IT</option>
|
<option value="it">IT</option>
|
||||||
<option value="nl">NL</option>
|
|
||||||
<option value="ru">RU</option>
|
<option value="ru">RU</option>
|
||||||
</select>
|
</select>
|
||||||
</li>
|
</li>
|
||||||
@@ -38,8 +37,6 @@
|
|||||||
<p></p>
|
<p></p>
|
||||||
</hgroup>
|
</hgroup>
|
||||||
|
|
||||||
<small id="ble-not-supported" class="hidden" data-i18n>settings.note.bleDevice</small>
|
|
||||||
|
|
||||||
<details id="template" class="sensor hidden" data-id="" data-preloaded="0">
|
<details id="template" class="sensor hidden" data-id="" data-preloaded="0">
|
||||||
<summary><b>#<span class="pos"></span>: <span class="name"></span></b></summary>
|
<summary><b>#<span class="pos"></span>: <span class="name"></span></b></summary>
|
||||||
|
|
||||||
@@ -115,11 +112,10 @@
|
|||||||
<option value="24" data-i18n>sensors.types.otDhwBurnerHours</option>
|
<option value="24" data-i18n>sensors.types.otDhwBurnerHours</option>
|
||||||
<option value="25" data-i18n>sensors.types.otHeatingPumpHours</option>
|
<option value="25" data-i18n>sensors.types.otHeatingPumpHours</option>
|
||||||
<option value="26" data-i18n>sensors.types.otDhwPumpHours</option>
|
<option value="26" data-i18n>sensors.types.otDhwPumpHours</option>
|
||||||
<option value="27" data-i18n>sensors.types.otCoolingHours</option>
|
|
||||||
|
|
||||||
<option value="50" data-i18n>sensors.types.ntcTemp</option>
|
<option value="50" data-i18n>sensors.types.ntcTemp</option>
|
||||||
<option value="51" data-i18n>sensors.types.dallasTemp</option>
|
<option value="51" data-i18n>sensors.types.dallasTemp</option>
|
||||||
<option value="52" data-requires="ble" disabled data-i18n>sensors.types.bluetooth</option>
|
<option value="52" data-i18n>sensors.types.bluetooth</option>
|
||||||
<option value="253" data-i18n>sensors.types.heatSetpointTemp</option>
|
<option value="253" data-i18n>sensors.types.heatSetpointTemp</option>
|
||||||
<option value="254" data-i18n>sensors.types.manual</option>
|
<option value="254" data-i18n>sensors.types.manual</option>
|
||||||
<option value="255" data-i18n>sensors.types.notConfigured</option>
|
<option value="255" data-i18n>sensors.types.notConfigured</option>
|
||||||
@@ -203,43 +199,21 @@
|
|||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", async () => {
|
document.addEventListener("DOMContentLoaded", async () => {
|
||||||
const lang = new Lang(document.getElementById("lang"));
|
const lang = new Lang(document.getElementById("lang"));
|
||||||
await lang.build();
|
lang.build();
|
||||||
|
|
||||||
const container = document.querySelector("article");
|
const container = document.querySelector("article");
|
||||||
const templateNode = container.querySelector("#template");
|
const templateNode = container.querySelector("#template");
|
||||||
|
|
||||||
let bleSupported = false;
|
|
||||||
|
|
||||||
const applyCapabilities = (info, root) => {
|
|
||||||
// pages and firmware ship together: BLE stays disabled unless the build says it has the stack
|
|
||||||
bleSupported = info?.features?.ble === true;
|
|
||||||
|
|
||||||
root.querySelectorAll('[data-requires="ble"]').forEach((option) => {
|
|
||||||
option.disabled = !bleSupported;
|
|
||||||
});
|
|
||||||
|
|
||||||
document.getElementById("ble-not-supported")?.classList.toggle("hidden", bleSupported);
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const [response, infoResponse] = await Promise.all([
|
const response = await fetch("/api/sensors", {
|
||||||
fetch("/api/sensors", {
|
|
||||||
cache: "no-cache",
|
cache: "no-cache",
|
||||||
credentials: "include"
|
credentials: "include"
|
||||||
}),
|
});
|
||||||
fetch("/api/info", {
|
|
||||||
cache: "no-cache",
|
|
||||||
credentials: "include"
|
|
||||||
})
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error("Response not valid");
|
throw new Error("Response not valid");
|
||||||
}
|
}
|
||||||
|
|
||||||
const info = infoResponse.ok ? await infoResponse.json() : null;
|
|
||||||
applyCapabilities(info, templateNode);
|
|
||||||
|
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
for (const sensorId in result) {
|
for (const sensorId in result) {
|
||||||
const sensorNode = templateNode.cloneNode(true);
|
const sensorNode = templateNode.cloneNode(true);
|
||||||
@@ -311,12 +285,6 @@
|
|||||||
|
|
||||||
// ble
|
// ble
|
||||||
case 52:
|
case 52:
|
||||||
if (!bleSupported) {
|
|
||||||
parentGpio.classList.add("hidden");
|
|
||||||
parentAddress.classList.add("hidden");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
parentGpio.classList.add("hidden");
|
parentGpio.classList.add("hidden");
|
||||||
parentAddress.classList.remove("hidden");
|
parentAddress.classList.remove("hidden");
|
||||||
address.setAttribute("pattern", "([A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2}");
|
address.setAttribute("pattern", "([A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2}");
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
<option value="en" selected>EN</option>
|
<option value="en" selected>EN</option>
|
||||||
<option value="cn">CN</option>
|
<option value="cn">CN</option>
|
||||||
<option value="it">IT</option>
|
<option value="it">IT</option>
|
||||||
<option value="nl">NL</option>
|
|
||||||
<option value="ru">RU</option>
|
<option value="ru">RU</option>
|
||||||
</select>
|
</select>
|
||||||
</li>
|
</li>
|
||||||
@@ -193,48 +192,21 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
|
<label>
|
||||||
|
<span data-i18n>settings.heating.hyst</span>
|
||||||
|
<input type="number" inputmode="decimal" name="heating[hysteresis]" min="0" max="5" step="0.05" required>
|
||||||
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<span data-i18n>settings.heating.turboFactor</span>
|
<span data-i18n>settings.heating.turboFactor</span>
|
||||||
<input type="number" inputmode="decimal" name="heating[turboFactor]" min="1.5" max="10" step="0.1" required>
|
<input type="number" inputmode="decimal" name="heating[turboFactor]" min="1.5" max="10" step="0.1" required>
|
||||||
</label>
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<span data-i18n>settings.maxModulation</span>
|
<span data-i18n>settings.maxModulation</span>
|
||||||
<input type="number" inputmode="numeric" name="heating[maxModulation]" min="1" max="100" step="1" required>
|
<input type="number" inputmode="numeric" name="heating[maxModulation]" min="1" max="100" step="1" required>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr />
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b data-i18n>settings.heating.hyst.title</b></summary>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<fieldset>
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" name="heating[hysteresis][enabled]" value="true">
|
|
||||||
<span data-i18n>settings.enable</span>
|
|
||||||
</label>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<div class="grid">
|
|
||||||
<label>
|
|
||||||
<span data-i18n>settings.heating.hyst.value</span>
|
|
||||||
<input type="number" inputmode="decimal" name="heating[hysteresis][value]" min="0" max="5" step="0.05" required>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<label>
|
|
||||||
<span data-i18n>settings.heating.hyst.action.title</span>
|
|
||||||
<select name="heating[hysteresis][action]">
|
|
||||||
<option value="0" data-i18n>settings.heating.hyst.action.disableHeating</option>
|
|
||||||
<option value="1" data-i18n>settings.heating.hyst.action.set0target</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<small data-i18n>settings.heating.hyst.desc</small>
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
@@ -265,15 +237,13 @@
|
|||||||
|
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<label>
|
<label>
|
||||||
<span data-i18n>settings.freezeProtection.highTemp.title</span>
|
<span data-i18n>settings.freezeProtection.lowTemp</span>
|
||||||
<input type="number" inputmode="numeric" name="heating[freezeProtection][highTemp]" min="0" max="0" step="1" required>
|
<input type="number" inputmode="numeric" name="heating[freezeProtection][lowTemp]" min="0" max="0" step="1" required>
|
||||||
<small data-i18n>settings.freezeProtection.highTemp.note</small>
|
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<span data-i18n>settings.freezeProtection.lowTemp.title</span>
|
<span data-i18n>settings.freezeProtection.thresholdTime</span>
|
||||||
<input type="number" inputmode="numeric" name="heating[freezeProtection][lowTemp]" min="0" max="0" step="1" required>
|
<input type="number" inputmode="numeric" name="heating[freezeProtection][thresholdTime]" min="30" max="1800" step="1" required>
|
||||||
<small data-i18n>settings.freezeProtection.lowTemp.note</small>
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -694,17 +664,12 @@
|
|||||||
<span data-i18n>settings.ot.options.immergasFix</span>
|
<span data-i18n>settings.ot.options.immergasFix</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" name="opentherm[options][alwaysSendIndoorTemp]" value="true">
|
|
||||||
<span data-i18n>settings.ot.options.alwaysSendIndoorTemp</span>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="opentherm[options][nativeOTC]" value="true">
|
<input type="checkbox" name="opentherm[options][nativeHeatingControl]" value="true">
|
||||||
<span data-i18n>settings.ot.nativeOTC.title</span><br />
|
<span data-i18n>settings.ot.nativeHeating.title</span><br />
|
||||||
<small data-i18n>settings.ot.nativeOTC.note</small>
|
<small data-i18n>settings.ot.nativeHeating.note</small>
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
@@ -788,11 +753,6 @@
|
|||||||
<input type="checkbox" name="externalPump[use]" value="true">
|
<input type="checkbox" name="externalPump[use]" value="true">
|
||||||
<span data-i18n>settings.extPump.use</span>
|
<span data-i18n>settings.extPump.use</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" name="externalPump[invertState]" value="true">
|
|
||||||
<span data-i18n>settings.externalPump.invertState</span>
|
|
||||||
</label>
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
@@ -927,7 +887,7 @@
|
|||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
const lang = new Lang(document.getElementById('lang'));
|
const lang = new Lang(document.getElementById('lang'));
|
||||||
await lang.build();
|
lang.build();
|
||||||
|
|
||||||
let etChart = null;
|
let etChart = null;
|
||||||
let etChartConfig = {
|
let etChartConfig = {
|
||||||
@@ -937,8 +897,7 @@
|
|||||||
unitSystem: null,
|
unitSystem: null,
|
||||||
targetTemp: null,
|
targetTemp: null,
|
||||||
minTemp: null,
|
minTemp: null,
|
||||||
maxTemp: null,
|
maxTemp: null
|
||||||
decimated: false
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const hasNeedDecimationChart = () => {
|
const hasNeedDecimationChart = () => {
|
||||||
@@ -956,7 +915,7 @@
|
|||||||
datasets: [{
|
datasets: [{
|
||||||
borderColor: (context) => {
|
borderColor: (context) => {
|
||||||
const chart = context.chart;
|
const chart = context.chart;
|
||||||
const { ctx, chartArea } = chart;
|
const {ctx, chartArea} = chart;
|
||||||
|
|
||||||
if (!chartArea) {
|
if (!chartArea) {
|
||||||
return;
|
return;
|
||||||
@@ -998,6 +957,12 @@
|
|||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
display: false
|
display: false
|
||||||
|
},
|
||||||
|
decimation: {
|
||||||
|
enabled: hasNeedDecimationChart(),
|
||||||
|
algorithm: 'lttb',
|
||||||
|
samples: 30,
|
||||||
|
threshold: 30
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
scales: {
|
scales: {
|
||||||
@@ -1043,18 +1008,19 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let data = [];
|
while (etChart.data.datasets[0].data.length) {
|
||||||
etChartConfig.decimated = hasNeedDecimationChart();
|
etChart.data.datasets[0].data.pop();
|
||||||
for (let value = 30; value >= -30; value -= etChartConfig.decimated ? 2 : 1) {
|
}
|
||||||
|
|
||||||
|
for (let value = 30; value >= -30; value--) {
|
||||||
const outdoorTemp = etChartConfig.unitSystem == 0 ? value : c2f(value);
|
const outdoorTemp = etChartConfig.unitSystem == 0 ? value : c2f(value);
|
||||||
|
|
||||||
data.push({
|
etChart.data.datasets[0].data.push({
|
||||||
x: parseFloat(outdoorTemp.toFixed(1)),
|
x: parseFloat(outdoorTemp.toFixed(1)),
|
||||||
y: parseFloat(calculateEquithermTemp(outdoorTemp).toFixed(1))
|
y: parseFloat(calculateEquithermTemp(outdoorTemp).toFixed(1))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
etChart.data.datasets[0].data = data;
|
|
||||||
etChart.data.datasets[0].label = i18n("settings.equitherm.chart.setpointTemp");
|
etChart.data.datasets[0].label = i18n("settings.equitherm.chart.setpointTemp");
|
||||||
etChart.options.scales.x.title.text = i18n("settings.equitherm.chart.outdoorTemp");
|
etChart.options.scales.x.title.text = i18n("settings.equitherm.chart.outdoorTemp");
|
||||||
etChart.options.scales.y.title.text = i18n("settings.equitherm.chart.setpointTemp");
|
etChart.options.scales.y.title.text = i18n("settings.equitherm.chart.setpointTemp");
|
||||||
@@ -1124,9 +1090,8 @@
|
|||||||
setCheckboxValue("[name='opentherm[options][autoFaultReset]']", data.opentherm.options.autoFaultReset);
|
setCheckboxValue("[name='opentherm[options][autoFaultReset]']", data.opentherm.options.autoFaultReset);
|
||||||
setCheckboxValue("[name='opentherm[options][autoDiagReset]']", data.opentherm.options.autoDiagReset);
|
setCheckboxValue("[name='opentherm[options][autoDiagReset]']", data.opentherm.options.autoDiagReset);
|
||||||
setCheckboxValue("[name='opentherm[options][setDateAndTime]']", data.opentherm.options.setDateAndTime);
|
setCheckboxValue("[name='opentherm[options][setDateAndTime]']", data.opentherm.options.setDateAndTime);
|
||||||
setCheckboxValue("[name='opentherm[options][nativeOTC]']", data.opentherm.options.nativeOTC);
|
setCheckboxValue("[name='opentherm[options][nativeHeatingControl]']", data.opentherm.options.nativeHeatingControl);
|
||||||
setCheckboxValue("[name='opentherm[options][immergasFix]']", data.opentherm.options.immergasFix);
|
setCheckboxValue("[name='opentherm[options][immergasFix]']", data.opentherm.options.immergasFix);
|
||||||
setCheckboxValue("[name='opentherm[options][alwaysSendIndoorTemp]']", data.opentherm.options.alwaysSendIndoorTemp);
|
|
||||||
setBusy('#ot-settings-busy', '#ot-settings', false);
|
setBusy('#ot-settings-busy', '#ot-settings', false);
|
||||||
|
|
||||||
// MQTT
|
// MQTT
|
||||||
@@ -1143,7 +1108,6 @@
|
|||||||
// Extpump
|
// Extpump
|
||||||
setCheckboxValue("[name='externalPump[use]']", data.externalPump.use);
|
setCheckboxValue("[name='externalPump[use]']", data.externalPump.use);
|
||||||
setInputValue("[name='externalPump[gpio]']", data.externalPump.gpio < 255 ? data.externalPump.gpio : '');
|
setInputValue("[name='externalPump[gpio]']", data.externalPump.gpio < 255 ? data.externalPump.gpio : '');
|
||||||
setCheckboxValue("[name='externalPump[invertState]']", data.externalPump.invertState);
|
|
||||||
setInputValue("[name='externalPump[postCirculationTime]']", data.externalPump.postCirculationTime);
|
setInputValue("[name='externalPump[postCirculationTime]']", data.externalPump.postCirculationTime);
|
||||||
setInputValue("[name='externalPump[antiStuckInterval]']", data.externalPump.antiStuckInterval);
|
setInputValue("[name='externalPump[antiStuckInterval]']", data.externalPump.antiStuckInterval);
|
||||||
setInputValue("[name='externalPump[antiStuckTime]']", data.externalPump.antiStuckTime);
|
setInputValue("[name='externalPump[antiStuckTime]']", data.externalPump.antiStuckTime);
|
||||||
@@ -1173,9 +1137,7 @@
|
|||||||
"min": data.system.unitSystem == 0 ? 1 : 33,
|
"min": data.system.unitSystem == 0 ? 1 : 33,
|
||||||
"max": data.system.unitSystem == 0 ? 100 : 212
|
"max": data.system.unitSystem == 0 ? 100 : 212
|
||||||
});
|
});
|
||||||
setCheckboxValue("[name='heating[hysteresis][enabled]']", data.heating.hysteresis.enabled);
|
setInputValue("[name='heating[hysteresis]']", data.heating.hysteresis);
|
||||||
setInputValue("[name='heating[hysteresis][value]']", data.heating.hysteresis.value);
|
|
||||||
setSelectValue("[name='heating[hysteresis][action]']", data.heating.hysteresis.action);
|
|
||||||
setInputValue("[name='heating[turboFactor]']", data.heating.turboFactor);
|
setInputValue("[name='heating[turboFactor]']", data.heating.turboFactor);
|
||||||
setInputValue("[name='heating[maxModulation]']", data.heating.maxModulation);
|
setInputValue("[name='heating[maxModulation]']", data.heating.maxModulation);
|
||||||
setInputValue("[name='heating[overheatProtection][highTemp]']", data.heating.overheatProtection.highTemp, {
|
setInputValue("[name='heating[overheatProtection][highTemp]']", data.heating.overheatProtection.highTemp, {
|
||||||
@@ -1186,14 +1148,11 @@
|
|||||||
"min": 0,
|
"min": 0,
|
||||||
"max": data.system.unitSystem == 0 ? 99 : 211
|
"max": data.system.unitSystem == 0 ? 99 : 211
|
||||||
});
|
});
|
||||||
setInputValue("[name='heating[freezeProtection][highTemp]']", data.heating.freezeProtection.highTemp, {
|
|
||||||
"min": data.system.unitSystem == 0 ? 1 : 34,
|
|
||||||
"max": data.system.unitSystem == 0 ? 50 : 122
|
|
||||||
});
|
|
||||||
setInputValue("[name='heating[freezeProtection][lowTemp]']", data.heating.freezeProtection.lowTemp, {
|
setInputValue("[name='heating[freezeProtection][lowTemp]']", data.heating.freezeProtection.lowTemp, {
|
||||||
"min": data.system.unitSystem == 0 ? 1 : 34,
|
"min": data.system.unitSystem == 0 ? 1 : 34,
|
||||||
"max": data.system.unitSystem == 0 ? 30 : 86
|
"max": data.system.unitSystem == 0 ? 30 : 86
|
||||||
});
|
});
|
||||||
|
setInputValue("[name='heating[freezeProtection][thresholdTime]']", data.heating.freezeProtection.thresholdTime);
|
||||||
setBusy('#heating-settings-busy', '#heating-settings', false);
|
setBusy('#heating-settings-busy', '#heating-settings', false);
|
||||||
|
|
||||||
// DHW
|
// DHW
|
||||||
@@ -1217,7 +1176,7 @@
|
|||||||
setBusy('#dhw-settings-busy', '#dhw-settings', false);
|
setBusy('#dhw-settings-busy', '#dhw-settings', false);
|
||||||
|
|
||||||
// Emergency mode
|
// Emergency mode
|
||||||
if (data.opentherm.options.nativeOTC) {
|
if (data.opentherm.options.nativeHeatingControl) {
|
||||||
setInputValue("[name='emergency[target]']", data.emergency.target, {
|
setInputValue("[name='emergency[target]']", data.emergency.target, {
|
||||||
"min": data.system.unitSystem == 0 ? 5 : 41,
|
"min": data.system.unitSystem == 0 ? 5 : 41,
|
||||||
"max": data.system.unitSystem == 0 ? 40 : 104
|
"max": data.system.unitSystem == 0 ? 40 : 104
|
||||||
@@ -1377,8 +1336,9 @@
|
|||||||
if (etChart) {
|
if (etChart) {
|
||||||
etChart.resize();
|
etChart.resize();
|
||||||
|
|
||||||
if (etChartConfig.decimated != hasNeedDecimationChart()) {
|
if (etChart.options.plugins.decimation.enabled != hasNeedDecimationChart()) {
|
||||||
makeEquithermChart();
|
etChart.options.plugins.decimation.enabled = hasNeedDecimationChart();
|
||||||
|
etChart.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
<option value="en" selected>EN</option>
|
<option value="en" selected>EN</option>
|
||||||
<option value="cn">CN</option>
|
<option value="cn">CN</option>
|
||||||
<option value="it">IT</option>
|
<option value="it">IT</option>
|
||||||
<option value="nl">NL</option>
|
|
||||||
<option value="ru">RU</option>
|
<option value="ru">RU</option>
|
||||||
</select>
|
</select>
|
||||||
</li>
|
</li>
|
||||||
@@ -105,7 +104,7 @@
|
|||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
const lang = new Lang(document.getElementById('lang'));
|
const lang = new Lang(document.getElementById('lang'));
|
||||||
await lang.build();
|
lang.build();
|
||||||
|
|
||||||
setupRestoreBackupForm('#restore');
|
setupRestoreBackupForm('#restore');
|
||||||
setupUpgradeForm('#upgrade');
|
setupUpgradeForm('#upgrade');
|
||||||
|
|||||||
@@ -1,14 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* Skipped minification because the original files appears to be already minified.
|
||||||
|
* Original file: /npm/chart.js@4.4.8/dist/chart.umd.js
|
||||||
|
*
|
||||||
|
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
||||||
|
*/
|
||||||
/*!
|
/*!
|
||||||
* Chart.js v4.5.0
|
* Chart.js v4.4.8
|
||||||
* https://www.chartjs.org
|
* https://www.chartjs.org
|
||||||
* (c) 2025 Chart.js Contributors
|
* (c) 2025 Chart.js Contributors
|
||||||
* Released under the MIT License
|
* Released under the MIT License
|
||||||
*/
|
*/
|
||||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Chart=e()}(this,(function(){"use strict";var t=Object.freeze({__proto__:null,get Colors(){return Jo},get Decimation(){return ta},get Filler(){return ba},get Legend(){return Ma},get SubTitle(){return Pa},get Title(){return ka},get Tooltip(){return Na}});function e(){}const i=(()=>{let t=0;return()=>t++})();function s(t){return null==t}function n(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function o(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function a(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function r(t,e){return a(t)?t:e}function l(t,e){return void 0===t?e:t}const h=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:+t/e,c=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function d(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function u(t,e,i,s){let a,r,l;if(n(t))if(r=t.length,s)for(a=r-1;a>=0;a--)e.call(i,t[a],a);else for(a=0;a<r;a++)e.call(i,t[a],a);else if(o(t))for(l=Object.keys(t),r=l.length,a=0;a<r;a++)e.call(i,t[l[a]],l[a])}function f(t,e){let i,s,n,o;if(!t||!e||t.length!==e.length)return!1;for(i=0,s=t.length;i<s;++i)if(n=t[i],o=e[i],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function g(t){if(n(t))return t.map(g);if(o(t)){const e=Object.create(null),i=Object.keys(t),s=i.length;let n=0;for(;n<s;++n)e[i[n]]=g(t[i[n]]);return e}return t}function p(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function m(t,e,i,s){if(!p(t))return;const n=e[t],a=i[t];o(n)&&o(a)?x(n,a,s):e[t]=g(a)}function x(t,e,i){const s=n(e)?e:[e],a=s.length;if(!o(t))return t;const r=(i=i||{}).merger||m;let l;for(let e=0;e<a;++e){if(l=s[e],!o(l))continue;const n=Object.keys(l);for(let e=0,s=n.length;e<s;++e)r(n[e],t,l,i)}return t}function b(t,e){return x(t,e,{merger:_})}function _(t,e,i){if(!p(t))return;const s=e[t],n=i[t];o(s)&&o(n)?b(s,n):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=g(n))}const y={"":t=>t,x:t=>t.x,y:t=>t.y};function v(t){const e=t.split("."),i=[];let s="";for(const t of e)s+=t,s.endsWith("\\")?s=s.slice(0,-1)+".":(i.push(s),s="");return i}function M(t,e){const i=y[e]||(y[e]=function(t){const e=v(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function w(t){return t.charAt(0).toUpperCase()+t.slice(1)}const k=t=>void 0!==t,S=t=>"function"==typeof t,P=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};function D(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}const C=Math.PI,O=2*C,A=O+C,T=Number.POSITIVE_INFINITY,L=C/180,E=C/2,R=C/4,I=2*C/3,z=Math.log10,F=Math.sign;function V(t,e,i){return Math.abs(t-e)<i}function B(t){const e=Math.round(t);t=V(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(z(t))),s=t/i;return(s<=1?1:s<=2?2:s<=5?5:10)*i}function W(t){const e=[],i=Math.sqrt(t);let s;for(s=1;s<i;s++)t%s==0&&(e.push(s),e.push(t/s));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}function N(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function H(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}function j(t,e,i){let s,n,o;for(s=0,n=t.length;s<n;s++)o=t[s][i],isNaN(o)||(e.min=Math.min(e.min,o),e.max=Math.max(e.max,o))}function $(t){return t*(C/180)}function Y(t){return t*(180/C)}function U(t){if(!a(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function X(t,e){const i=e.x-t.x,s=e.y-t.y,n=Math.sqrt(i*i+s*s);let o=Math.atan2(s,i);return o<-.5*C&&(o+=O),{angle:o,distance:n}}function q(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function K(t,e){return(t-e+A)%O-C}function G(t){return(t%O+O)%O}function J(t,e,i,s){const n=G(t),o=G(e),a=G(i),r=G(o-n),l=G(a-n),h=G(n-o),c=G(n-a);return n===o||n===a||s&&o===a||r>l&&h<c}function Z(t,e,i){return Math.max(e,Math.min(i,t))}function Q(t){return Z(t,-32768,32767)}function tt(t,e,i,s=1e-6){return t>=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function et(t,e,i){i=i||(i=>t[i]<e);let s,n=t.length-1,o=0;for(;n-o>1;)s=o+n>>1,i(s)?o=s:n=s;return{lo:o,hi:n}}const it=(t,e,i,s)=>et(t,i,s?s=>{const n=t[s][e];return n<i||n===i&&t[s+1][e]===i}:s=>t[s][e]<i),st=(t,e,i)=>et(t,i,(s=>t[s][e]>=i));function nt(t,e,i){let s=0,n=t.length;for(;s<n&&t[s]<e;)s++;for(;n>s&&t[n-1]>i;)n--;return s>0||n<t.length?t.slice(s,n):t}const ot=["push","pop","shift","splice","unshift"];function at(t,e){t._chartjs?t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),ot.forEach((e=>{const i="_onData"+w(e),s=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value(...eLine truncated
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Chart=e()}(this,(function(){"use strict";var t=Object.freeze({__proto__:null,get Colors(){return Go},get Decimation(){return Qo},get Filler(){return ma},get Legend(){return ya},get SubTitle(){return ka},get Title(){return Ma},get Tooltip(){return Ba}});function e(){}const i=(()=>{let t=0;return()=>t++})();function s(t){return null==t}function n(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function o(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function a(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function r(t,e){return a(t)?t:e}function l(t,e){return void 0===t?e:t}const h=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:+t/e,c=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function d(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function u(t,e,i,s){let a,r,l;if(n(t))if(r=t.length,s)for(a=r-1;a>=0;a--)e.call(i,t[a],a);else for(a=0;a<r;a++)e.call(i,t[a],a);else if(o(t))for(l=Object.keys(t),r=l.length,a=0;a<r;a++)e.call(i,t[l[a]],l[a])}function f(t,e){let i,s,n,o;if(!t||!e||t.length!==e.length)return!1;for(i=0,s=t.length;i<s;++i)if(n=t[i],o=e[i],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function g(t){if(n(t))return t.map(g);if(o(t)){const e=Object.create(null),i=Object.keys(t),s=i.length;let n=0;for(;n<s;++n)e[i[n]]=g(t[i[n]]);return e}return t}function p(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function m(t,e,i,s){if(!p(t))return;const n=e[t],a=i[t];o(n)&&o(a)?x(n,a,s):e[t]=g(a)}function x(t,e,i){const s=n(e)?e:[e],a=s.length;if(!o(t))return t;const r=(i=i||{}).merger||m;let l;for(let e=0;e<a;++e){if(l=s[e],!o(l))continue;const n=Object.keys(l);for(let e=0,s=n.length;e<s;++e)r(n[e],t,l,i)}return t}function b(t,e){return x(t,e,{merger:_})}function _(t,e,i){if(!p(t))return;const s=e[t],n=i[t];o(s)&&o(n)?b(s,n):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=g(n))}const y={"":t=>t,x:t=>t.x,y:t=>t.y};function v(t){const e=t.split("."),i=[];let s="";for(const t of e)s+=t,s.endsWith("\\")?s=s.slice(0,-1)+".":(i.push(s),s="");return i}function M(t,e){const i=y[e]||(y[e]=function(t){const e=v(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function w(t){return t.charAt(0).toUpperCase()+t.slice(1)}const k=t=>void 0!==t,S=t=>"function"==typeof t,P=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};function D(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}const C=Math.PI,O=2*C,A=O+C,T=Number.POSITIVE_INFINITY,L=C/180,E=C/2,R=C/4,I=2*C/3,z=Math.log10,F=Math.sign;function V(t,e,i){return Math.abs(t-e)<i}function B(t){const e=Math.round(t);t=V(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(z(t))),s=t/i;return(s<=1?1:s<=2?2:s<=5?5:10)*i}function W(t){const e=[],i=Math.sqrt(t);let s;for(s=1;s<i;s++)t%s==0&&(e.push(s),e.push(t/s));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}function N(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function H(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}function j(t,e,i){let s,n,o;for(s=0,n=t.length;s<n;s++)o=t[s][i],isNaN(o)||(e.min=Math.min(e.min,o),e.max=Math.max(e.max,o))}function $(t){return t*(C/180)}function Y(t){return t*(180/C)}function U(t){if(!a(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function X(t,e){const i=e.x-t.x,s=e.y-t.y,n=Math.sqrt(i*i+s*s);let o=Math.atan2(s,i);return o<-.5*C&&(o+=O),{angle:o,distance:n}}function q(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function K(t,e){return(t-e+A)%O-C}function G(t){return(t%O+O)%O}function Z(t,e,i,s){const n=G(t),o=G(e),a=G(i),r=G(o-n),l=G(a-n),h=G(n-o),c=G(n-a);return n===o||n===a||s&&o===a||r>l&&h<c}function J(t,e,i){return Math.max(e,Math.min(i,t))}function Q(t){return J(t,-32768,32767)}function tt(t,e,i,s=1e-6){return t>=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function et(t,e,i){i=i||(i=>t[i]<e);let s,n=t.length-1,o=0;for(;n-o>1;)s=o+n>>1,i(s)?o=s:n=s;return{lo:o,hi:n}}const it=(t,e,i,s)=>et(t,i,s?s=>{const n=t[s][e];return n<i||n===i&&t[s+1][e]===i}:s=>t[s][e]<i),st=(t,e,i)=>et(t,i,(s=>t[s][e]>=i));function nt(t,e,i){let s=0,n=t.length;for(;s<n&&t[s]<e;)s++;for(;n>s&&t[n-1]>i;)n--;return s>0||n<t.length?t.slice(s,n):t}const ot=["push","pop","shift","splice","unshift"];function at(t,e){t._chartjs?t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),ot.forEach((e=>{const i="_onData"+w(e),s=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value(...eLine truncated
|
||||||
/*!
|
/*!
|
||||||
* @kurkle/color v0.3.2
|
* @kurkle/color v0.3.2
|
||||||
* https://github.com/kurkle/color#readme
|
* https://github.com/kurkle/color#readme
|
||||||
* (c) 2023 Jukka Kurkela
|
* (c) 2023 Jukka Kurkela
|
||||||
* Released under the MIT License
|
* Released under the MIT License
|
||||||
*/function _t(t){return t+.5|0}const yt=(t,e,i)=>Math.max(Math.min(t,i),e);function vt(t){return yt(_t(2.55*t),0,255)}function Mt(t){return yt(_t(255*t),0,255)}function wt(t){return yt(_t(t/2.55)/100,0,1)}function kt(t){return yt(_t(100*t),0,100)}const St={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Pt=[..."0123456789ABCDEF"],Dt=t=>Pt[15&t],Ct=t=>Pt[(240&t)>>4]+Pt[15&t],Ot=t=>(240&t)>>4==(15&t);function At(t){var e=(t=>Ot(t.r)&&Ot(t.g)&&Ot(t.b)&&Ot(t.a))(t)?Dt:Ct;return t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0}const Tt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Lt(t,e,i){const s=e*Math.min(i,1-i),n=(e,n=(e+t/30)%12)=>i-s*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function Et(t,e,i){const s=(s,n=(s+t/60)%6)=>i-i*e*Math.max(Math.min(n,4-n,1),0);return[s(5),s(3),s(1)]}function Rt(t,e,i){const s=Lt(t,1,.5);let n;for(e+i>1&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)s[n]*=1-e-i,s[n]+=e;return s}function It(t){const e=t.r/255,i=t.g/255,s=t.b/255,n=Math.max(e,i,s),o=Math.min(e,i,s),a=(n+o)/2;let r,l,h;return n!==o&&(h=n-o,l=a>.5?h/(2-n-o):h/(n+o),r=function(t,e,i,s,n){return t===n?(e-i)/s+(e<i?6:0):e===n?(i-t)/s+2:(t-e)/s+4}(e,i,s,h,n),r=60*r+.5),[0|r,l||0,a]}function zt(t,e,i,s){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,s)).map(Mt)}function Ft(t,e,i){return zt(Lt,t,e,i)}function Vt(t){return(t%360+360)%360}function Bt(t){const e=Tt.exec(t);let i,s=255;if(!e)return;e[5]!==i&&(s=e[6]?vt(+e[5]):Mt(+e[5]));const n=Vt(+e[2]),o=+e[3]/100,a=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return zt(Rt,t,e,i)}(n,o,a):"hsv"===e[1]?function(t,e,i){return zt(Et,t,e,i)}(n,o,a):Ft(n,o,a),{r:i[0],g:i[1],b:i[2],a:s}}const Wt={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Nt={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let Ht;function jt(t){Ht||(Ht=function(){const t={},e=Object.keys(Nt),i=Object.keys(Wt);let s,n,o,a,r;for(s=0;s<e.length;s++){for(a=r=e[s],n=0;n<i.length;n++)o=i[n],r=r.replace(o,Wt[o]);o=parseInt(Nt[a],16),t[r]=[o>>16&255,o>>8&255,255&o]}return t}(),Ht.transparent=[0,0,0,0]);const e=Ht[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}const $t=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const Yt=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,Ut=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function Xt(t,e,i){if(t){let s=It(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,0===e?360:1)),Line truncated
|
*/function _t(t){return t+.5|0}const yt=(t,e,i)=>Math.max(Math.min(t,i),e);function vt(t){return yt(_t(2.55*t),0,255)}function Mt(t){return yt(_t(255*t),0,255)}function wt(t){return yt(_t(t/2.55)/100,0,1)}function kt(t){return yt(_t(100*t),0,100)}const St={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Pt=[..."0123456789ABCDEF"],Dt=t=>Pt[15&t],Ct=t=>Pt[(240&t)>>4]+Pt[15&t],Ot=t=>(240&t)>>4==(15&t);function At(t){var e=(t=>Ot(t.r)&&Ot(t.g)&&Ot(t.b)&&Ot(t.a))(t)?Dt:Ct;return t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0}const Tt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Lt(t,e,i){const s=e*Math.min(i,1-i),n=(e,n=(e+t/30)%12)=>i-s*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function Et(t,e,i){const s=(s,n=(s+t/60)%6)=>i-i*e*Math.max(Math.min(n,4-n,1),0);return[s(5),s(3),s(1)]}function Rt(t,e,i){const s=Lt(t,1,.5);let n;for(e+i>1&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)s[n]*=1-e-i,s[n]+=e;return s}function It(t){const e=t.r/255,i=t.g/255,s=t.b/255,n=Math.max(e,i,s),o=Math.min(e,i,s),a=(n+o)/2;let r,l,h;return n!==o&&(h=n-o,l=a>.5?h/(2-n-o):h/(n+o),r=function(t,e,i,s,n){return t===n?(e-i)/s+(e<i?6:0):e===n?(i-t)/s+2:(t-e)/s+4}(e,i,s,h,n),r=60*r+.5),[0|r,l||0,a]}function zt(t,e,i,s){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,s)).map(Mt)}function Ft(t,e,i){return zt(Lt,t,e,i)}function Vt(t){return(t%360+360)%360}function Bt(t){const e=Tt.exec(t);let i,s=255;if(!e)return;e[5]!==i&&(s=e[6]?vt(+e[5]):Mt(+e[5]));const n=Vt(+e[2]),o=+e[3]/100,a=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return zt(Rt,t,e,i)}(n,o,a):"hsv"===e[1]?function(t,e,i){return zt(Et,t,e,i)}(n,o,a):Ft(n,o,a),{r:i[0],g:i[1],b:i[2],a:s}}const Wt={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Nt={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let Ht;function jt(t){Ht||(Ht=function(){const t={},e=Object.keys(Nt),i=Object.keys(Wt);let s,n,o,a,r;for(s=0;s<e.length;s++){for(a=r=e[s],n=0;n<i.length;n++)o=i[n],r=r.replace(o,Wt[o]);o=parseInt(Nt[a],16),t[r]=[o>>16&255,o>>8&255,255&o]}return t}(),Ht.transparent=[0,0,0,0]);const e=Ht[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}const $t=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const Yt=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,Ut=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function Xt(t,e,i){if(t){let s=It(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,0===e?360:1)),Line truncated
|
||||||
//# sourceMappingURL=chart.umd.min.js.map
|
//# sourceMappingURL=chart.umd.js.map
|
||||||
@@ -92,7 +92,7 @@ const setupForm = (formSelector, onResultCallback = null, noCastItems = []) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const setupNetworkScanForm = (formSelector, tableSelector, autorun = true) => {
|
const setupNetworkScanForm = (formSelector, tableSelector) => {
|
||||||
const form = document.querySelector(formSelector);
|
const form = document.querySelector(formSelector);
|
||||||
if (!form) {
|
if (!form) {
|
||||||
console.error("form not found");
|
console.error("form not found");
|
||||||
@@ -253,9 +253,7 @@ const setupNetworkScanForm = (formSelector, tableSelector, autorun = true) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
form.addEventListener('submit', onSubmitFn);
|
form.addEventListener('submit', onSubmitFn);
|
||||||
if (autorun) {
|
|
||||||
onSubmitFn();
|
onSubmitFn();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const setupRestoreBackupForm = (formSelector) => {
|
const setupRestoreBackupForm = (formSelector) => {
|
||||||
|
|||||||
+16
-13
@@ -23,15 +23,21 @@ Import("env")
|
|||||||
platform = env.PioPlatform()
|
platform = env.PioPlatform()
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
from os.path import join
|
from os.path import join
|
||||||
|
|
||||||
def normalize_paths(cmd):
|
sys.path.append(join(platform.get_package_dir("tool-esptoolpy")))
|
||||||
for i, arg in enumerate(cmd):
|
import esptool
|
||||||
if isinstance(arg, str) and '/' in arg:
|
|
||||||
cmd[i] = os.path.normpath(arg)
|
def esptool_call(cmd):
|
||||||
return cmd
|
try:
|
||||||
|
esptool.main(cmd)
|
||||||
|
except SystemExit as e:
|
||||||
|
# Fetch sys.exit() without leaving the script
|
||||||
|
if e.code == 0:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
print(f"❌ esptool failed with exit code: {e.code}")
|
||||||
|
return False
|
||||||
|
|
||||||
def esp32_create_combined_bin(source, target, env):
|
def esp32_create_combined_bin(source, target, env):
|
||||||
print("Generating combined binary for serial flashing")
|
print("Generating combined binary for serial flashing")
|
||||||
@@ -71,12 +77,9 @@ def esp32_create_combined_bin(source, target, env):
|
|||||||
print(f" - {hex(app_offset)} | {firmware_name}")
|
print(f" - {hex(app_offset)} | {firmware_name}")
|
||||||
cmd += [hex(app_offset), firmware_name]
|
cmd += [hex(app_offset), firmware_name]
|
||||||
|
|
||||||
# print('Using esptool.py arguments: %s' % ' '.join(cmd))
|
print('Using esptool.py arguments: %s' % ' '.join(cmd))
|
||||||
cmdline = [env.subst("$OBJCOPY")] + normalize_paths(cmd)
|
|
||||||
print('Command Line: %s' % cmdline)
|
esptool_call(cmd)
|
||||||
result = subprocess.run(cmdline, text=True, check=False, stdout=subprocess.DEVNULL)
|
|
||||||
if result.returncode != 0:
|
|
||||||
print(f"esptool create firmware failed with exit code: {result.returncode}")
|
|
||||||
|
|
||||||
|
|
||||||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin)
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", esp32_create_combined_bin)
|
||||||
Reference in new issue
Block a user