mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-11-13 01:44:47 +05:00
Compare commits
15
Commits
master
..
e751c3aba0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e751c3aba0 | ||
|
|
30b55f1946 | ||
|
|
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@v5
|
||||
- name: run PlatformIO Dependabot
|
||||
uses: peterus/platformio_dependabot@v1.2.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -7,7 +7,7 @@ jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v11
|
||||
- uses: actions/stale@v10
|
||||
with:
|
||||
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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
## 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 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Blueprint for reporting indoor/outdoor temperature to OpenTherm Gateway from any home assistant sensor
|
||||
# Updated: 26.01.2026
|
||||
# Updated: 03.09.2024
|
||||
|
||||
blueprint:
|
||||
name: Report temp to OpenTherm Gateway
|
||||
@@ -15,6 +15,7 @@ blueprint:
|
||||
multiple: false
|
||||
filter:
|
||||
- domain: sensor
|
||||
device_class: temperature
|
||||
target_entity:
|
||||
name: Target entity
|
||||
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' }}"
|
||||
action:
|
||||
- if:
|
||||
- condition: or
|
||||
conditions:
|
||||
- condition: template
|
||||
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 }}"
|
||||
- condition: template
|
||||
value_template: "{{ (states(source_entity)|float(0) - states(target_entity)|float(0)) | abs | round(2) >= 0.01 }}"
|
||||
then:
|
||||
- service: number.set_value
|
||||
data:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Blueprint for reporting temperature to OpenTherm Gateway from home assistant weather integration
|
||||
# Updated: 26.01.2026
|
||||
# Updated: 03.09.2024
|
||||
|
||||
blueprint:
|
||||
name: Report temp to OpenTherm Gateway from Weather
|
||||
@@ -37,12 +37,8 @@ condition:
|
||||
value_template: "{{ states(source_entity) != 'unavailable' and states(target_entity) != 'unavailable' }}"
|
||||
action:
|
||||
- if:
|
||||
- condition: or
|
||||
conditions:
|
||||
- condition: template
|
||||
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 }}"
|
||||
- condition: template
|
||||
value_template: "{{ (state_attr(source_entity, 'temperature')|float(0) - states(target_entity)|float(0)) | abs | round(2) >= 0.1 }}"
|
||||
then:
|
||||
- service: number.set_value
|
||||
data:
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
class CustomOpenTherm : public OpenTherm {
|
||||
public:
|
||||
typedef std::function<void(unsigned int)> DelayCallback;
|
||||
typedef std::function<void(unsigned long, uint8_t)> BeforeSendRequestCallback;
|
||||
typedef std::function<void(unsigned long, unsigned long, OpenThermResponseStatus, uint8_t)> AfterSendRequestCallback;
|
||||
typedef std::function<void(unsigned long, byte)> BeforeSendRequestCallback;
|
||||
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() {}
|
||||
@@ -70,89 +70,51 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
inline auto sendBoilerReset() {
|
||||
return this->sendRequestCode(1);
|
||||
}
|
||||
|
||||
inline auto sendServiceReset() {
|
||||
return this->sendRequestCode(10);
|
||||
}
|
||||
|
||||
inline auto sendWaterFilling() {
|
||||
return this->sendRequestCode(2);
|
||||
}
|
||||
|
||||
bool sendRequestCode(const uint8_t requestCode) {
|
||||
bool sendBoilerReset() {
|
||||
unsigned int data = 1;
|
||||
data <<= 8;
|
||||
unsigned long response = this->sendRequest(buildRequest(
|
||||
OpenThermMessageType::WRITE_DATA,
|
||||
OpenThermMessageID::RemoteRequest,
|
||||
static_cast<unsigned int>(requestCode) << 8
|
||||
data
|
||||
));
|
||||
|
||||
if (!isValidResponse(response) || !isValidResponseId(response, OpenThermMessageID::RemoteRequest)) {
|
||||
return false;
|
||||
}
|
||||
return isValidResponse(response) && isValidResponseId(response, OpenThermMessageID::RemoteRequest);
|
||||
}
|
||||
|
||||
const uint8_t responseRequestCode = (response & 0xFFFF) >> 8;
|
||||
const uint8_t responseCode = response & 0xFF;
|
||||
if (responseRequestCode != requestCode || responseCode < 128) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// reset
|
||||
this->sendRequest(buildRequest(
|
||||
bool sendServiceReset() {
|
||||
unsigned int data = 10;
|
||||
data <<= 8;
|
||||
unsigned long response = this->sendRequest(buildRequest(
|
||||
OpenThermMessageType::WRITE_DATA,
|
||||
OpenThermMessageID::RemoteRequest,
|
||||
0u << 8
|
||||
data
|
||||
));
|
||||
|
||||
return true;
|
||||
return isValidResponse(response) && isValidResponseId(response, OpenThermMessageID::RemoteRequest);
|
||||
}
|
||||
|
||||
bool getStr(OpenThermMessageID id, char* buffer, uint16_t length = 50) {
|
||||
if (buffer == nullptr || length == 0) {
|
||||
return false;
|
||||
}
|
||||
bool sendWaterFilling() {
|
||||
unsigned int data = 2;
|
||||
data <<= 8;
|
||||
unsigned long response = this->sendRequest(buildRequest(
|
||||
OpenThermMessageType::WRITE_DATA,
|
||||
OpenThermMessageID::RemoteRequest,
|
||||
data
|
||||
));
|
||||
|
||||
unsigned long response;
|
||||
uint8_t index = 0;
|
||||
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)) {
|
||||
break;
|
||||
}
|
||||
|
||||
const uint8_t character = response & 0xFF;
|
||||
if (character == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (index == 0) {
|
||||
maxIndex = (response & 0xFFFF) >> 8;
|
||||
}
|
||||
|
||||
buffer[index++] = static_cast<char>(character);
|
||||
}
|
||||
|
||||
buffer[index] = '\0';
|
||||
return index > 0;
|
||||
return isValidResponse(response) && isValidResponseId(response, OpenThermMessageID::RemoteRequest);
|
||||
}
|
||||
|
||||
static bool isCh2Active(unsigned long response) {
|
||||
return response & 0x20;
|
||||
static bool isCh2Active(unsigned long response)
|
||||
{
|
||||
return response & 0x20;
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -163,10 +125,10 @@ public:
|
||||
uint8_t msgType = getResponseMessageTypeId(response);
|
||||
|
||||
switch (msgType) {
|
||||
case static_cast<uint8_t>(OpenThermMessageType::READ_ACK):
|
||||
case static_cast<uint8_t>(OpenThermMessageType::WRITE_ACK):
|
||||
case static_cast<uint8_t>(OpenThermMessageType::DATA_INVALID):
|
||||
case static_cast<uint8_t>(OpenThermMessageType::UNKNOWN_DATA_ID):
|
||||
case (uint8_t) OpenThermMessageType::READ_ACK:
|
||||
case (uint8_t) OpenThermMessageType::WRITE_ACK:
|
||||
case (uint8_t) OpenThermMessageType::DATA_INVALID:
|
||||
case (uint8_t) OpenThermMessageType::UNKNOWN_DATA_ID:
|
||||
return CustomOpenTherm::messageTypeToString(
|
||||
static_cast<OpenThermMessageType>(msgType)
|
||||
);
|
||||
|
||||
@@ -147,19 +147,8 @@ public:
|
||||
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>
|
||||
String getUniqueIdWithPrefix(T value, char separator = '_') {
|
||||
String getObjectIdWithPrefix(T value, char separator = '_') {
|
||||
String topic = "";
|
||||
topic.concat(this->devicePrefix);
|
||||
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_SWITCH[] PROGMEM = "switch";
|
||||
|
||||
// https://www.home-assistant.io/integrations/mqtt/#supported-abbreviations-in-mqtt-discovery-messages
|
||||
const char HA_DEFAULT_ENTITY_ID[] PROGMEM = "def_ent_id"; // "default_entity_id "
|
||||
const char HA_DEVICE[] PROGMEM = "dev"; // "device"
|
||||
const char HA_IDENTIFIERS[] PROGMEM = "ids"; // "identifiers"
|
||||
const char HA_SW_VERSION[] PROGMEM = "sw"; // "sw_version"
|
||||
const char HA_MANUFACTURER[] PROGMEM = "mf"; // "manufacturer"
|
||||
const char HA_MODEL[] PROGMEM = "mdl"; // "model"
|
||||
const char HA_DEVICE[] PROGMEM = "device";
|
||||
const char HA_IDENTIFIERS[] PROGMEM = "identifiers";
|
||||
const char HA_SW_VERSION[] PROGMEM = "sw_version";
|
||||
const char HA_MANUFACTURER[] PROGMEM = "manufacturer";
|
||||
const char HA_MODEL[] PROGMEM = "model";
|
||||
const char HA_NAME[] PROGMEM = "name";
|
||||
const char HA_CONF_URL[] PROGMEM = "cu"; // "configuration_url"
|
||||
const char HA_COMMAND_TOPIC[] PROGMEM = "cmd_t"; // "command_topic"
|
||||
const char HA_COMMAND_TEMPLATE[] PROGMEM = "cmd_tpl"; // "command_template"
|
||||
const char HA_ENABLED_BY_DEFAULT[] PROGMEM = "en"; // "enabled_by_default"
|
||||
const char HA_UNIQUE_ID[] PROGMEM = "uniq_id"; // "unique_id"
|
||||
const char HA_ENTITY_CATEGORY[] PROGMEM = "ent_cat"; // "entity_category"
|
||||
const char HA_CONF_URL[] PROGMEM = "configuration_url";
|
||||
const char HA_COMMAND_TOPIC[] PROGMEM = "command_topic";
|
||||
const char HA_COMMAND_TEMPLATE[] PROGMEM = "command_template";
|
||||
const char HA_ENABLED_BY_DEFAULT[] PROGMEM = "enabled_by_default";
|
||||
const char HA_UNIQUE_ID[] PROGMEM = "unique_id";
|
||||
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_CONFIG[] PROGMEM = "config";
|
||||
const char HA_STATE_TOPIC[] PROGMEM = "stat_t"; // "state_topic"
|
||||
const char HA_VALUE_TEMPLATE[] PROGMEM = "val_tpl"; // "value_template"
|
||||
const char HA_OPTIONS[] PROGMEM = "ops"; // "options"
|
||||
const char HA_AVAILABILITY[] PROGMEM = "avty"; // "availability"
|
||||
const char HA_AVAILABILITY_MODE[] PROGMEM = "avty_mode"; // "availability_mode"
|
||||
const char HA_TOPIC[] PROGMEM = "t"; // "topic"
|
||||
const char HA_DEVICE_CLASS[] PROGMEM = "dev_cla"; // "device_class"
|
||||
const char HA_UNIT_OF_MEASUREMENT[] PROGMEM = "unit_of_meas"; // "unit_of_measurement"
|
||||
const char HA_STATE_TOPIC[] PROGMEM = "state_topic";
|
||||
const char HA_VALUE_TEMPLATE[] PROGMEM = "value_template";
|
||||
const char HA_OPTIONS[] PROGMEM = "options";
|
||||
const char HA_AVAILABILITY[] PROGMEM = "availability";
|
||||
const char HA_AVAILABILITY_MODE[] PROGMEM = "availability_mode";
|
||||
const char HA_TOPIC[] PROGMEM = "topic";
|
||||
const char HA_DEVICE_CLASS[] PROGMEM = "device_class";
|
||||
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_F[] PROGMEM = "°F";
|
||||
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_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_MAX[] PROGMEM = "max";
|
||||
const char HA_STEP[] PROGMEM = "step";
|
||||
const char HA_MODE[] PROGMEM = "mode";
|
||||
const char HA_MODE_BOX[] PROGMEM = "box";
|
||||
const char HA_STATE_ON[] PROGMEM = "stat_on"; // "state_on"
|
||||
const char HA_STATE_OFF[] PROGMEM = "stat_off"; // "state_off"
|
||||
const char HA_PAYLOAD_ON[] PROGMEM = "pl_on"; // "payload_on"
|
||||
const char HA_PAYLOAD_OFF[] PROGMEM = "pl_off"; // "payload_off"
|
||||
const char HA_STATE_CLASS[] PROGMEM = "stat_cla"; // "state_class"
|
||||
const char HA_STATE_ON[] PROGMEM = "state_on";
|
||||
const char HA_STATE_OFF[] PROGMEM = "state_off";
|
||||
const char HA_PAYLOAD_ON[] PROGMEM = "payload_on";
|
||||
const char HA_PAYLOAD_OFF[] PROGMEM = "payload_off";
|
||||
const char HA_STATE_CLASS[] PROGMEM = "state_class";
|
||||
const char HA_STATE_CLASS_MEASUREMENT[] PROGMEM = "measurement";
|
||||
const char HA_EXPIRE_AFTER[] PROGMEM = "exp_aft"; // "expire_after"
|
||||
const char HA_CURRENT_TEMPERATURE_TOPIC[] PROGMEM = "curr_temp_t"; // "current_temperature_topic"
|
||||
const char HA_CURRENT_TEMPERATURE_TEMPLATE[] PROGMEM = "curr_temp_tpl"; // "current_temperature_template"
|
||||
const char HA_TEMPERATURE_COMMAND_TOPIC[] PROGMEM = "temp_cmd_t"; // "temperature_command_topic"
|
||||
const char HA_TEMPERATURE_COMMAND_TEMPLATE[] PROGMEM = "temp_cmd_tpl"; // "temperature_command_template"
|
||||
const char HA_TEMPERATURE_STATE_TOPIC[] PROGMEM = "temp_stat_t"; // "temperature_state_topic"
|
||||
const char HA_TEMPERATURE_STATE_TEMPLATE[] PROGMEM = "temp_stat_tpl"; // "temperature_state_template"
|
||||
const char HA_TEMPERATURE_UNIT[] PROGMEM = "temp_unit"; // "temperature_unit"
|
||||
const char HA_MODE_COMMAND_TOPIC[] PROGMEM = "mode_cmd_t"; // "mode_command_topic"
|
||||
const char HA_MODE_COMMAND_TEMPLATE[] PROGMEM = "mode_cmd_tpl"; // "mode_command_template"
|
||||
const char HA_MODE_STATE_TOPIC[] PROGMEM = "mode_stat_t"; // "mode_state_topic"
|
||||
const char HA_MODE_STATE_TEMPLATE[] PROGMEM = "mode_stat_tpl"; // "mode_state_template"
|
||||
const char HA_EXPIRE_AFTER[] PROGMEM = "expire_after";
|
||||
const char HA_CURRENT_TEMPERATURE_TOPIC[] PROGMEM = "current_temperature_topic";
|
||||
const char HA_CURRENT_TEMPERATURE_TEMPLATE[] PROGMEM = "current_temperature_template";
|
||||
const char HA_TEMPERATURE_COMMAND_TOPIC[] PROGMEM = "temperature_command_topic";
|
||||
const char HA_TEMPERATURE_COMMAND_TEMPLATE[] PROGMEM = "temperature_command_template";
|
||||
const char HA_TEMPERATURE_STATE_TOPIC[] PROGMEM = "temperature_state_topic";
|
||||
const char HA_TEMPERATURE_STATE_TEMPLATE[] PROGMEM = "temperature_state_template";
|
||||
const char HA_TEMPERATURE_UNIT[] PROGMEM = "temperature_unit";
|
||||
const char HA_MODE_COMMAND_TOPIC[] PROGMEM = "mode_command_topic";
|
||||
const char HA_MODE_COMMAND_TEMPLATE[] PROGMEM = "mode_command_template";
|
||||
const char HA_MODE_STATE_TOPIC[] PROGMEM = "mode_state_topic";
|
||||
const char HA_MODE_STATE_TEMPLATE[] PROGMEM = "mode_state_template";
|
||||
const char HA_MODES[] PROGMEM = "modes";
|
||||
const char HA_ACTION_TOPIC[] PROGMEM = "act_t"; // "action_topic"
|
||||
const char HA_ACTION_TEMPLATE[] PROGMEM = "act_tpl"; // "action_template"
|
||||
const char HA_ACTION_TOPIC[] PROGMEM = "action_topic";
|
||||
const char HA_ACTION_TEMPLATE[] PROGMEM = "action_template";
|
||||
const char HA_MIN_TEMP[] PROGMEM = "min_temp";
|
||||
const char HA_MAX_TEMP[] PROGMEM = "max_temp";
|
||||
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_TEMPLATE[] PROGMEM = "pr_mode_cmd_tpl"; // "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_VALUE_TEMPLATE[] PROGMEM = "pr_mode_val_tpl"; // "preset_mode_value_template"
|
||||
const char HA_PRESET_MODES[] PROGMEM = "pr_modes"; // "preset_modes"
|
||||
const char HA_PRESET_MODE_COMMAND_TOPIC[] PROGMEM = "preset_mode_command_topic";
|
||||
const char HA_PRESET_MODE_COMMAND_TEMPLATE[] PROGMEM = "preset_mode_command_template";
|
||||
const char HA_PRESET_MODE_STATE_TOPIC[] PROGMEM = "preset_mode_state_topic";
|
||||
const char HA_PRESET_MODE_VALUE_TEMPLATE[] PROGMEM = "preset_mode_value_template";
|
||||
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)
|
||||
#include <ESP8266WiFi.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;
|
||||
};
|
||||
}
|
||||
+369
-207
@@ -1,314 +1,476 @@
|
||||
#pragma once
|
||||
#include <NetworkAp.h>
|
||||
#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
|
||||
#include <NetworkConnection.h>
|
||||
#include <NetworkEthernet.h>
|
||||
#include <NetworkUplink.h>
|
||||
#include <NetworkWifi.h>
|
||||
|
||||
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 {
|
||||
public:
|
||||
NetworkMgr() : wifi(&this->context), ap(&this->context, &this->wifi), ethernet(&this->context) {
|
||||
NetworkConnection::setup(this->context.useDhcp);
|
||||
this->wifi.resetWifi();
|
||||
typedef std::function<void()> YieldCallback;
|
||||
typedef std::function<void(unsigned int)> DelayCallback;
|
||||
|
||||
NetworkMgr() {
|
||||
NetworkConnection::setup(this->useDhcp);
|
||||
this->resetWifi();
|
||||
}
|
||||
|
||||
NetworkMgr* setYieldCallback(YieldCallback callback = nullptr) {
|
||||
this->context.yieldCallback = callback;
|
||||
this->yieldCallback = callback;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
NetworkMgr* setDelayCallback(DelayCallback callback = nullptr) {
|
||||
this->context.delayCallback = callback;
|
||||
this->delayCallback = callback;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
NetworkMgr* setApCredentials(const char* ssid, const char* password = nullptr, uint8_t channel = 0) {
|
||||
this->context.apName = ssid;
|
||||
this->context.apPassword = password;
|
||||
this->context.apChannel = 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;
|
||||
NetworkMgr* setStaCredentials(const char* ssid = nullptr, const char* password = nullptr, byte channel = 0) {
|
||||
this->staSsid = ssid;
|
||||
this->staPassword = password;
|
||||
this->staChannel = channel;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
NetworkMgr* setUseDhcp(bool value) {
|
||||
if (value != this->context.useDhcp) {
|
||||
this->ethernet.markSettingsChanged();
|
||||
}
|
||||
|
||||
this->context.useDhcp = value;
|
||||
NetworkConnection::setup(this->context.useDhcp);
|
||||
this->useDhcp = value;
|
||||
NetworkConnection::setup(this->useDhcp);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
NetworkMgr* setStaticConfig(const char* ip, const char* gateway, const char* subnet, const char* dns) {
|
||||
IPAddress valueIp, valueGateway, valueSubnet, valueDns;
|
||||
|
||||
valueIp.fromString(ip);
|
||||
valueGateway.fromString(gateway);
|
||||
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;
|
||||
this->staticIp.fromString(ip);
|
||||
this->staticGateway.fromString(gateway);
|
||||
this->staticSubnet.fromString(subnet);
|
||||
this->staticDns.fromString(dns);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
NetworkMgr* setStaticConfig(IPAddress& ip, IPAddress& gateway, IPAddress& subnet, IPAddress& dns) {
|
||||
if (
|
||||
ip != this->context.staticIp || gateway != this->context.staticGateway
|
||||
|| subnet != this->context.staticSubnet || dns != this->context.staticDns
|
||||
) {
|
||||
this->ethernet.markSettingsChanged();
|
||||
}
|
||||
|
||||
this->context.staticIp = ip;
|
||||
this->context.staticGateway = gateway;
|
||||
this->context.staticSubnet = subnet;
|
||||
this->context.staticDns = dns;
|
||||
this->staticIp = ip;
|
||||
this->staticGateway = gateway;
|
||||
this->staticSubnet = subnet;
|
||||
this->staticDns = dns;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable/disable the ethernet interface (W5500 over SPI)
|
||||
*/
|
||||
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 hasStaCredentials() {
|
||||
return this->staSsid != nullptr;
|
||||
}
|
||||
|
||||
bool isConnected() {
|
||||
return this->getUplink() >= Uplink::Wifi;
|
||||
return this->isStaEnabled() && NetworkConnection::getStatus() == NetworkConnection::Status::CONNECTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief WiFi signal quality in percent, 0 when WiFi is not carrying the uplink
|
||||
*/
|
||||
uint8_t getSignalQuality() {
|
||||
return this->getUplink() == Uplink::Wifi ? rssiToSignalQuality(this->wifi.rssi()) : 0;
|
||||
bool isConnecting() {
|
||||
return this->isStaEnabled() && NetworkConnection::getStatus() == NetworkConnection::Status::CONNECTING;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return "ethernet", "wifi", "wifi-ap" or "none"
|
||||
*/
|
||||
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 isStaEnabled() {
|
||||
return (WiFi.getMode() & WIFI_STA) != 0;
|
||||
}
|
||||
|
||||
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() {
|
||||
return this->station()->rssi();
|
||||
return WiFi.RSSI();
|
||||
}
|
||||
|
||||
IPAddress getApIp() {
|
||||
return this->ap.localIP();
|
||||
return WiFi.softAPIP();
|
||||
}
|
||||
|
||||
IPAddress getStaIp() {
|
||||
return this->station()->localIP();
|
||||
return WiFi.localIP();
|
||||
}
|
||||
|
||||
IPAddress getStaSubnet() {
|
||||
return this->station()->subnetMask();
|
||||
return WiFi.subnetMask();
|
||||
}
|
||||
|
||||
IPAddress getStaGateway() {
|
||||
return this->station()->gatewayIP();
|
||||
return WiFi.gatewayIP();
|
||||
}
|
||||
|
||||
IPAddress getStaDns() {
|
||||
return this->station()->dnsIP();
|
||||
return WiFi.dnsIP();
|
||||
}
|
||||
|
||||
String getStaMac() {
|
||||
return this->station()->macAddress();
|
||||
return WiFi.macAddress();
|
||||
}
|
||||
|
||||
const char* getStaSsid() {
|
||||
return this->context.staSsid;
|
||||
return this->staSsid;
|
||||
}
|
||||
|
||||
uint8_t getStaChannel() {
|
||||
return this->context.staChannel;
|
||||
const char* getStaPassword() {
|
||||
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() {
|
||||
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() {
|
||||
// The top of the hierarchy polls every pass so it can take the uplink whenever it can
|
||||
this->ethernet.loop();
|
||||
if (this->reconnectFlag) {
|
||||
this->delayCallback(5000);
|
||||
|
||||
this->trackUplink();
|
||||
this->updateWifiRadio();
|
||||
Log.sinfoln(FPSTR(L_NETWORK), F("Reconnecting..."));
|
||||
this->reconnectFlag = false;
|
||||
this->disconnect();
|
||||
NetworkConnection::reset();
|
||||
this->delayCallback(1000);
|
||||
|
||||
if (this->getUplink() == Uplink::Ethernet) {
|
||||
return;
|
||||
} 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;
|
||||
}
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
if (millis() - this->prevArpGratuitous > 60000) {
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
if (!this->hasStaCredentials() && !this->isApEnabled()) {
|
||||
Log.sinfoln(FPSTR(L_NETWORK), F("No STA credentials, start AP"));
|
||||
|
||||
WiFi.mode(WIFI_AP_STA);
|
||||
this->delayCallback(250);
|
||||
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->prevReconnectingTime = millis();
|
||||
}
|
||||
}
|
||||
|
||||
// a pending ethernet attempt holds the hierarchy: nothing below it starts until it resolves
|
||||
if (this->ethernet.isPending() && !this->wifi.isActive() && !this->ap.isActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->wifi.loop();
|
||||
|
||||
// the ladder only reaches the AP once the station is out of the running
|
||||
if (!this->wifi.isActive() && this->wifi.isPending()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->ap.loop();
|
||||
}
|
||||
|
||||
static uint8_t rssiToSignalQuality(short int rssi) {
|
||||
static byte rssiToSignalQuality(short int rssi) {
|
||||
return constrain(map(rssi, -100, -50, 0, 100), 0, 100);
|
||||
}
|
||||
|
||||
protected:
|
||||
UplinkContext context;
|
||||
WifiUplink wifi;
|
||||
ApUplink ap;
|
||||
EthernetUplink ethernet;
|
||||
const unsigned int reconnectInterval = 15000;
|
||||
const unsigned int failedConnectTimeout = 185000;
|
||||
const unsigned int connectionTimeout = 10000;
|
||||
const unsigned int resetConnectionTimeout = 90000;
|
||||
|
||||
Uplink uplink = Uplink::None;
|
||||
YieldCallback yieldCallback = []() {
|
||||
::yield();
|
||||
};
|
||||
DelayCallback delayCallback = [](unsigned int time) {
|
||||
::delay(time);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The interface holding the station address: the wired one while it carries the
|
||||
* uplink, the station otherwise
|
||||
*/
|
||||
NetworkUplink* station() {
|
||||
if (this->getUplink() == Uplink::Ethernet) {
|
||||
return &this->ethernet;
|
||||
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;
|
||||
}
|
||||
|
||||
return &this->wifi;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Notice an uplink change so the hierarchy is walked from the top again
|
||||
*/
|
||||
void trackUplink() {
|
||||
const Uplink current = this->getUplink();
|
||||
|
||||
if (current == this->uplink) {
|
||||
return;
|
||||
if (strcmp(WiFi.getHostname(), hostname) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Log.sinfoln(FPSTR(L_NETWORK), F("Uplink: %s -> %s"), uplinkName(this->uplink), uplinkName(current));
|
||||
|
||||
this->uplink = current;
|
||||
return WiFi.setHostname(hostname);
|
||||
}
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
/**
|
||||
* @brief Keep the WiFi radio in step with the uplink
|
||||
* @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
|
||||
|
||||
/**
|
||||
* @brief check RFC compliance
|
||||
*
|
||||
* WiFi is only in service while it carries the traffic. The AP is for first configuration:
|
||||
* once a cable carries the uplink the radio goes off, and if that uplink never comes up the
|
||||
* ladder falls back to the AP again on its own.
|
||||
* @param value
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
void updateWifiRadio() {
|
||||
if (this->ethernet.isActive()) {
|
||||
this->wifi.suspend();
|
||||
|
||||
return;
|
||||
static bool isHostnameValid(const char* value) {
|
||||
size_t len = strlen(value);
|
||||
if (len > 24) {
|
||||
return false;
|
||||
} 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"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cssnano": "^9.3.2",
|
||||
"cssnano-preset-advanced": "^10.0.0",
|
||||
"cssnano": "^7.0.2",
|
||||
"cssnano-preset-advanced": "^7.0.2",
|
||||
"gulp": "^5.0.0",
|
||||
"gulp-concat": "^2.6.1",
|
||||
"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-postcss": "^10.0.0",
|
||||
"gulp-terser": "^2.1.0",
|
||||
|
||||
+12
-21
@@ -14,21 +14,19 @@ extra_configs = secrets.default.ini
|
||||
core_dir = .pio
|
||||
|
||||
[env]
|
||||
version = 1.6.0
|
||||
version = 1.5.6
|
||||
framework = arduino
|
||||
lib_deps =
|
||||
bblanchon/ArduinoJson@^7.4.2
|
||||
bblanchon/ArduinoJson@^7.3.0
|
||||
;ihormelnyk/OpenTherm Library@^1.1.5
|
||||
https://github.com/Laxilef/opentherm_library#esp32_timer
|
||||
arduino-libraries/ArduinoMqttClient@^0.1.8
|
||||
lennarthennigs/ESP Telnet@^2.2.3
|
||||
gyverlibs/FileData@^1.0.3
|
||||
lennarthennigs/ESP Telnet@^2.2
|
||||
gyverlibs/FileData@^1.0.2
|
||||
gyverlibs/GyverPID@^3.3.2
|
||||
gyverlibs/GyverBlinker@^1.1.1
|
||||
pstolarz/OneWireNg@^0.14.1
|
||||
milesburton/DallasTemperature@^4.0.6
|
||||
https://github.com/pstolarz/Arduino-Temperature-Control-Library.git#OneWireNg
|
||||
laxilef/TinyLogger@^1.1.1
|
||||
lib_ignore = OneWire
|
||||
build_type = ${secrets.build_type}
|
||||
build_flags =
|
||||
-mtext-section-literals
|
||||
@@ -75,7 +73,7 @@ platform_packages = ${env.platform_packages}
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
nrwiersma/ESP8266Scheduler@^1.2
|
||||
lib_ignore = ${env.lib_ignore}
|
||||
lib_ignore =
|
||||
extra_scripts =
|
||||
post:tools/build.py
|
||||
build_type = ${env.build_type}
|
||||
@@ -94,14 +92,14 @@ check_flags = ${env.check_flags}
|
||||
;platform_packages =
|
||||
; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.5
|
||||
; framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip
|
||||
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.36/platform-espressif32.zip
|
||||
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.30-2/platform-espressif32.zip
|
||||
platform_packages = ${env.platform_packages}
|
||||
board_build.partitions = esp32_partitions.csv
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
laxilef/ESP32Scheduler@^1.0.1
|
||||
nimble_lib = h2zero/NimBLE-Arduino@2.3.7
|
||||
lib_ignore = ${env.lib_ignore}
|
||||
nimble_lib = h2zero/NimBLE-Arduino@^2.1.0
|
||||
lib_ignore =
|
||||
extra_scripts =
|
||||
post:tools/esp32.py
|
||||
post:tools/build.py
|
||||
@@ -236,7 +234,7 @@ build_flags =
|
||||
${esp32_defaults.build_flags}
|
||||
-D ARDUINO_USB_MODE=0
|
||||
-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 DEFAULT_OT_IN_GPIO=35
|
||||
-D DEFAULT_OT_OUT_GPIO=36
|
||||
@@ -262,7 +260,7 @@ build_unflags =
|
||||
build_type = ${esp32_defaults.build_type}
|
||||
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 DEFAULT_OT_IN_GPIO=8
|
||||
-D DEFAULT_OT_OUT_GPIO=10
|
||||
@@ -296,10 +294,6 @@ build_flags =
|
||||
check_tool = ${esp32_defaults.check_tool}
|
||||
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]
|
||||
platform = ${esp32_defaults.platform}
|
||||
platform_packages = ${esp32_defaults.platform_packages}
|
||||
@@ -324,8 +318,6 @@ check_tool = ${esp32_defaults.check_tool}
|
||||
check_flags = ${esp32_defaults.check_flags}
|
||||
|
||||
[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}
|
||||
framework = arduino, espidf
|
||||
platform_packages = ${esp32_defaults.platform_packages}
|
||||
@@ -346,7 +338,6 @@ build_type = ${esp32_defaults.build_type}
|
||||
build_flags =
|
||||
${esp32_defaults.build_flags}
|
||||
-D USE_BLE=1
|
||||
-D USE_ETHERNET=1
|
||||
-D DEFAULT_OT_IN_GPIO=15
|
||||
-D DEFAULT_OT_OUT_GPIO=23
|
||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=0
|
||||
@@ -371,7 +362,7 @@ build_unflags =
|
||||
build_type = ${esp32_defaults.build_type}
|
||||
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 DEFAULT_OT_IN_GPIO=3
|
||||
-D DEFAULT_OT_OUT_GPIO=1
|
||||
|
||||
@@ -9,11 +9,6 @@ CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=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
|
||||
CONFIG_BT_ENABLED=y
|
||||
|
||||
+91
-123
@@ -3,8 +3,8 @@
|
||||
|
||||
class HaHelper : public HomeAssistantHelper {
|
||||
public:
|
||||
static const uint8_t TEMP_SOURCE_HEATING = 0;
|
||||
static const uint8_t TEMP_SOURCE_INDOOR = 1;
|
||||
static const byte TEMP_SOURCE_HEATING = 0;
|
||||
static const byte TEMP_SOURCE_INDOOR = 1;
|
||||
static const char AVAILABILITY_OT_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) {
|
||||
#if !USE_BLE
|
||||
if (sSensor.type == Sensors::Type::BLUETOOTH) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
JsonDocument doc;
|
||||
|
||||
// set device class & unit of measurement
|
||||
@@ -267,13 +261,8 @@ public:
|
||||
}
|
||||
|
||||
// object id's
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(objId.c_str());
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(
|
||||
sSensor.type == Sensors::Type::MANUAL
|
||||
? FPSTR(HA_ENTITY_NUMBER)
|
||||
: FPSTR(HA_ENTITY_SENSOR),
|
||||
objId.c_str()
|
||||
);
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(objId.c_str());
|
||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||
|
||||
const String& configTopic = this->makeConfigTopic(
|
||||
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"));
|
||||
|
||||
// object id's
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(objId.c_str());
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), objId.c_str());
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(objId.c_str());
|
||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||
|
||||
// state topic
|
||||
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(
|
||||
@@ -381,8 +370,8 @@ public:
|
||||
String objId = Sensors::makeObjectIdWithSuffix(sSensor.name, F("signal_quality"));
|
||||
|
||||
// object id's
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(objId.c_str());
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), objId.c_str());
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(objId.c_str());
|
||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||
|
||||
// state topic
|
||||
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(
|
||||
@@ -418,6 +407,7 @@ public:
|
||||
}
|
||||
|
||||
bool deleteSignalQualityDynamicSensor(Sensors::Settings& sSensor) {
|
||||
JsonDocument doc;
|
||||
const String& configTopic = this->makeConfigTopic(
|
||||
FPSTR(HA_ENTITY_SENSOR),
|
||||
Sensors::makeObjectIdWithSuffix(sSensor.name, F("signal_quality")).c_str()
|
||||
@@ -431,8 +421,8 @@ public:
|
||||
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_turbo"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SWITCH), F("heating_turbo"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_NAME)] = F("Turbo heating");
|
||||
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);
|
||||
}
|
||||
|
||||
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) {
|
||||
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_NUMBER), F("heating_hysteresis"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||
|
||||
@@ -490,9 +458,9 @@ public:
|
||||
doc[FPSTR(HA_NAME)] = F("Heating hysteresis");
|
||||
doc[FPSTR(HA_ICON)] = F("mdi:altimeter");
|
||||
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_TEMPLATE)] = F("{\"heating\": {\"hysteresis\" : {\"value\" : {{ value }}}}}");
|
||||
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"heating\": {\"hysteresis\" : {{ value }}}}");
|
||||
doc[FPSTR(HA_MIN)] = 0;
|
||||
doc[FPSTR(HA_MAX)] = 15;
|
||||
doc[FPSTR(HA_STEP)] = 0.01f;
|
||||
@@ -507,8 +475,8 @@ public:
|
||||
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_turbo_factor"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("heating_turbo_factor"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = F("power_factor");
|
||||
doc[FPSTR(HA_NAME)] = F("Heating turbo factor");
|
||||
@@ -531,8 +499,8 @@ public:
|
||||
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_min_temp"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("heating_min_temp"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||
|
||||
@@ -565,8 +533,8 @@ public:
|
||||
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_max_temp"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("heating_max_temp"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||
|
||||
@@ -600,8 +568,8 @@ public:
|
||||
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("dhw_min_temp"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("dhw_min_temp"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||
|
||||
@@ -634,8 +602,8 @@ public:
|
||||
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("dhw_max_temp"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("dhw_max_temp"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||
|
||||
@@ -669,8 +637,8 @@ public:
|
||||
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("pid"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SWITCH), F("pid"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_NAME)] = F("PID");
|
||||
doc[FPSTR(HA_ICON)] = F("mdi:chart-bar-stacked");
|
||||
@@ -691,8 +659,8 @@ public:
|
||||
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("pid_p"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_p"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_NAME)] = F("PID factor P");
|
||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-p-circle-outline");
|
||||
@@ -714,8 +682,8 @@ public:
|
||||
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("pid_i"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_i"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_NAME)] = F("PID factor I");
|
||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-i-circle-outline");
|
||||
@@ -737,8 +705,8 @@ public:
|
||||
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("pid_d"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_d"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_NAME)] = F("PID factor D");
|
||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-d-circle-outline");
|
||||
@@ -760,8 +728,8 @@ public:
|
||||
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("pid_dt"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_dt"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = F("duration");
|
||||
doc[FPSTR(HA_UNIT_OF_MEASUREMENT)] = F("s");
|
||||
@@ -785,8 +753,8 @@ public:
|
||||
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("pid_min_temp"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_min_temp"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||
|
||||
@@ -819,8 +787,8 @@ public:
|
||||
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("pid_max_temp"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_max_temp"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||
|
||||
@@ -854,8 +822,8 @@ public:
|
||||
JsonDocument doc;
|
||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SWITCH), F("equitherm"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_NAME)] = F("Equitherm");
|
||||
doc[FPSTR(HA_ICON)] = F("mdi:sun-snowflake-variant");
|
||||
@@ -876,8 +844,8 @@ public:
|
||||
JsonDocument doc;
|
||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_slope"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_slope"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_NAME)] = F("Equitherm slope");
|
||||
doc[FPSTR(HA_ICON)] = F("mdi:slope-uphill");
|
||||
@@ -899,8 +867,8 @@ public:
|
||||
JsonDocument doc;
|
||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_exponent"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_exponent"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_NAME)] = F("Equitherm exponent");
|
||||
doc[FPSTR(HA_ICON)] = F("mdi:exponent");
|
||||
@@ -922,8 +890,8 @@ public:
|
||||
JsonDocument doc;
|
||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_shift"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_shift"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||
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_MODE)] = F("all");
|
||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(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_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_NAME)] = F("Equitherm target diff factor");
|
||||
doc[FPSTR(HA_ICON)] = F("mdi:chart-timeline-variant-shimmer");
|
||||
@@ -972,8 +940,8 @@ public:
|
||||
bool publishStatusState(bool enabledByDefault = true) {
|
||||
JsonDocument doc;
|
||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("status"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("status"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = F("problem");
|
||||
doc[FPSTR(HA_NAME)] = F("Status");
|
||||
@@ -990,8 +958,8 @@ public:
|
||||
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("emergency"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("emergency"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = F("problem");
|
||||
doc[FPSTR(HA_NAME)] = F("Emergency");
|
||||
@@ -1008,8 +976,8 @@ public:
|
||||
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("ot_status"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("ot_status"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = F("connectivity");
|
||||
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_MODE)] = F("all");
|
||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("heating"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_NAME)] = F("Heating");
|
||||
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_MODE)] = F("all");
|
||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("dhw"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("dhw"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_NAME)] = F("DHW");
|
||||
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_MODE)] = F("all");
|
||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("flame"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("flame"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_NAME)] = F("Flame");
|
||||
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_MODE)] = F("all");
|
||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("fault"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("fault"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = F("problem");
|
||||
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_MODE)] = F("all");
|
||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(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_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = F("problem");
|
||||
doc[FPSTR(HA_NAME)] = F("Diagnostic");
|
||||
@@ -1128,8 +1099,8 @@ public:
|
||||
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("ext_pump"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("ext_pump"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = F("running");
|
||||
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_MODE)] = F("all");
|
||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("fault_code"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), F("fault_code"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_NAME)] = F("Fault code");
|
||||
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_MODE)] = F("all");
|
||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("diagnostic_code"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), F("diagnostic_code"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_NAME)] = F("Diagnostic code");
|
||||
doc[FPSTR(HA_ICON)] = F("mdi:information-box");
|
||||
@@ -1184,13 +1155,10 @@ public:
|
||||
|
||||
bool publishNetworkRssi(bool enabledByDefault = true) {
|
||||
JsonDocument doc;
|
||||
doc[FPSTR(HA_AVAILABILITY)][0][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_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(FPSTR(S_RSSI));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), FPSTR(S_RSSI));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = F("signal_strength");
|
||||
doc[FPSTR(HA_STATE_CLASS)] = FPSTR(HA_STATE_CLASS_MEASUREMENT);
|
||||
@@ -1209,8 +1177,8 @@ public:
|
||||
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("uptime"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), F("uptime"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = F("duration");
|
||||
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;
|
||||
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"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_CLIMATE), F("heating"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("heating"));
|
||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||
doc[FPSTR(HA_NAME)] = F("Heating");
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
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("dhw"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_CLIMATE), F("dhw"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("dhw"));
|
||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
||||
doc[FPSTR(HA_NAME)] = F("DHW");
|
||||
doc[FPSTR(HA_ICON)] = F("mdi:faucet");
|
||||
|
||||
@@ -1327,8 +1295,8 @@ public:
|
||||
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(FPSTR(S_RESTART));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BUTTON), FPSTR(S_RESTART));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = FPSTR(S_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_MODE)] = F("all");
|
||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("reset_fault"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BUTTON), F("reset_fault"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
||||
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_MODE)] = F("all");
|
||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("reset_diagnostic"));
|
||||
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BUTTON), F("reset_diagnostic"));
|
||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(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_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
||||
doc[FPSTR(HA_NAME)] = F("Reset diagnostic");
|
||||
|
||||
+31
-69
@@ -43,6 +43,8 @@ protected:
|
||||
bool telnetStarted = false;
|
||||
bool emergencyDetected = false;
|
||||
unsigned long emergencyFlipTime = 0;
|
||||
bool freezeDetected = false;
|
||||
unsigned long freezeDetectedTime = 0;
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
const char* getTaskName() override {
|
||||
@@ -102,8 +104,7 @@ protected:
|
||||
|
||||
vars.mqtt.connected = tMqtt->isConnected();
|
||||
vars.network.connected = network->isConnected();
|
||||
vars.network.rssi = network->getRssi();
|
||||
vars.network.connectionType = network->getUplink();
|
||||
vars.network.rssi = network->isConnected() ? WiFi.RSSI() : 0;
|
||||
|
||||
if (settings.system.logLevel >= TinyLogger::Level::SILENT && settings.system.logLevel <= TinyLogger::Level::VERBOSE) {
|
||||
if (Log.getLevel() != settings.system.logLevel) {
|
||||
@@ -134,6 +135,8 @@ protected:
|
||||
tMqtt->disable();
|
||||
}
|
||||
|
||||
Sensors::setConnectionStatusByType(Sensors::Type::MANUAL, !settings.mqtt.enabled || vars.mqtt.connected, false);
|
||||
|
||||
} else {
|
||||
if (this->ntpStarted) {
|
||||
this->ntpStarted = false;
|
||||
@@ -242,7 +245,7 @@ protected:
|
||||
|
||||
void heating() {
|
||||
// freeze protection
|
||||
{
|
||||
if (!settings.heating.enabled) {
|
||||
float lowTemp = 255.0f;
|
||||
uint8_t availableSensors = 0;
|
||||
|
||||
@@ -273,40 +276,29 @@ protected:
|
||||
availableSensors++;
|
||||
}
|
||||
|
||||
if (availableSensors) {
|
||||
if (vars.master.heating.freezing) {
|
||||
if (lowTemp - (float) settings.heating.freezeProtection.highTemp + 0.0001f >= 0.0f) {
|
||||
vars.master.heating.freezing = false;
|
||||
if (availableSensors && lowTemp <= settings.heating.freezeProtection.lowTemp) {
|
||||
if (!this->freezeDetected) {
|
||||
this->freezeDetected = true;
|
||||
this->freezeDetectedTime = millis();
|
||||
|
||||
Log.sinfoln(
|
||||
FPSTR(L_MAIN),
|
||||
F("No freezing detected. Current low temp: %.2f, threshold (high): %hhu"),
|
||||
lowTemp, settings.heating.freezeProtection.highTemp
|
||||
);
|
||||
}
|
||||
} else if (millis() - this->freezeDetectedTime > (settings.heating.freezeProtection.thresholdTime * 1000)) {
|
||||
this->freezeDetected = false;
|
||||
settings.heating.enabled = true;
|
||||
fsSettings.update();
|
||||
|
||||
} 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;
|
||||
fsSettings.update();
|
||||
}
|
||||
|
||||
Log.sinfoln(
|
||||
FPSTR(L_MAIN),
|
||||
F("Freezing detected! Current low temp: %.2f, threshold (low): %hhu"),
|
||||
lowTemp, settings.heating.freezeProtection.lowTemp
|
||||
);
|
||||
}
|
||||
Log.sinfoln(
|
||||
FPSTR(L_MAIN),
|
||||
F("Heating turned on by freeze protection, current low temp: %.2f, threshold: %hhu"),
|
||||
lowTemp, settings.heating.freezeProtection.lowTemp
|
||||
);
|
||||
}
|
||||
|
||||
} else if (vars.master.heating.freezing) {
|
||||
vars.master.heating.freezing = false;
|
||||
|
||||
Log.sinfoln(FPSTR(L_MAIN), F("No sensors available, freeze protection unavailable!"));
|
||||
} else if (this->freezeDetected) {
|
||||
this->freezeDetected = false;
|
||||
}
|
||||
|
||||
} else if (this->freezeDetected) {
|
||||
this->freezeDetected = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,7 +319,7 @@ protected:
|
||||
emergencyFlags |= 0b00000010;
|
||||
}
|
||||
|
||||
if (settings.opentherm.options.nativeOTC) {
|
||||
if (settings.opentherm.options.nativeHeatingControl) {
|
||||
emergencyFlags |= 0b00000100;
|
||||
}
|
||||
}
|
||||
@@ -617,12 +609,7 @@ protected:
|
||||
if (GPIO_IS_VALID(settings.externalPump.gpio)) {
|
||||
configuredGpio = settings.externalPump.gpio;
|
||||
pinMode(configuredGpio, OUTPUT);
|
||||
digitalWrite(
|
||||
configuredGpio,
|
||||
settings.externalPump.invertState
|
||||
? HIGH
|
||||
: LOW
|
||||
);
|
||||
digitalWrite(configuredGpio, LOW);
|
||||
|
||||
} else if (configuredGpio != GPIO_IS_NOT_CONFIGURED) {
|
||||
configuredGpio = GPIO_IS_NOT_CONFIGURED;
|
||||
@@ -650,12 +637,7 @@ protected:
|
||||
|
||||
if (!settings.externalPump.use) {
|
||||
if (vars.externalPump.state) {
|
||||
digitalWrite(
|
||||
configuredGpio,
|
||||
settings.externalPump.invertState
|
||||
? HIGH
|
||||
: LOW
|
||||
);
|
||||
digitalWrite(configuredGpio, LOW);
|
||||
|
||||
vars.externalPump.state = false;
|
||||
vars.externalPump.lastEnabledTime = millis();
|
||||
@@ -668,12 +650,7 @@ protected:
|
||||
|
||||
if (vars.externalPump.state && !this->heatingEnabled) {
|
||||
if (this->extPumpStartReason == MainTask::PumpStartReason::HEATING && millis() - this->heatingDisabledTime > (settings.externalPump.postCirculationTime * 1000u)) {
|
||||
digitalWrite(
|
||||
configuredGpio,
|
||||
settings.externalPump.invertState
|
||||
? HIGH
|
||||
: LOW
|
||||
);
|
||||
digitalWrite(configuredGpio, LOW);
|
||||
|
||||
vars.externalPump.state = false;
|
||||
vars.externalPump.lastEnabledTime = millis();
|
||||
@@ -681,12 +658,7 @@ protected:
|
||||
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)) {
|
||||
digitalWrite(
|
||||
configuredGpio,
|
||||
settings.externalPump.invertState
|
||||
? HIGH
|
||||
: LOW
|
||||
);
|
||||
digitalWrite(configuredGpio, LOW);
|
||||
|
||||
vars.externalPump.state = false;
|
||||
vars.externalPump.lastEnabledTime = millis();
|
||||
@@ -702,12 +674,7 @@ protected:
|
||||
this->externalPumpStartTime = millis();
|
||||
this->extPumpStartReason = MainTask::PumpStartReason::HEATING;
|
||||
|
||||
digitalWrite(
|
||||
configuredGpio,
|
||||
settings.externalPump.invertState
|
||||
? LOW
|
||||
: HIGH
|
||||
);
|
||||
digitalWrite(configuredGpio, HIGH);
|
||||
|
||||
Log.sinfoln(FPSTR(L_EXTPUMP), F("Enabled: heating on"));
|
||||
|
||||
@@ -716,12 +683,7 @@ protected:
|
||||
this->externalPumpStartTime = millis();
|
||||
this->extPumpStartReason = MainTask::PumpStartReason::ANTISTUCK;
|
||||
|
||||
digitalWrite(
|
||||
configuredGpio,
|
||||
settings.externalPump.invertState
|
||||
? LOW
|
||||
: HIGH
|
||||
);
|
||||
digitalWrite(configuredGpio, HIGH);
|
||||
|
||||
Log.sinfoln(FPSTR(L_EXTPUMP), F("Enabled: anti stuck"));
|
||||
}
|
||||
|
||||
+1
-2
@@ -486,7 +486,6 @@ protected:
|
||||
void publishHaEntities() {
|
||||
// heating
|
||||
this->haHelper->publishSwitchHeatingTurbo(false);
|
||||
this->haHelper->publishSwitchHeatingHysteresis();
|
||||
this->haHelper->publishInputHeatingHysteresis(settings.system.unitSystem);
|
||||
this->haHelper->publishInputHeatingTurboFactor(false);
|
||||
this->haHelper->publishInputHeatingMinTemp(settings.system.unitSystem);
|
||||
@@ -559,7 +558,7 @@ protected:
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
bool published = false;
|
||||
|
||||
+69
-186
@@ -19,8 +19,8 @@ protected:
|
||||
|
||||
CustomOpenTherm* instance = nullptr;
|
||||
unsigned long instanceCreatedTime = 0;
|
||||
uint8_t instanceInGpio = 0;
|
||||
uint8_t instanceOutGpio = 0;
|
||||
byte instanceInGpio = 0;
|
||||
byte instanceOutGpio = 0;
|
||||
bool initialized = false;
|
||||
unsigned long connectedTime = 0;
|
||||
unsigned long disconnectedTime = 0;
|
||||
@@ -31,7 +31,7 @@ protected:
|
||||
unsigned long heatingSetTempTime = 0;
|
||||
unsigned long dhwSetTempTime = 0;
|
||||
unsigned long ch2SetTempTime = 0;
|
||||
uint8_t configuredRxLedGpio = GPIO_IS_NOT_CONFIGURED;
|
||||
byte configuredRxLedGpio = GPIO_IS_NOT_CONFIGURED;
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
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);
|
||||
|
||||
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(
|
||||
FPSTR(L_OT),
|
||||
F("ID: %4d Request: %8lx Response: %8lx Msg type: %s Attempt: %2d Status: %s"),
|
||||
@@ -170,7 +170,8 @@ protected:
|
||||
// Heating settings
|
||||
vars.master.heating.enabled = this->isReady()
|
||||
&& 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;
|
||||
|
||||
// DHW settings
|
||||
@@ -185,9 +186,7 @@ protected:
|
||||
|| (settings.opentherm.options.dhwToCh2 && settings.opentherm.options.dhwSupport && settings.dhw.enabled);
|
||||
|
||||
if (settings.opentherm.options.heatingToCh2) {
|
||||
vars.master.ch2.targetTemp = !settings.opentherm.options.nativeOTC
|
||||
? vars.master.heating.setpointTemp
|
||||
: vars.master.heating.targetTemp;
|
||||
vars.master.ch2.targetTemp = vars.master.heating.setpointTemp;
|
||||
|
||||
} else if (settings.opentherm.options.dhwToCh2) {
|
||||
vars.master.ch2.targetTemp = vars.master.dhw.targetTemp;
|
||||
@@ -219,7 +218,7 @@ protected:
|
||||
vars.master.heating.enabled,
|
||||
vars.master.dhw.enabled,
|
||||
settings.opentherm.options.coolingSupport,
|
||||
settings.opentherm.options.nativeOTC,
|
||||
settings.opentherm.options.nativeHeatingControl,
|
||||
vars.master.ch2.enabled,
|
||||
summerWinterMode,
|
||||
dhwBlocking,
|
||||
@@ -237,7 +236,7 @@ protected:
|
||||
vars.slave.heating.active = CustomOpenTherm::isCentralHeatingActive(response);
|
||||
vars.slave.dhw.active = settings.opentherm.options.dhwSupport ? CustomOpenTherm::isHotWaterActive(response) : false;
|
||||
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.fault.active = CustomOpenTherm::isFault(response);
|
||||
|
||||
@@ -251,7 +250,7 @@ protected:
|
||||
Log.snoticeln(
|
||||
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.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_HEATING_PUMP_HOURS, false);
|
||||
Sensors::setConnectionStatusByType(Sensors::Type::OT_DHW_PUMP_HOURS, false);
|
||||
Sensors::setConnectionStatusByType(Sensors::Type::OT_COOLING_HOURS, false);
|
||||
|
||||
this->initialized = false;
|
||||
this->disconnectedTime = millis();
|
||||
@@ -320,8 +318,6 @@ protected:
|
||||
vars.slave.dhw.enabled = false;
|
||||
vars.slave.dhw.active = false;
|
||||
vars.slave.flame = false;
|
||||
vars.slave.cooling.active = false;
|
||||
vars.slave.cooling.setpoint = 0;
|
||||
vars.slave.fault.active = false;
|
||||
vars.slave.fault.code = 0;
|
||||
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
|
||||
if (settings.opentherm.options.autoFaultReset && vars.slave.fault.active && !vars.actions.resetFault) {
|
||||
vars.actions.resetFault = true;
|
||||
@@ -707,22 +688,6 @@ protected:
|
||||
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
|
||||
uint8_t targetMaxModulation = vars.slave.modulation.max;
|
||||
if (vars.slave.heating.active) {
|
||||
@@ -809,7 +774,7 @@ protected:
|
||||
bool result = this->updateDhwTemp();
|
||||
|
||||
if (result) {
|
||||
const float convertedDhwTemp = convertTemp(
|
||||
float convertedDhwTemp = convertTemp(
|
||||
vars.slave.dhw.currentTemp,
|
||||
settings.opentherm.unitSystem,
|
||||
settings.system.unitSystem
|
||||
@@ -833,7 +798,7 @@ protected:
|
||||
// Update DHW temp 2
|
||||
if (settings.opentherm.options.dhwSupport && Sensors::getAmountByType(Sensors::Type::OT_DHW_TEMP2, true)) {
|
||||
if (this->updateDhwTemp2()) {
|
||||
const float convertedDhwTemp2 = convertTemp(
|
||||
float convertedDhwTemp2 = convertTemp(
|
||||
vars.slave.dhw.currentTemp2,
|
||||
settings.opentherm.unitSystem,
|
||||
settings.system.unitSystem
|
||||
@@ -857,7 +822,7 @@ protected:
|
||||
// Update DHW flow rate
|
||||
if (settings.opentherm.options.dhwSupport && Sensors::getAmountByType(Sensors::Type::OT_DHW_FLOW_RATE, true)) {
|
||||
if (this->updateDhwFlowRate()) {
|
||||
const float convertedDhwFlowRate = convertVolume(
|
||||
float convertedDhwFlowRate = convertVolume(
|
||||
vars.slave.dhw.flowRate,
|
||||
settings.opentherm.unitSystem,
|
||||
settings.system.unitSystem
|
||||
@@ -881,7 +846,7 @@ protected:
|
||||
// Update heating temp
|
||||
if (Sensors::getAmountByType(Sensors::Type::OT_HEATING_TEMP, true)) {
|
||||
if (this->updateHeatingTemp()) {
|
||||
const float convertedHeatingTemp = convertTemp(
|
||||
float convertedHeatingTemp = convertTemp(
|
||||
vars.slave.heating.currentTemp,
|
||||
settings.opentherm.unitSystem,
|
||||
settings.system.unitSystem
|
||||
@@ -905,7 +870,7 @@ protected:
|
||||
// Update heating return temp
|
||||
if (Sensors::getAmountByType(Sensors::Type::OT_HEATING_RETURN_TEMP, true)) {
|
||||
if (this->updateHeatingReturnTemp()) {
|
||||
const float convertedHeatingReturnTemp = convertTemp(
|
||||
float convertedHeatingReturnTemp = convertTemp(
|
||||
vars.slave.heating.returnTemp,
|
||||
settings.opentherm.unitSystem,
|
||||
settings.system.unitSystem
|
||||
@@ -928,9 +893,9 @@ protected:
|
||||
|
||||
// Update CH2 temp
|
||||
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()) {
|
||||
const float convertedCh2Temp = convertTemp(
|
||||
float convertedCh2Temp = convertTemp(
|
||||
vars.slave.ch2.currentTemp,
|
||||
settings.opentherm.unitSystem,
|
||||
settings.system.unitSystem
|
||||
@@ -955,7 +920,7 @@ protected:
|
||||
// Update exhaust temp
|
||||
if (Sensors::getAmountByType(Sensors::Type::OT_EXHAUST_TEMP, true)) {
|
||||
if (this->updateExhaustTemp()) {
|
||||
const float convertedExhaustTemp = convertTemp(
|
||||
float convertedExhaustTemp = convertTemp(
|
||||
vars.slave.exhaust.temp,
|
||||
settings.opentherm.unitSystem,
|
||||
settings.system.unitSystem
|
||||
@@ -979,7 +944,7 @@ protected:
|
||||
// Update heat exchanger temp
|
||||
if (Sensors::getAmountByType(Sensors::Type::OT_HEAT_EXCHANGER_TEMP, true)) {
|
||||
if (this->updateHeatExchangerTemp()) {
|
||||
const float convertedHeatExchTemp = convertTemp(
|
||||
float convertedHeatExchTemp = convertTemp(
|
||||
vars.slave.heatExchangerTemp,
|
||||
settings.opentherm.unitSystem,
|
||||
settings.system.unitSystem
|
||||
@@ -1003,7 +968,7 @@ protected:
|
||||
// Update outdoor temp
|
||||
if (Sensors::getAmountByType(Sensors::Type::OT_OUTDOOR_TEMP, true)) {
|
||||
if (this->updateOutdoorTemp()) {
|
||||
const float convertedOutdoorTemp = convertTemp(
|
||||
float convertedOutdoorTemp = convertTemp(
|
||||
vars.slave.heating.outdoorTemp,
|
||||
settings.opentherm.unitSystem,
|
||||
settings.system.unitSystem
|
||||
@@ -1027,7 +992,7 @@ protected:
|
||||
// Update solar storage temp
|
||||
if (Sensors::getAmountByType(Sensors::Type::OT_SOLAR_STORAGE_TEMP, true)) {
|
||||
if (this->updateSolarStorageTemp()) {
|
||||
const float convertedSolarStorageTemp = convertTemp(
|
||||
float convertedSolarStorageTemp = convertTemp(
|
||||
vars.slave.solar.storage,
|
||||
settings.opentherm.unitSystem,
|
||||
settings.system.unitSystem
|
||||
@@ -1051,7 +1016,7 @@ protected:
|
||||
// Update solar collector temp
|
||||
if (Sensors::getAmountByType(Sensors::Type::OT_SOLAR_COLLECTOR_TEMP, true)) {
|
||||
if (this->updateSolarCollectorTemp()) {
|
||||
const float convertedSolarCollectorTemp = convertTemp(
|
||||
float convertedSolarCollectorTemp = convertTemp(
|
||||
vars.slave.solar.collector,
|
||||
settings.opentherm.unitSystem,
|
||||
settings.system.unitSystem
|
||||
@@ -1097,7 +1062,7 @@ protected:
|
||||
// Update pressure
|
||||
if (Sensors::getAmountByType(Sensors::Type::OT_PRESSURE, true)) {
|
||||
if (this->updatePressure()) {
|
||||
const float convertedPressure = convertPressure(
|
||||
float convertedPressure = convertPressure(
|
||||
vars.slave.pressure,
|
||||
settings.opentherm.unitSystem,
|
||||
settings.system.unitSystem
|
||||
@@ -1203,12 +1168,9 @@ protected:
|
||||
|
||||
// Update DHW temp
|
||||
if (vars.master.dhw.enabled) {
|
||||
// Target dhw temp
|
||||
const float& targetTemp = vars.master.dhw.targetTemp;
|
||||
|
||||
// Converted target dhw temp
|
||||
const float convertedTemp = convertTemp(
|
||||
targetTemp,
|
||||
float convertedTemp = convertTemp(
|
||||
vars.master.dhw.targetTemp,
|
||||
settings.system.unitSystem,
|
||||
settings.opentherm.unitSystem
|
||||
);
|
||||
@@ -1220,7 +1182,7 @@ protected:
|
||||
|
||||
Log.sinfoln(
|
||||
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 {
|
||||
@@ -1229,19 +1191,16 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
// Send indoor temp if AlwaysSendIndoorTemp option is enabled.
|
||||
if (settings.opentherm.options.nativeOTC || settings.opentherm.options.alwaysSendIndoorTemp) {
|
||||
// Current indoor temp
|
||||
const float& indoorTemp = vars.master.heating.indoorTemp;
|
||||
|
||||
// Native heating control
|
||||
if (settings.opentherm.options.nativeHeatingControl) {
|
||||
// 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
|
||||
if (this->setRoomTemp(convertedTemp)) {
|
||||
Log.sinfoln(
|
||||
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 {
|
||||
@@ -1253,26 +1212,17 @@ protected:
|
||||
if (this->setRoomTempCh2(convertedTemp)) {
|
||||
Log.sinfoln(
|
||||
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 {
|
||||
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
|
||||
const float convertedTemp = convertTemp(
|
||||
targetTemp,
|
||||
settings.system.unitSystem,
|
||||
settings.opentherm.unitSystem
|
||||
);
|
||||
convertedTemp = convertTemp(vars.master.heating.targetTemp, settings.system.unitSystem, settings.opentherm.unitSystem);
|
||||
|
||||
// Set target indoor temp
|
||||
if (this->needSetHeatingTemp(convertedTemp)) {
|
||||
@@ -1281,7 +1231,7 @@ protected:
|
||||
|
||||
Log.sinfoln(
|
||||
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 {
|
||||
@@ -1296,7 +1246,7 @@ protected:
|
||||
|
||||
Log.sinfoln(
|
||||
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 {
|
||||
@@ -1305,22 +1255,10 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
// Set heating temp
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Normal heating control
|
||||
if (!settings.opentherm.options.nativeHeatingControl && vars.master.heating.enabled) {
|
||||
// Converted target heating temp
|
||||
const float convertedTemp = convertTemp(
|
||||
targetTemp,
|
||||
settings.system.unitSystem,
|
||||
settings.opentherm.unitSystem
|
||||
);
|
||||
float convertedTemp = convertTemp(vars.master.heating.setpointTemp, settings.system.unitSystem, settings.opentherm.unitSystem);
|
||||
|
||||
if (this->needSetHeatingTemp(convertedTemp)) {
|
||||
// Set max heating temp
|
||||
@@ -1328,13 +1266,13 @@ protected:
|
||||
if (this->setMaxHeatingTemp(convertedTemp)) {
|
||||
Log.sinfoln(
|
||||
FPSTR(L_OT_HEATING), F("Set max heating temp: %.2f (converted: %.2f)"),
|
||||
targetTemp, convertedTemp
|
||||
vars.master.heating.setpointTemp, convertedTemp
|
||||
);
|
||||
|
||||
} else {
|
||||
Log.swarningln(
|
||||
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(
|
||||
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 {
|
||||
@@ -1355,30 +1293,27 @@ protected:
|
||||
}
|
||||
|
||||
// Set CH2 temp
|
||||
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;
|
||||
if (!settings.opentherm.options.nativeHeatingControl && vars.master.ch2.enabled) {
|
||||
if (settings.opentherm.options.heatingToCh2 || settings.opentherm.options.dhwToCh2) {
|
||||
// Converted target CH2 temp
|
||||
float convertedTemp = convertTemp(
|
||||
vars.master.ch2.targetTemp,
|
||||
settings.system.unitSystem,
|
||||
settings.opentherm.unitSystem
|
||||
);
|
||||
|
||||
// Converted target CH2 temp
|
||||
const float convertedTemp = convertTemp(
|
||||
targetTemp,
|
||||
settings.system.unitSystem,
|
||||
settings.opentherm.unitSystem
|
||||
);
|
||||
if (this->needSetCh2Temp(convertedTemp)) {
|
||||
if (this->setCh2Temp(convertedTemp)) {
|
||||
this->ch2SetTempTime = millis();
|
||||
|
||||
if (this->needSetCh2Temp(convertedTemp)) {
|
||||
if (this->setCh2Temp(convertedTemp)) {
|
||||
this->ch2SetTempTime = millis();
|
||||
Log.sinfoln(
|
||||
FPSTR(L_OT_CH2), F("Set temp: %.2f (converted: %.2f, response: %.2f)"),
|
||||
vars.master.ch2.targetTemp, convertedTemp, vars.slave.ch2.targetTemp
|
||||
);
|
||||
|
||||
Log.sinfoln(
|
||||
FPSTR(L_OT_CH2), F("Set temp: %.2f (converted: %.2f, response: %.2f)"),
|
||||
targetTemp, convertedTemp, vars.slave.ch2.targetTemp
|
||||
);
|
||||
|
||||
} else {
|
||||
Log.swarningln(FPSTR(L_OT_CH2), F("Failed set temp"));
|
||||
} else {
|
||||
Log.swarningln(FPSTR(L_OT_CH2), F("Failed set temp"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1386,7 +1321,7 @@ protected:
|
||||
|
||||
// Heating overheat control
|
||||
if (settings.heating.overheatProtection.highTemp > 0 && settings.heating.overheatProtection.lowTemp > 0) {
|
||||
const float highTemp = convertTemp(
|
||||
float highTemp = convertTemp(
|
||||
max({
|
||||
vars.slave.heating.currentTemp,
|
||||
vars.slave.heating.returnTemp,
|
||||
@@ -1423,7 +1358,7 @@ protected:
|
||||
|
||||
// DHW overheat control
|
||||
if (settings.dhw.overheatProtection.highTemp > 0 && settings.dhw.overheatProtection.lowTemp > 0) {
|
||||
const float highTemp = convertTemp(
|
||||
float highTemp = convertTemp(
|
||||
max({
|
||||
vars.slave.heating.currentTemp,
|
||||
vars.slave.heating.returnTemp,
|
||||
@@ -1517,19 +1452,6 @@ protected:
|
||||
} else {
|
||||
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() {
|
||||
@@ -1646,26 +1568,6 @@ protected:
|
||||
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) {
|
||||
const unsigned int request = CustomOpenTherm::toFloat(value);
|
||||
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 long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
||||
OpenThermMessageType::WRITE_DATA,
|
||||
@@ -1727,7 +1629,7 @@ protected:
|
||||
return CustomOpenTherm::getUInt(response) == request;
|
||||
}
|
||||
|
||||
bool setRoomTempCh2(const float temperature) {
|
||||
bool setRoomTempCh2(float temperature) {
|
||||
const unsigned int request = CustomOpenTherm::temperatureToData(temperature);
|
||||
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
||||
OpenThermMessageType::WRITE_DATA,
|
||||
@@ -2229,25 +2131,6 @@ protected:
|
||||
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() {
|
||||
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
||||
OpenThermRequestType::READ_DATA,
|
||||
@@ -2262,7 +2145,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
const float value = CustomOpenTherm::getFloat(response);
|
||||
float value = CustomOpenTherm::getFloat(response);
|
||||
if (value < 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -2286,7 +2169,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
const float value = CustomOpenTherm::getFloat(response);
|
||||
float value = CustomOpenTherm::getFloat(response);
|
||||
if (value <= 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -2310,7 +2193,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
const float value = CustomOpenTherm::getFloat(response);
|
||||
float value = CustomOpenTherm::getFloat(response);
|
||||
if (value <= 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -2364,7 +2247,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
const float value = CustomOpenTherm::getFloat(response);
|
||||
float value = CustomOpenTherm::getFloat(response);
|
||||
if (value <= 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -2428,7 +2311,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
const float value = (float) CustomOpenTherm::getInt(response);
|
||||
float value = (float) CustomOpenTherm::getInt(response);
|
||||
if (!isValidTemp(value, settings.opentherm.unitSystem, -40, 500)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2452,7 +2335,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
const float value = (float) CustomOpenTherm::getInt(response);
|
||||
float value = (float) CustomOpenTherm::getInt(response);
|
||||
if (value <= 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -2553,7 +2436,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
const float value = CustomOpenTherm::getFloat(response);
|
||||
float value = CustomOpenTherm::getFloat(response);
|
||||
if (value < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+56
-201
@@ -29,7 +29,6 @@ public:
|
||||
this->webServer = new WebServer(80);
|
||||
this->bufferedWebServer = new BufferedWebServer(this->webServer, 32u);
|
||||
this->dnsServer = new DNSServer();
|
||||
this->mDnsRetryTime = millis() - this->mDnsRetryInterval;
|
||||
}
|
||||
|
||||
~PortalTask() {
|
||||
@@ -57,11 +56,6 @@ protected:
|
||||
bool dnsServerEnabled = false;
|
||||
unsigned long webServerChangeState = 0;
|
||||
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)
|
||||
const char* getTaskName() override {
|
||||
@@ -247,17 +241,7 @@ protected:
|
||||
|
||||
doc.shrinkToFit();
|
||||
|
||||
char filename[64];
|
||||
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->webServer->sendHeader(F("Content-Disposition"), F("attachment; filename=\"backup.json\""));
|
||||
this->bufferedWebServer->send(200, F("application/json"), doc);
|
||||
});
|
||||
|
||||
@@ -302,14 +286,12 @@ protected:
|
||||
networkSettings.staticConfig.gateway,
|
||||
networkSettings.staticConfig.subnet,
|
||||
networkSettings.staticConfig.dns
|
||||
)
|
||||
->setEthernet(networkSettings.ethernet.enabled);
|
||||
);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (!doc[FPSTR(S_SETTINGS)].isNull() && jsonToSettings(doc[FPSTR(S_SETTINGS)], settings)) {
|
||||
fsSettings.update();
|
||||
applyEthernetSettings();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
@@ -323,14 +305,14 @@ protected:
|
||||
if (sensorId < 0 || sensorId > 255 || !Sensors::isValidSensorId(sensorId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (jsonToSensorSettings(sensorId, sensor.value(), Sensors::settings[sensorId])) {
|
||||
fsSensorsSettings.update();
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
doc.clear();
|
||||
doc.shrinkToFit();
|
||||
|
||||
@@ -349,7 +331,6 @@ protected:
|
||||
|
||||
JsonDocument doc;
|
||||
networkSettingsToJson(networkSettings, doc);
|
||||
this->ethernetToJson(doc);
|
||||
doc.shrinkToFit();
|
||||
|
||||
this->bufferedWebServer->send(200, F("application/json"), doc);
|
||||
@@ -359,7 +340,7 @@ protected:
|
||||
if (this->isAuthRequired() && !this->isValidCredentials()) {
|
||||
return this->webServer->send(401);
|
||||
}
|
||||
|
||||
|
||||
if (vars.states.restarting) {
|
||||
return this->webServer->send(503);
|
||||
}
|
||||
@@ -385,20 +366,12 @@ protected:
|
||||
}
|
||||
|
||||
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.shrinkToFit();
|
||||
|
||||
networkSettingsToJson(networkSettings, doc);
|
||||
this->ethernetToJson(doc);
|
||||
doc.shrinkToFit();
|
||||
|
||||
|
||||
this->bufferedWebServer->send(changed ? 201 : 200, F("application/json"), doc);
|
||||
|
||||
if (changed) {
|
||||
@@ -416,10 +389,7 @@ protected:
|
||||
networkSettings.staticConfig.subnet,
|
||||
networkSettings.staticConfig.dns
|
||||
)
|
||||
->setEthernet(networkSettings.ethernet.enabled)
|
||||
->reconnect();
|
||||
|
||||
this->applyEthernetSettings();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -428,12 +398,6 @@ protected:
|
||||
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();
|
||||
if (apCount <= 0) {
|
||||
if (apCount != WIFI_SCAN_RUNNING) {
|
||||
@@ -443,11 +407,11 @@ protected:
|
||||
WiFi.scanNetworks(true, true, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
this->webServer->send(404);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
JsonDocument doc;
|
||||
for (short int i = 0; i < apCount; i++) {
|
||||
const String& ssid = WiFi.SSID(i);
|
||||
@@ -480,7 +444,7 @@ protected:
|
||||
JsonDocument doc;
|
||||
settingsToJson(settings, doc);
|
||||
doc.shrinkToFit();
|
||||
|
||||
|
||||
this->bufferedWebServer->send(200, F("application/json"), doc);
|
||||
});
|
||||
|
||||
@@ -488,7 +452,7 @@ protected:
|
||||
if (this->isAuthRequired() && !this->isValidCredentials()) {
|
||||
return this->webServer->send(401);
|
||||
}
|
||||
|
||||
|
||||
if (vars.states.restarting) {
|
||||
return this->webServer->send(503);
|
||||
}
|
||||
@@ -527,7 +491,6 @@ protected:
|
||||
doc.shrinkToFit();
|
||||
|
||||
fsSettings.update();
|
||||
applyEthernetSettings();
|
||||
tMqtt->resetPublishedSettingsTime();
|
||||
}
|
||||
});
|
||||
@@ -543,7 +506,7 @@ protected:
|
||||
if (this->webServer->hasArg(F("detailed"))) {
|
||||
detailed = this->webServer->arg(F("detailed")).toInt() > 0;
|
||||
}
|
||||
|
||||
|
||||
JsonDocument doc;
|
||||
for (uint8_t sensorId = 0; sensorId <= Sensors::getMaxSensorId(); sensorId++) {
|
||||
if (detailed) {
|
||||
@@ -557,7 +520,7 @@ protected:
|
||||
doc[sensorId] = Sensors::settings[sensorId].name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
doc.shrinkToFit();
|
||||
this->bufferedWebServer->send(200, F("application/json"), doc);
|
||||
});
|
||||
@@ -567,7 +530,7 @@ protected:
|
||||
if (this->isAuthRequired() && !this->isValidCredentials()) {
|
||||
return this->webServer->send(401);
|
||||
}
|
||||
|
||||
|
||||
if (!this->webServer->hasArg(F("id"))) {
|
||||
return this->webServer->send(400);
|
||||
}
|
||||
@@ -588,12 +551,12 @@ protected:
|
||||
doc.shrinkToFit();
|
||||
this->bufferedWebServer->send(200, F("application/json"), doc);
|
||||
});
|
||||
|
||||
|
||||
this->webServer->on(F("/api/sensor"), HTTP_POST, [this]() {
|
||||
if (this->isAuthRequired() && !this->isValidCredentials()) {
|
||||
return this->webServer->send(401);
|
||||
}
|
||||
|
||||
|
||||
if (vars.states.restarting) {
|
||||
return this->webServer->send(503);
|
||||
}
|
||||
@@ -650,7 +613,7 @@ protected:
|
||||
auto& sSettings = Sensors::settings[sensorId];
|
||||
sensorSettingsToJson(sensorId, sSettings, doc);
|
||||
doc.shrinkToFit();
|
||||
|
||||
|
||||
this->bufferedWebServer->send(changed ? 201 : 200, F("application/json"), doc);
|
||||
}
|
||||
|
||||
@@ -701,13 +664,13 @@ protected:
|
||||
|
||||
varsToJson(vars, doc);
|
||||
doc.shrinkToFit();
|
||||
|
||||
|
||||
this->bufferedWebServer->send(changed ? 201 : 200, F("application/json"), doc);
|
||||
|
||||
if (changed) {
|
||||
doc.clear();
|
||||
doc.shrinkToFit();
|
||||
|
||||
|
||||
tMqtt->resetPublishedVarsTime();
|
||||
}
|
||||
});
|
||||
@@ -717,16 +680,6 @@ protected:
|
||||
|
||||
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>();
|
||||
docSystem[FPSTR(S_RESET_REASON)] = getResetReason();
|
||||
docSystem[FPSTR(S_UPTIME)] = millis() / 1000;
|
||||
@@ -735,15 +688,9 @@ protected:
|
||||
docNetwork[FPSTR(S_HOSTNAME)] = networkSettings.hostname;
|
||||
docNetwork[FPSTR(S_MAC)] = network->getStaMac();
|
||||
docNetwork[FPSTR(S_CONNECTED)] = isConnected;
|
||||
docNetwork[FPSTR(S_CONNECTION_TYPE)] = network->getConnectionType();
|
||||
// SSID, signal and channel describe the WiFi uplink only: with ethernet up the radio is
|
||||
// parked and those readings are stale, so report them as not applicable rather than 0 dBm
|
||||
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_SSID)] = network->getStaSsid();
|
||||
docNetwork[FPSTR(S_SIGNAL_QUALITY)] = isConnected ? NetworkMgr::rssiToSignalQuality(network->getRssi()) : 0;
|
||||
docNetwork[FPSTR(S_CHANNEL)] = isConnected ? network->getStaChannel() : 0;
|
||||
docNetwork[FPSTR(S_IP)] = isConnected ? network->getStaIp().toString() : "";
|
||||
docNetwork[FPSTR(S_SUBNET)] = isConnected ? network->getStaSubnet().toString() : "";
|
||||
docNetwork[FPSTR(S_GATEWAY)] = isConnected ? network->getStaGateway().toString() : "";
|
||||
@@ -770,7 +717,7 @@ protected:
|
||||
docHeap[FPSTR(S_MIN_FREE)] = getFreeHeap(true);
|
||||
docHeap[FPSTR(S_MAX_FREE_BLOCK)] = getMaxFreeBlockHeap();
|
||||
docHeap[FPSTR(S_MIN_MAX_FREE_BLOCK)] = getMaxFreeBlockHeap(true);
|
||||
|
||||
|
||||
auto docChip = doc[FPSTR(S_CHIP)].to<JsonObject>();
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
docChip[FPSTR(S_MODEL)] = esp_is_8285() ? F("ESP8285") : F("ESP8266");
|
||||
@@ -809,9 +756,6 @@ protected:
|
||||
this->webServer->on(F("/api/debug"), HTTP_GET, [this]() {
|
||||
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>();
|
||||
docBuild[FPSTR(S_VERSION)] = BUILD_VERSION;
|
||||
docBuild[FPSTR(S_DATE)] = __DATE__ " " __TIME__;
|
||||
@@ -833,7 +777,7 @@ protected:
|
||||
docHeap[FPSTR(S_MIN_FREE)] = getFreeHeap(true);
|
||||
docHeap[FPSTR(S_MAX_FREE_BLOCK)] = getMaxFreeBlockHeap();
|
||||
docHeap[FPSTR(S_MIN_MAX_FREE_BLOCK)] = getMaxFreeBlockHeap(true);
|
||||
|
||||
|
||||
auto docChip = doc[FPSTR(S_CHIP)].to<JsonObject>();
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
docChip[FPSTR(S_MODEL)] = esp_is_8285() ? F("ESP8285") : F("ESP8266");
|
||||
@@ -892,21 +836,10 @@ protected:
|
||||
docCrash[FPSTR(S_EPC)] = epcStr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
doc.shrinkToFit();
|
||||
|
||||
char filename[64];
|
||||
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->webServer->sendHeader(F("Content-Disposition"), F("attachment; filename=\"debug.json\""));
|
||||
this->bufferedWebServer->send(200, F("application/json"), doc, true);
|
||||
});
|
||||
|
||||
@@ -938,31 +871,54 @@ protected:
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
this->delay(250);
|
||||
#endif
|
||||
|
||||
|
||||
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
|
||||
::optimistic_yield(1000);
|
||||
#endif
|
||||
|
||||
} else if (this->stateWebServer() && !network->isApEnabled() && !network->isConnected()) {
|
||||
} else if (this->stateWebServer() && !network->isApEnabled() && !network->isStaEnabled()) {
|
||||
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
|
||||
::optimistic_yield(1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
// mDNS
|
||||
this->loopMdns();
|
||||
// Disabling mDNS if disabled in settings
|
||||
if (this->mDnsState && !settings.portal.mdns) {
|
||||
MDNS.end();
|
||||
this->mDnsState = false;
|
||||
|
||||
Log.straceln(FPSTR(L_PORTAL_WEBSERVER), F("mDNS disabled"));
|
||||
}
|
||||
|
||||
// dns server
|
||||
if (!this->stateDnsServer() && !network->isConnected() && network->isApEnabled() && this->stateWebServer()) {
|
||||
this->startDnsServer();
|
||||
Log.straceln(FPSTR(L_PORTAL_DNSSERVER), F("Started: AP up"));
|
||||
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
::optimistic_yield(1000);
|
||||
#endif
|
||||
@@ -1005,99 +961,6 @@ protected:
|
||||
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() {
|
||||
return this->webServer->authenticate(settings.portal.login, settings.portal.password);
|
||||
}
|
||||
@@ -1183,12 +1046,4 @@ protected:
|
||||
this->dnsServer->stop();
|
||||
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->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.minTemp = THERMOSTAT_INDOOR_MIN_TEMP;
|
||||
vars.master.heating.maxTemp = THERMOSTAT_INDOOR_MAX_TEMP;
|
||||
@@ -90,15 +90,15 @@ protected:
|
||||
|
||||
void hysteresis() {
|
||||
bool useHyst = false;
|
||||
if (settings.heating.hysteresis.enabled && this->indoorSensorsConnected) {
|
||||
useHyst = settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeOTC;
|
||||
if (settings.heating.hysteresis > 0.01f && this->indoorSensorsConnected) {
|
||||
useHyst = settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeHeatingControl;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
} 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;
|
||||
}
|
||||
|
||||
@@ -108,13 +108,13 @@ protected:
|
||||
}
|
||||
|
||||
inline float getHeatingMinSetpointTemp() {
|
||||
return settings.opentherm.options.nativeOTC
|
||||
return settings.opentherm.options.nativeHeatingControl
|
||||
? vars.master.heating.minTemp
|
||||
: settings.heating.minTemp;
|
||||
}
|
||||
|
||||
inline float getHeatingMaxSetpointTemp() {
|
||||
return settings.opentherm.options.nativeOTC
|
||||
return settings.opentherm.options.nativeHeatingControl
|
||||
? vars.master.heating.maxTemp
|
||||
: settings.heating.maxTemp;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ protected:
|
||||
if (vars.emergency.state) {
|
||||
return settings.emergency.target;
|
||||
|
||||
} else if (settings.opentherm.options.nativeOTC) {
|
||||
} else if (settings.opentherm.options.nativeHeatingControl) {
|
||||
return settings.heating.target;
|
||||
|
||||
} else if (!settings.equitherm.enabled && !settings.pid.enabled) {
|
||||
@@ -204,8 +204,7 @@ protected:
|
||||
}*/
|
||||
|
||||
float error = pidRegulator.setpoint - pidRegulator.input;
|
||||
bool hasDeadband = settings.pid.deadband.enabled
|
||||
&& (error > -(settings.pid.deadband.thresholdHigh))
|
||||
bool hasDeadband = (error > -(settings.pid.deadband.thresholdHigh))
|
||||
&& (error < settings.pid.deadband.thresholdLow);
|
||||
|
||||
if (hasDeadband) {
|
||||
@@ -240,11 +239,6 @@ protected:
|
||||
) * 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;
|
||||
}
|
||||
};
|
||||
+5
-6
@@ -34,7 +34,6 @@ public:
|
||||
OT_DHW_BURNER_HOURS = 24,
|
||||
OT_HEATING_PUMP_HOURS = 25,
|
||||
OT_DHW_PUMP_HOURS = 26,
|
||||
OT_COOLING_HOURS = 27,
|
||||
|
||||
NTC_10K_TEMP = 50,
|
||||
DALLAS_TEMP = 51,
|
||||
@@ -150,7 +149,7 @@ public:
|
||||
|
||||
static int16_t getIdByName(const char* name) {
|
||||
if (settings == nullptr) {
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (uint8_t id = 0; id <= getMaxSensorId(); id++) {
|
||||
@@ -164,7 +163,7 @@ public:
|
||||
|
||||
static int16_t getIdByObjectId(const char* objectId) {
|
||||
if (settings == nullptr) {
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
String refObjectId;
|
||||
@@ -330,12 +329,12 @@ public:
|
||||
|
||||
static float getMeanValueByPurpose(Purpose purpose, const ValueType valueType, bool onlyConnected = true) {
|
||||
if (settings == nullptr || results == nullptr) {
|
||||
return 0.0f;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t valueId = (uint8_t) valueType;
|
||||
if (!isValidValueId(valueId)) {
|
||||
return 0.0f;
|
||||
return false;
|
||||
}
|
||||
|
||||
float value = 0.0f;
|
||||
@@ -364,7 +363,7 @@ public:
|
||||
|
||||
static bool existsConnectedSensorsByPurpose(Purpose purpose) {
|
||||
if (settings == nullptr || results == nullptr) {
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (uint8_t id = 0; id <= getMaxSensorId(); id++) {
|
||||
|
||||
+103
-125
@@ -8,45 +8,6 @@
|
||||
|
||||
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 {
|
||||
public:
|
||||
SensorsTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {
|
||||
@@ -66,8 +27,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
const unsigned int wiredDisconnectTimeout = 180000u;
|
||||
const unsigned int wirelessDisconnectTimeout = 600000u;
|
||||
const unsigned int disconnectedTimeout = 120000;
|
||||
const unsigned short dallasSearchInterval = 60000;
|
||||
const unsigned short dallasPollingInterval = 10000;
|
||||
const unsigned short globalPollingInterval = 15000;
|
||||
@@ -81,7 +41,6 @@ protected:
|
||||
std::unordered_map<uint8_t, bool> dallasPolling;
|
||||
std::unordered_map<uint8_t, unsigned long> dallasLastPollingTime;
|
||||
#if USE_BLE
|
||||
std::unordered_map<uint8_t, NimBLEClient*> bleClients;
|
||||
std::unordered_map<uint8_t, bool> bleSubscribed;
|
||||
std::unordered_map<uint8_t, unsigned long> bleLastSetDtTime;
|
||||
#endif
|
||||
@@ -426,7 +385,7 @@ protected:
|
||||
continue;
|
||||
}
|
||||
|
||||
const float sensorResistance = value > 1
|
||||
const float sensorResistance = value > 0.001f
|
||||
? DEFAULT_NTC_REF_RESISTANCE / (DEFAULT_NTC_VREF / (float) value - 1.0f)
|
||||
: 0.0f;
|
||||
const float rawTemp = 1.0f / (
|
||||
@@ -446,35 +405,47 @@ protected:
|
||||
|
||||
#if USE_BLE
|
||||
void cleanBleInstances() {
|
||||
#if USE_BLE
|
||||
if (!NimBLEDevice::isInitialized()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto& [sensorId, pClient]: this->bleClients) {
|
||||
if (pClient == nullptr) {
|
||||
continue;
|
||||
for (auto client : NimBLEDevice::getConnectedClients()) {
|
||||
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;
|
||||
}
|
||||
|
||||
auto pAddress = address.getVal();
|
||||
uint8_t addr[] = {
|
||||
pAddress[5], pAddress[4], pAddress[3],
|
||||
pAddress[2], pAddress[1], pAddress[0]
|
||||
};
|
||||
|
||||
if (isEqualAddress(addr, sSensor.address, sizeof(addr))) {
|
||||
used = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
auto& sSensor = Sensors::settings[sensorId];
|
||||
const auto sAddress = NimBLEAddress(sSensor.address, 0);
|
||||
|
||||
if (sAddress.isNull() || !sSensor.enabled || sSensor.type != Sensors::Type::BLUETOOTH || sSensor.purpose == Sensors::Purpose::NOT_CONFIGURED) {
|
||||
if (!used) {
|
||||
Log.sinfoln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s', deleted unused client"),
|
||||
sensorId, sSensor.name
|
||||
FPSTR(L_SENSORS_BLE), F("Deleted unused client connected to %s"),
|
||||
address.toString().c_str()
|
||||
);
|
||||
|
||||
NimBLEDevice::deleteClient(pClient);
|
||||
pClient = nullptr;
|
||||
NimBLEDevice::deleteClient(client);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void pollingBleSensors() {
|
||||
if (!Sensors::getAmountByType(Sensors::Type::BLUETOOTH, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!NimBLEDevice::isInitialized() && millis() > 5000) {
|
||||
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Initialized"));
|
||||
BLEDevice::init("");
|
||||
@@ -489,47 +460,38 @@ protected:
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto address = NimBLEAddress(sSensor.address, 0);
|
||||
if (address.isNull()) {
|
||||
auto client = this->getBleClient(sensorId);
|
||||
if (client == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto pClient = this->getBleClient(sensorId);
|
||||
if (pClient == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pClient->getPeerAddress() != address) {
|
||||
if (pClient->isConnected()) {
|
||||
if (!pClient->disconnect()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
pClient->setPeerAddress(address);
|
||||
}
|
||||
|
||||
if (!pClient->isConnected()) {
|
||||
if (!client->isConnected()) {
|
||||
this->bleSubscribed[sensorId] = false;
|
||||
this->bleLastSetDtTime[sensorId] = 0;
|
||||
|
||||
if (pClient->connect(false, true, true)) {
|
||||
if (client->connect()) {
|
||||
Log.sinfoln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': trying connecting to %s..."),
|
||||
sensorId, sSensor.name, pClient->getPeerAddress().toString().c_str()
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': connected to %s"),
|
||||
sensorId, sSensor.name, client->getPeerAddress().toString().c_str()
|
||||
);
|
||||
}
|
||||
|
||||
continue;
|
||||
} else {
|
||||
Log.swarningln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed connecting to %s"),
|
||||
sensorId, sSensor.name, client->getPeerAddress().toString().c_str()
|
||||
);
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this->bleSubscribed[sensorId]) {
|
||||
if (this->subscribeToBleDevice(sensorId, pClient)) {
|
||||
if (this->subscribeToBleDevice(sensorId, client)) {
|
||||
this->bleSubscribed[sensorId] = true;
|
||||
|
||||
} else {
|
||||
this->bleSubscribed[sensorId] = false;
|
||||
pClient->disconnect();
|
||||
client->disconnect();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -541,7 +503,7 @@ protected:
|
||||
struct tm ti;
|
||||
|
||||
if (getLocalTime(&ti)) {
|
||||
if (this->setDateOnBleSensor(pClient, &ti)) {
|
||||
if (this->setDateOnBleSensor(client, &ti)) {
|
||||
Log.sinfoln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s', successfully set date: %02d.%02d.%04d %02d:%02d:%02d"),
|
||||
sensorId, sSensor.name,
|
||||
@@ -573,29 +535,49 @@ protected:
|
||||
if (!sSensor.enabled || sSensor.type != Sensors::Type::BLUETOOTH || sSensor.purpose == Sensors::Purpose::NOT_CONFIGURED) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (this->bleClients[sensorId] && this->bleClients[sensorId] != nullptr) {
|
||||
return this->bleClients[sensorId];
|
||||
}
|
||||
|
||||
auto pClient = NimBLEDevice::createClient();
|
||||
|
||||
uint8_t addr[6] = {
|
||||
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) {
|
||||
return nullptr;
|
||||
pClient = NimBLEDevice::getDisconnectedClient();
|
||||
}
|
||||
|
||||
//pClient->setConnectionParams(BLE_GAP_CONN_ITVL_MS(10), BLE_GAP_CONN_ITVL_MS(100), 10, 150);
|
||||
pClient->setConnectTimeout(30000);
|
||||
pClient->setSelfDelete(false, false);
|
||||
pClient->setClientCallbacks(new BluetoothClientCallbacks(sensorId), true);
|
||||
if (pClient == nullptr) {
|
||||
if (NimBLEDevice::getCreatedClientCount() >= NIMBLE_MAX_CONNECTIONS) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
this->bleClients[sensorId] = pClient;
|
||||
pClient = NimBLEDevice::createClient();
|
||||
if (pClient == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set initial connection parameters:
|
||||
* These settings are safe for 3 clients to connect reliably, can go faster if you have less
|
||||
* 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);
|
||||
}
|
||||
|
||||
if (!pClient->isConnected()) {
|
||||
pClient->setPeerAddress(address);
|
||||
}
|
||||
|
||||
return pClient;
|
||||
}
|
||||
|
||||
bool subscribeToBleDevice(const uint8_t sensorId, NimBLEClient* pClient) {
|
||||
auto& sSensor = Sensors::settings[sensorId];
|
||||
auto pAddress = pClient->getPeerAddress().toString();
|
||||
auto pAddress = pClient->getPeerAddress().toString().c_str();
|
||||
|
||||
NimBLERemoteService* pService = nullptr;
|
||||
NimBLERemoteCharacteristic* pChar = nullptr;
|
||||
@@ -606,13 +588,13 @@ protected:
|
||||
if (!pService) {
|
||||
Log.straceln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to find env service (%s) on device %s"),
|
||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
|
||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress
|
||||
);
|
||||
|
||||
} else {
|
||||
Log.straceln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found env service (%s) on device %s"),
|
||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
|
||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress
|
||||
);
|
||||
|
||||
// 0x2A6E - Notify temperature x0.01C (pvvx)
|
||||
@@ -624,7 +606,7 @@ protected:
|
||||
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
||||
Log.straceln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found temp char (%s) in env service on device %s"),
|
||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
|
||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress
|
||||
);
|
||||
|
||||
pChar->unsubscribe();
|
||||
@@ -679,14 +661,14 @@ protected:
|
||||
Log.straceln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to temp char (%s) in env service on device %s"),
|
||||
sensorId, sSensor.name,
|
||||
charUuid.toString().c_str(), pAddress.c_str()
|
||||
charUuid.toString().c_str(), pAddress
|
||||
);
|
||||
|
||||
} else {
|
||||
Log.swarningln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to temp char (%s) in env service on device %s"),
|
||||
sensorId, sSensor.name,
|
||||
charUuid.toString().c_str(), pAddress.c_str()
|
||||
charUuid.toString().c_str(), pAddress
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -701,7 +683,7 @@ protected:
|
||||
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
||||
Log.straceln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found temp char (%s) in env service on device %s"),
|
||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
|
||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress
|
||||
);
|
||||
|
||||
pChar->unsubscribe();
|
||||
@@ -756,14 +738,14 @@ protected:
|
||||
Log.straceln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to temp char (%s) in env service on device %s"),
|
||||
sensorId, sSensor.name,
|
||||
charUuid.toString().c_str(), pAddress.c_str()
|
||||
charUuid.toString().c_str(), pAddress
|
||||
);
|
||||
|
||||
} else {
|
||||
Log.swarningln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to temp char (%s) in env service on device %s"),
|
||||
sensorId, sSensor.name,
|
||||
charUuid.toString().c_str(), pAddress.c_str()
|
||||
charUuid.toString().c_str(), pAddress
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -772,7 +754,7 @@ protected:
|
||||
if (!tempNotifyCreated) {
|
||||
Log.swarningln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported temp chars in env service on device %s"),
|
||||
sensorId, sSensor.name, pAddress.c_str()
|
||||
sensorId, sSensor.name, pAddress
|
||||
);
|
||||
|
||||
pClient->disconnect();
|
||||
@@ -790,7 +772,7 @@ protected:
|
||||
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
||||
Log.straceln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found humidity char (%s) in env service on device %s"),
|
||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
|
||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress
|
||||
);
|
||||
|
||||
pChar->unsubscribe();
|
||||
@@ -845,14 +827,14 @@ protected:
|
||||
Log.straceln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to humidity char (%s) in env service on device %s"),
|
||||
sensorId, sSensor.name,
|
||||
charUuid.toString().c_str(), pAddress.c_str()
|
||||
charUuid.toString().c_str(), pAddress
|
||||
);
|
||||
|
||||
} else {
|
||||
Log.swarningln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to humidity char (%s) in env service on device %s"),
|
||||
sensorId, sSensor.name,
|
||||
charUuid.toString().c_str(), pAddress.c_str()
|
||||
charUuid.toString().c_str(), pAddress
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -861,7 +843,7 @@ protected:
|
||||
if (!humidityNotifyCreated) {
|
||||
Log.swarningln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported humidity chars in env service on device %s"),
|
||||
sensorId, sSensor.name, pAddress.c_str()
|
||||
sensorId, sSensor.name, pAddress
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -875,13 +857,13 @@ protected:
|
||||
if (!pService) {
|
||||
Log.straceln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to find battery service (%s) on device %s"),
|
||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
|
||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress
|
||||
);
|
||||
|
||||
} else {
|
||||
Log.straceln(
|
||||
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)
|
||||
@@ -893,7 +875,7 @@ protected:
|
||||
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
||||
Log.straceln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found battery char (%s) in battery service on device %s"),
|
||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
|
||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress
|
||||
);
|
||||
|
||||
pChar->unsubscribe();
|
||||
@@ -948,14 +930,14 @@ protected:
|
||||
Log.straceln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to battery char (%s) in battery service on device %s"),
|
||||
sensorId, sSensor.name,
|
||||
charUuid.toString().c_str(), pAddress.c_str()
|
||||
charUuid.toString().c_str(), pAddress
|
||||
);
|
||||
|
||||
} else {
|
||||
Log.swarningln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to battery char (%s) in battery service on device %s"),
|
||||
sensorId, sSensor.name,
|
||||
charUuid.toString().c_str(), pAddress.c_str()
|
||||
charUuid.toString().c_str(), pAddress
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -964,7 +946,7 @@ protected:
|
||||
if (!batteryNotifyCreated) {
|
||||
Log.swarningln(
|
||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported battery chars in battery service on device %s"),
|
||||
sensorId, sSensor.name, pAddress.c_str()
|
||||
sensorId, sSensor.name, pAddress
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1005,16 +987,12 @@ protected:
|
||||
} else if (rSensor.connected && sSensor.purpose == Sensors::Purpose::NOT_CONFIGURED) {
|
||||
Sensors::setConnectionStatusById(sensorId, false, false);
|
||||
|
||||
} else if (rSensor.connected) {
|
||||
if (sSensor.type == Sensors::Type::MANUAL || sSensor.type == Sensors::Type::BLUETOOTH) {
|
||||
if ((millis() - rSensor.activityTime) > this->wirelessDisconnectTimeout) {
|
||||
Sensors::setConnectionStatusById(sensorId, false, false);
|
||||
}
|
||||
} else if (sSensor.type != Sensors::Type::MANUAL && rSensor.connected && (millis() - rSensor.activityTime) > this->disconnectedTimeout) {
|
||||
Sensors::setConnectionStatusById(sensorId, false, false);
|
||||
|
||||
} else if ((millis() - rSensor.activityTime) > this->wiredDisconnectTimeout) {
|
||||
Sensors::setConnectionStatusById(sensorId, false, false);
|
||||
}
|
||||
}
|
||||
}/* else if (!rSensor.connected) {
|
||||
rSensor.connected = true;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+21
-53
@@ -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 {
|
||||
char hostname[25] = DEFAULT_HOSTNAME;
|
||||
bool useDhcp = true;
|
||||
@@ -14,30 +12,14 @@ struct NetworkSettings {
|
||||
struct {
|
||||
char ssid[33] = DEFAULT_AP_SSID;
|
||||
char password[65] = DEFAULT_AP_PASSWORD;
|
||||
uint8_t channel = 6;
|
||||
byte channel = 6;
|
||||
} ap;
|
||||
|
||||
struct {
|
||||
char ssid[33] = DEFAULT_STA_SSID;
|
||||
char password[65] = DEFAULT_STA_PASSWORD;
|
||||
uint8_t channel = 0;
|
||||
byte channel = 0;
|
||||
} 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;
|
||||
|
||||
struct Settings {
|
||||
@@ -60,7 +42,7 @@ struct Settings {
|
||||
} ntp;
|
||||
|
||||
UnitSystem unitSystem = UnitSystem::METRIC;
|
||||
uint8_t statusLedGpio = DEFAULT_STATUS_LED_GPIO;
|
||||
byte statusLedGpio = DEFAULT_STATUS_LED_GPIO;
|
||||
} system;
|
||||
|
||||
struct {
|
||||
@@ -72,9 +54,9 @@ struct Settings {
|
||||
|
||||
struct {
|
||||
UnitSystem unitSystem = UnitSystem::METRIC;
|
||||
uint8_t inGpio = DEFAULT_OT_IN_GPIO;
|
||||
uint8_t outGpio = DEFAULT_OT_OUT_GPIO;
|
||||
uint8_t rxLedGpio = DEFAULT_OT_RX_LED_GPIO;
|
||||
byte inGpio = DEFAULT_OT_IN_GPIO;
|
||||
byte outGpio = DEFAULT_OT_OUT_GPIO;
|
||||
byte rxLedGpio = DEFAULT_OT_RX_LED_GPIO;
|
||||
uint8_t memberId = 0;
|
||||
uint8_t flags = 0;
|
||||
float minPower = 0.0f;
|
||||
@@ -96,8 +78,7 @@ struct Settings {
|
||||
bool autoFaultReset = false;
|
||||
bool autoDiagReset = false;
|
||||
bool setDateAndTime = false;
|
||||
bool alwaysSendIndoorTemp = true;
|
||||
bool nativeOTC = false;
|
||||
bool nativeHeatingControl = false;
|
||||
bool immergasFix = false;
|
||||
} options;
|
||||
} opentherm;
|
||||
@@ -122,35 +103,30 @@ struct Settings {
|
||||
bool enabled = true;
|
||||
bool turbo = false;
|
||||
float target = DEFAULT_HEATING_TARGET_TEMP;
|
||||
float hysteresis = 0.5f;
|
||||
float turboFactor = 7.5f;
|
||||
uint8_t minTemp = DEFAULT_HEATING_MIN_TEMP;
|
||||
uint8_t maxTemp = DEFAULT_HEATING_MAX_TEMP;
|
||||
byte minTemp = DEFAULT_HEATING_MIN_TEMP;
|
||||
byte maxTemp = DEFAULT_HEATING_MAX_TEMP;
|
||||
uint8_t maxModulation = 100;
|
||||
|
||||
struct {
|
||||
bool enabled = true;
|
||||
float value = 0.5f;
|
||||
HysteresisAction action = HysteresisAction::DISABLE_HEATING;
|
||||
} hysteresis;
|
||||
|
||||
struct {
|
||||
uint8_t highTemp = 95;
|
||||
uint8_t lowTemp = 90;
|
||||
} overheatProtection;
|
||||
|
||||
struct {
|
||||
uint8_t highTemp = 15;
|
||||
uint8_t lowTemp = 10;
|
||||
unsigned short thresholdTime = 600;
|
||||
} freezeProtection;
|
||||
} heating;
|
||||
|
||||
struct {
|
||||
bool enabled = true;
|
||||
float target = DEFAULT_DHW_TARGET_TEMP;
|
||||
uint8_t minTemp = DEFAULT_DHW_MIN_TEMP;
|
||||
uint8_t maxTemp = DEFAULT_DHW_MAX_TEMP;
|
||||
byte minTemp = DEFAULT_DHW_MIN_TEMP;
|
||||
byte maxTemp = DEFAULT_DHW_MAX_TEMP;
|
||||
uint8_t maxModulation = 100;
|
||||
|
||||
|
||||
struct {
|
||||
uint8_t highTemp = 95;
|
||||
uint8_t lowTemp = 90;
|
||||
@@ -186,8 +162,7 @@ struct Settings {
|
||||
|
||||
struct {
|
||||
bool use = false;
|
||||
uint8_t gpio = DEFAULT_EXT_PUMP_GPIO;
|
||||
bool invertState = false;
|
||||
byte gpio = DEFAULT_EXT_PUMP_GPIO;
|
||||
unsigned short postCirculationTime = 600;
|
||||
unsigned int antiStuckInterval = 2592000;
|
||||
unsigned short antiStuckTime = 300;
|
||||
@@ -196,15 +171,15 @@ struct Settings {
|
||||
struct {
|
||||
struct {
|
||||
bool enabled = false;
|
||||
uint8_t gpio = GPIO_IS_NOT_CONFIGURED;
|
||||
bool invertState = false;
|
||||
byte gpio = GPIO_IS_NOT_CONFIGURED;
|
||||
byte invertState = false;
|
||||
unsigned short thresholdTime = 60;
|
||||
} input;
|
||||
|
||||
struct {
|
||||
bool enabled = false;
|
||||
uint8_t gpio = GPIO_IS_NOT_CONFIGURED;
|
||||
bool invertState = false;
|
||||
byte gpio = GPIO_IS_NOT_CONFIGURED;
|
||||
byte invertState = false;
|
||||
unsigned short thresholdTime = 60;
|
||||
bool onFault = true;
|
||||
bool onLossConnection = true;
|
||||
@@ -290,7 +265,6 @@ struct Variables {
|
||||
struct {
|
||||
bool connected = false;
|
||||
int8_t rssi = 0;
|
||||
NetworkUtils::NetworkMgr::Uplink connectionType = NetworkUtils::NetworkMgr::Uplink::None;
|
||||
} network;
|
||||
|
||||
struct {
|
||||
@@ -323,7 +297,6 @@ struct Variables {
|
||||
bool enabled = false;
|
||||
bool indoorTempControl = false;
|
||||
bool overheat = false;
|
||||
bool freezing = false;
|
||||
float setpointTemp = 0.0f;
|
||||
float targetTemp = 0.0f;
|
||||
float currentTemp = 0.0f;
|
||||
@@ -357,14 +330,10 @@ struct Variables {
|
||||
|
||||
bool connected = false;
|
||||
bool flame = false;
|
||||
bool cooling = false;
|
||||
float pressure = 0.0f;
|
||||
float heatExchangerTemp = 0.0f;
|
||||
|
||||
struct {
|
||||
bool active = false;
|
||||
uint8_t setpoint = 0;
|
||||
} cooling;
|
||||
|
||||
struct {
|
||||
bool active = false;
|
||||
uint8_t code = 0;
|
||||
@@ -409,7 +378,6 @@ struct Variables {
|
||||
uint16_t dhwBurnerStarts = 0;
|
||||
uint16_t heatingPumpStarts = 0;
|
||||
uint16_t dhwPumpStarts = 0;
|
||||
uint16_t coolingHours = 0;
|
||||
uint16_t burnerHours = 0;
|
||||
uint16_t dhwBurnerHours = 0;
|
||||
uint16_t heatingPumpHours = 0;
|
||||
@@ -459,4 +427,4 @@ struct Variables {
|
||||
bool restarting = false;
|
||||
bool upgrading = false;
|
||||
} states;
|
||||
} vars;
|
||||
} vars;
|
||||
+2
-45
@@ -54,11 +54,6 @@
|
||||
#define USE_BLE false
|
||||
#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
|
||||
#define DEFAULT_HOSTNAME ""
|
||||
#endif
|
||||
@@ -87,34 +82,6 @@
|
||||
#define DEFAULT_STATUS_LED_GPIO GPIO_IS_NOT_CONFIGURED
|
||||
#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
|
||||
#define DEFAULT_PORTAL_LOGIN ""
|
||||
#endif
|
||||
@@ -180,7 +147,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef PROGMEM
|
||||
#define PROGMEM
|
||||
#define PROGMEM
|
||||
#endif
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
@@ -196,14 +163,4 @@ enum class UnitSystem : uint8_t {
|
||||
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];
|
||||
+1
-16
@@ -74,7 +74,7 @@ void setup() {
|
||||
|
||||
return tm{sec, min, hour};
|
||||
});
|
||||
|
||||
|
||||
Serial.begin(115200);
|
||||
#if ARDUINO_USB_MODE
|
||||
Serial.setTxBufferSize(512);
|
||||
@@ -84,9 +84,6 @@ void setup() {
|
||||
|
||||
//
|
||||
// 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()) {
|
||||
case FD_FS_ERR:
|
||||
Log.swarningln(FPSTR(L_NETWORK_SETTINGS), F("Filesystem error, load default"));
|
||||
@@ -157,18 +154,6 @@ void setup() {
|
||||
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
|
||||
if (!strlen(settings.mqtt.prefix)) {
|
||||
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 S_ACTION[] PROGMEM = "action";
|
||||
const char S_ACTIONS[] PROGMEM = "actions";
|
||||
const char S_ACTIVE[] PROGMEM = "active";
|
||||
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_BATTERY[] PROGMEM = "battery";
|
||||
const char S_BAUDRATE[] PROGMEM = "baudrate";
|
||||
const char S_BLE[] PROGMEM = "ble";
|
||||
const char S_BLOCKING[] PROGMEM = "blocking";
|
||||
const char S_BSSID[] PROGMEM = "bssid";
|
||||
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_CH2_ALWAYS_ENABLED[] PROGMEM = "ch2AlwaysEnabled";
|
||||
const char S_CHIP[] PROGMEM = "chip";
|
||||
const char S_CLK[] PROGMEM = "clk";
|
||||
const char S_CODE[] PROGMEM = "code";
|
||||
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_COOLING[] PROGMEM = "cooling";
|
||||
const char S_COOLING_SUPPORT[] PROGMEM = "coolingSupport";
|
||||
const char S_CORE[] PROGMEM = "core";
|
||||
const char S_CORES[] PROGMEM = "cores";
|
||||
const char S_CRASH[] PROGMEM = "crash";
|
||||
const char S_CS[] PROGMEM = "cs";
|
||||
const char S_CURRENT_TEMP[] PROGMEM = "currentTemp";
|
||||
const char S_DATA[] PROGMEM = "data";
|
||||
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_EPC[] PROGMEM = "epc";
|
||||
const char S_EQUITHERM[] PROGMEM = "equitherm";
|
||||
const char S_ETHERNET[] PROGMEM = "ethernet";
|
||||
const char S_EXPONENT[] PROGMEM = "exponent";
|
||||
const char S_EXTERNAL_PUMP[] PROGMEM = "externalPump";
|
||||
const char S_FACTOR[] PROGMEM = "factor";
|
||||
const char S_FAULT[] PROGMEM = "fault";
|
||||
const char S_FEATURES[] PROGMEM = "features";
|
||||
const char S_FREEZE_PROTECTION[] PROGMEM = "freezeProtection";
|
||||
const char S_FREEZING[] PROGMEM = "freezing";
|
||||
const char S_FILTERING[] PROGMEM = "filtering";
|
||||
const char S_FILTERING_FACTOR[] PROGMEM = "filteringFactor";
|
||||
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_IGNORE_DIAG_STATE[] PROGMEM = "ignoreDiagState";
|
||||
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_CONTROL[] PROGMEM = "indoorTempControl";
|
||||
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_INVERT_STATE[] PROGMEM = "invertState";
|
||||
const char S_IP[] PROGMEM = "ip";
|
||||
const char S_IRQ[] PROGMEM = "irq";
|
||||
const char S_I_FACTOR[] PROGMEM = "i_factor";
|
||||
const char S_I_MULTIPLIER[] PROGMEM = "i_multiplier";
|
||||
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_POWER[] PROGMEM = "minPower";
|
||||
const char S_MIN_TEMP[] PROGMEM = "minTemp";
|
||||
const char S_MISO[] PROGMEM = "miso";
|
||||
const char S_MODEL[] PROGMEM = "model";
|
||||
const char S_MOSI[] PROGMEM = "mosi";
|
||||
const char S_MODULATION[] PROGMEM = "modulation";
|
||||
const char S_MQTT[] PROGMEM = "mqtt";
|
||||
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_NTP[] PROGMEM = "ntp";
|
||||
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_PID[] PROGMEM = "pid";
|
||||
const char S_PORT[] PROGMEM = "port";
|
||||
const char S_PINS[] PROGMEM = "pins";
|
||||
const char S_PORTAL[] PROGMEM = "portal";
|
||||
const char S_POST_CIRCULATION_TIME[] PROGMEM = "postCirculationTime";
|
||||
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_REV[] PROGMEM = "rev";
|
||||
const char S_RSSI[] PROGMEM = "rssi";
|
||||
const char S_RST[] PROGMEM = "rst";
|
||||
const char S_RX_LED_GPIO[] PROGMEM = "rxLedGpio";
|
||||
const char S_SDK[] PROGMEM = "sdk";
|
||||
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_SLOPE[] PROGMEM = "slope";
|
||||
const char S_SSID[] PROGMEM = "ssid";
|
||||
const char S_STARTED[] PROGMEM = "started";
|
||||
const char S_STA[] PROGMEM = "sta";
|
||||
const char S_STATE[] PROGMEM = "state";
|
||||
const char S_STATIC_CONFIG[] PROGMEM = "staticConfig";
|
||||
const char S_STATUS_LED_GPIO[] PROGMEM = "statusLedGpio";
|
||||
const char S_SETPOINT[] PROGMEM = "setpoint";
|
||||
const char S_SETPOINT_TEMP[] PROGMEM = "setpointTemp";
|
||||
const char S_SUBNET[] PROGMEM = "subnet";
|
||||
const char S_SUMMER_WINTER_MODE[] PROGMEM = "summerWinterMode";
|
||||
|
||||
+45
-192
@@ -72,7 +72,7 @@ time_t mkgmtime(const struct tm *ptm) {
|
||||
|
||||
inline bool isDigit(const char* ptr) {
|
||||
char* endPtr;
|
||||
auto tmp = strtol(ptr, &endPtr, 10);
|
||||
strtol(ptr, &endPtr, 10);
|
||||
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_PASSWORD)] = src.sta.password;
|
||||
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 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;
|
||||
}
|
||||
|
||||
@@ -497,10 +468,8 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
|
||||
otOptions[FPSTR(S_AUTO_FAULT_RESET)] = src.opentherm.options.autoFaultReset;
|
||||
otOptions[FPSTR(S_AUTO_DIAG_RESET)] = src.opentherm.options.autoDiagReset;
|
||||
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_OTC)] = src.opentherm.options.nativeOTC;
|
||||
otOptions[FPSTR(S_NATIVE_HEATING_CONTROL)] = src.opentherm.options.nativeHeatingControl;
|
||||
otOptions[FPSTR(S_IMMERGAS_FIX)] = src.opentherm.options.immergasFix;
|
||||
|
||||
|
||||
auto mqtt = dst[FPSTR(S_MQTT)].to<JsonObject>();
|
||||
mqtt[FPSTR(S_ENABLED)] = src.mqtt.enabled;
|
||||
@@ -521,9 +490,7 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
|
||||
heating[FPSTR(S_ENABLED)] = src.heating.enabled;
|
||||
heating[FPSTR(S_TURBO)] = src.heating.turbo;
|
||||
heating[FPSTR(S_TARGET)] = roundf(src.heating.target, 2);
|
||||
heating[FPSTR(S_HYSTERESIS)][FPSTR(S_ENABLED)] = src.heating.hysteresis.enabled;
|
||||
heating[FPSTR(S_HYSTERESIS)][FPSTR(S_VALUE)] = roundf(src.heating.hysteresis.value, 3);
|
||||
heating[FPSTR(S_HYSTERESIS)][FPSTR(S_ACTION)] = static_cast<uint8_t>(src.heating.hysteresis.action);
|
||||
heating[FPSTR(S_HYSTERESIS)] = roundf(src.heating.hysteresis, 3);
|
||||
heating[FPSTR(S_TURBO_FACTOR)] = roundf(src.heating.turboFactor, 3);
|
||||
heating[FPSTR(S_MIN_TEMP)] = src.heating.minTemp;
|
||||
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;
|
||||
|
||||
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_THRESHOLD_TIME)] = src.heating.freezeProtection.thresholdTime;
|
||||
|
||||
auto dhw = dst[FPSTR(S_DHW)].to<JsonObject>();
|
||||
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>();
|
||||
externalPump[FPSTR(S_USE)] = src.externalPump.use;
|
||||
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_ANTI_STUCK_INTERVAL)] = roundf(src.externalPump.antiStuckInterval / 86400, 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 changed = false;
|
||||
|
||||
@@ -775,6 +692,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// portal
|
||||
if (src[FPSTR(S_PORTAL)][FPSTR(S_AUTH)].is<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>()) {
|
||||
bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_ALWAYS_SEND_INDOOR_TEMP)].as<bool>();
|
||||
if (src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_NATIVE_HEATING_CONTROL)].is<bool>()) {
|
||||
bool value = src[FPSTR(S_OPENTHERM)][FPSTR(S_OPTIONS)][FPSTR(S_NATIVE_HEATING_CONTROL)].as<bool>();
|
||||
|
||||
if (value != dst.opentherm.options.alwaysSendIndoorTemp) {
|
||||
dst.opentherm.options.alwaysSendIndoorTemp = 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 != dst.opentherm.options.nativeHeatingControl) {
|
||||
dst.opentherm.options.nativeHeatingControl = value;
|
||||
|
||||
if (value) {
|
||||
dst.equitherm.enabled = false;
|
||||
@@ -1115,6 +1024,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// mqtt
|
||||
if (src[FPSTR(S_MQTT)][FPSTR(S_ENABLED)].is<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>()) {
|
||||
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) {
|
||||
dst.equitherm.enabled = value;
|
||||
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>()) {
|
||||
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) {
|
||||
dst.pid.enabled = value;
|
||||
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>()) {
|
||||
bool value = src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_ENABLED)].as<bool>();
|
||||
if (!src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)].isNull()) {
|
||||
float value = src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)].as<float>();
|
||||
|
||||
if (value != dst.heating.hysteresis.enabled) {
|
||||
dst.heating.hysteresis.enabled = value;
|
||||
if (value >= 0.0f && value <= 15.0f && fabsf(value - dst.heating.hysteresis) > 0.0001f) {
|
||||
dst.heating.hysteresis = roundf(value, 2);
|
||||
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()) {
|
||||
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()) {
|
||||
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;
|
||||
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()) {
|
||||
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;
|
||||
changed = true;
|
||||
}
|
||||
@@ -1503,15 +1387,6 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
||||
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()) {
|
||||
unsigned short value = src[FPSTR(S_HEATING)][FPSTR(S_FREEZE_PROTECTION)][FPSTR(S_LOW_TEMP)].as<uint8_t>();
|
||||
|
||||
@@ -1521,9 +1396,15 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
||||
}
|
||||
}
|
||||
|
||||
if (dst.heating.freezeProtection.highTemp < dst.heating.freezeProtection.lowTemp) {
|
||||
dst.heating.freezeProtection.highTemp = dst.heating.freezeProtection.lowTemp;
|
||||
changed = true;
|
||||
if (!src[FPSTR(S_HEATING)][FPSTR(S_FREEZE_PROTECTION)][FPSTR(S_THRESHOLD_TIME)].isNull()) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()) {
|
||||
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
|
||||
{
|
||||
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(
|
||||
value,
|
||||
dst.system.unitSystem,
|
||||
@@ -1819,7 +1691,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
||||
|
||||
// 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 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_HEATING_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::DALLAS_TEMP):
|
||||
@@ -2033,7 +1904,7 @@ bool jsonToSensorSettings(const uint8_t sensorId, const JsonVariantConst src, Se
|
||||
|
||||
// gpio
|
||||
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) {
|
||||
dst.gpio = GPIO_IS_NOT_CONFIGURED;
|
||||
changed = true;
|
||||
@@ -2069,20 +1940,12 @@ bool jsonToSensorSettings(const uint8_t sensorId, const JsonVariantConst src, Se
|
||||
);
|
||||
|
||||
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]) {
|
||||
dst.address[i] = tmp[i];
|
||||
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) {
|
||||
@@ -2095,20 +1958,12 @@ bool jsonToSensorSettings(const uint8_t sensorId, const JsonVariantConst src, Se
|
||||
);
|
||||
|
||||
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]) {
|
||||
dst.address[i] = tmp[i];
|
||||
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;
|
||||
}
|
||||
|
||||
auto& dst = Sensors::results[sensorId];
|
||||
bool changed = false;
|
||||
|
||||
// value
|
||||
if (!src[FPSTR(S_VALUE)].isNull()) {
|
||||
return Sensors::setValueById(
|
||||
sensorId,
|
||||
src[FPSTR(S_VALUE)].as<float>(),
|
||||
Sensors::ValueType::PRIMARY,
|
||||
true,
|
||||
true
|
||||
);
|
||||
float value = src[FPSTR(S_VALUE)].as<float>();
|
||||
|
||||
uint8_t vType = static_cast<uint8_t>(Sensors::ValueType::PRIMARY);
|
||||
if (fabsf(value - dst.values[vType]) > 0.0001f) {
|
||||
dst.values[vType] = roundf(value, 2);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return changed;
|
||||
}
|
||||
|
||||
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_TYPE)] = src.slave.type;
|
||||
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_FLAME)] = src.slave.flame;
|
||||
|
||||
auto sCooling = slave[FPSTR(S_COOLING)].to<JsonObject>();
|
||||
sCooling[FPSTR(S_ACTIVE)] = src.slave.cooling.active;
|
||||
sCooling[FPSTR(S_SETPOINT)] = src.slave.cooling.setpoint;
|
||||
slave[FPSTR(S_COOLING)] = src.slave.cooling;
|
||||
|
||||
auto sModulation = slave[FPSTR(S_MODULATION)].to<JsonObject>();
|
||||
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_INDOOR_TEMP_CONTROL)] = src.master.heating.indoorTempControl;
|
||||
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_TARGET_TEMP)] = roundf(src.master.heating.targetTemp, 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_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_EMERGENCY)][FPSTR(S_STATE)] = src.emergency.state;
|
||||
master[FPSTR(S_EXTERNAL_PUMP)][FPSTR(S_STATE)] = src.externalPump.state;
|
||||
|
||||
+16
-71
@@ -109,8 +109,7 @@
|
||||
|
||||
"sConnected": "OpenTherm 通讯状态",
|
||||
"sFlame": "火焰",
|
||||
"sCoolingActive": "制冷",
|
||||
"sCoolingSetpoint": "冷却设定点",
|
||||
"sCooling": "制冷",
|
||||
"sFaultActive": "报警状态",
|
||||
"sFaultCode": "报警代码",
|
||||
"sDiagActive": "诊断状态",
|
||||
@@ -151,7 +150,6 @@
|
||||
|
||||
"section": {
|
||||
"static": "静态设置",
|
||||
"ethernet": "以太网",
|
||||
"availableNetworks": "可用网络",
|
||||
"staSettings": "WiFi 设置",
|
||||
"apSettings": "AP 设置"
|
||||
@@ -159,20 +157,7 @@
|
||||
|
||||
"scan": {
|
||||
"pos": "#",
|
||||
"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 接线"
|
||||
"info": "Info"
|
||||
},
|
||||
|
||||
"wifi": {
|
||||
@@ -190,14 +175,7 @@
|
||||
"ip": "IP",
|
||||
"subnet": "子网掩码",
|
||||
"gateway": "网关",
|
||||
"dns": "DNS 服务器",
|
||||
"connection": "连接",
|
||||
"connectionType": {
|
||||
"ethernet": "以太网",
|
||||
"wifi": "WiFi",
|
||||
"wifi-ap": "WiFi 接入点",
|
||||
"none": "无"
|
||||
}
|
||||
"dns": "DNS 服务器"
|
||||
},
|
||||
|
||||
"sta": {
|
||||
@@ -264,7 +242,6 @@
|
||||
"otDhwBurnerHours": "OpenTherm, number of burner operating hours (DHW)",
|
||||
"otHeatingPumpHours": "OpenTherm, number of pump operating hours (heating)",
|
||||
"otDhwPumpHours": "OpenTherm, number of pump operating hours (DHW)",
|
||||
"otCoolingHours": "OpenTherm, number of cooling hours",
|
||||
|
||||
"ntcTemp": "NTC 传感器",
|
||||
"dallasTemp": "DALLAS 传感器",
|
||||
@@ -341,15 +318,9 @@
|
||||
},
|
||||
"freezeProtection": {
|
||||
"title": "防冻保护",
|
||||
"desc": "如果热载体或室内温度低于 <b>低温</b>,加热将被强制开启。",
|
||||
"highTemp": {
|
||||
"title": "高温阈值",
|
||||
"note": "防冻保护激活后系统恢复正常模式的阈值"
|
||||
},
|
||||
"lowTemp": {
|
||||
"title": "低温阈值",
|
||||
"note": "强制开启加热的阈值"
|
||||
}
|
||||
"desc": "当热媒或室内温度在<b>等待时间</b> 内降至<b>低温阈值</b>以下时,系统将强制启动加热功能。",
|
||||
"lowTemp": "低温阈值",
|
||||
"thresholdTime": "等待时间<small>(秒)</small>"
|
||||
},
|
||||
|
||||
"portal": {
|
||||
@@ -384,16 +355,7 @@
|
||||
},
|
||||
|
||||
"heating": {
|
||||
"hyst": {
|
||||
"title": "滞回",
|
||||
"desc": "滞回有助于维持设定的室内温度(在使用«Equitherm»和/或«PID»时)。强制禁用加热当<code>current indoor > target + value</code>,启用加热当<code>current indoor < (target - value)</code>。",
|
||||
"value": "值 <small>(以度为单位)</small>",
|
||||
"action": {
|
||||
"title": "行动",
|
||||
"disableHeating": "禁用加热",
|
||||
"set0target": "设置空目标"
|
||||
}
|
||||
},
|
||||
"hyst": "滞后值<small>(单位:度)</small>",
|
||||
"turboFactor": "Turbo 模式系数"
|
||||
},
|
||||
|
||||
@@ -408,26 +370,11 @@
|
||||
},
|
||||
|
||||
"equitherm": {
|
||||
"slope": {
|
||||
"title": "斜率",
|
||||
"note": "热损失补偿。主要调谐参数。"
|
||||
},
|
||||
"exponent": {
|
||||
"title": "指数",
|
||||
"note": "散热器效率。典型值:<code>1.1</code> - 地板采暖,<code>1.2</code> - 铸铁,<code>1.3</code> - 面板散热器,<code>1.4</code> - 对流器。"
|
||||
},
|
||||
"shift": {
|
||||
"title": "偏移",
|
||||
"note": "补偿额外热损失(例如,在管道中)或额外热源。"
|
||||
},
|
||||
"targetDiffFactor": {
|
||||
"title": "T 因子",
|
||||
"note": "如果启用 PID,则不使用。将目标和当前室内温度之间的差值添加到设定点:<code>setpoint = setpoint + ((target - indoor) * T)</code>。"
|
||||
},
|
||||
"chart": {
|
||||
"targetTemp": "目标室内温度",
|
||||
"setpointTemp": "热载体温度",
|
||||
"outdoorTemp": "室外温度"
|
||||
"n": "N 系数",
|
||||
"k": "K 系数",
|
||||
"t": {
|
||||
"title": "T 系数",
|
||||
"note": "启用PID时此参数无效"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -485,13 +432,12 @@
|
||||
"autoFaultReset": "自动报警复位 <small>(不推荐!)</small>",
|
||||
"autoDiagReset": "自动诊断复位 <small>(不推荐!)</small>",
|
||||
"setDateAndTime": "同步设置锅炉日期与时间",
|
||||
"immergasFix": "针对Immergas锅炉的兼容性修复",
|
||||
"alwaysSendIndoorTemp": "向锅炉发送当前室内温度"
|
||||
"immergasFix": "针对Immergas锅炉的兼容性修复"
|
||||
},
|
||||
|
||||
"nativeOTC": {
|
||||
"title": "原生热载体温度计算模式",
|
||||
"note": "仅在锅炉处于 OTC 模式时<u>才</u>工作:需要并接受目标室内温度,并基于内置曲线模式自行调节热载体温度。与 PID 和 Equitherm 不兼容。"
|
||||
"nativeHeating": {
|
||||
"title": "原生锅炉供暖控制",
|
||||
"note": "<u>注意:</u> 仅适用于锅炉需接收目标室温并自主调节载热介质温度的场景,与固件中的PID及Equithermq气候补偿功能不兼容。"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -508,7 +454,6 @@
|
||||
"extPump": {
|
||||
"use": "使用外置循环泵",
|
||||
"gpio": "继电器 GPIO引脚",
|
||||
"invertState": "切换 GPIO 状态",
|
||||
"postCirculationTime": "后循环时间 <small>(分钟)</small>",
|
||||
"antiStuckInterval": "防卡死间隔时间<small>(天)</small>",
|
||||
"antiStuckTime": "防卡死运行时长<small>(分钟)</small>"
|
||||
|
||||
+13
-54
@@ -109,8 +109,7 @@
|
||||
|
||||
"sConnected": "OpenTherm connection",
|
||||
"sFlame": "Flame",
|
||||
"sCoolingActive": "Cooling",
|
||||
"sCoolingSetpoint": "Cooling setpoint",
|
||||
"sCooling": "Cooling",
|
||||
"sFaultActive": "Fault",
|
||||
"sFaultCode": "Fault code",
|
||||
"sDiagActive": "Diagnostic",
|
||||
@@ -119,7 +118,6 @@
|
||||
"mHeatEnabled": "Heating enabled",
|
||||
"mHeatBlocking": "Heating blocked",
|
||||
"mHeatOverheat": "Heating overheat",
|
||||
"mHeatFreezing": "Heating freezing",
|
||||
"sHeatActive": "Heating active",
|
||||
"mHeatSetpointTemp": "Heating setpoint temp",
|
||||
"mHeatTargetTemp": "Heating target temp",
|
||||
@@ -152,7 +150,6 @@
|
||||
|
||||
"section": {
|
||||
"static": "Static settings",
|
||||
"ethernet": "Ethernet",
|
||||
"availableNetworks": "Available networks",
|
||||
"staSettings": "WiFi settings",
|
||||
"apSettings": "AP settings"
|
||||
@@ -160,20 +157,7 @@
|
||||
|
||||
"scan": {
|
||||
"pos": "#",
|
||||
"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"
|
||||
"info": "Info"
|
||||
},
|
||||
|
||||
"wifi": {
|
||||
@@ -191,14 +175,7 @@
|
||||
"ip": "IP",
|
||||
"subnet": "Subnet",
|
||||
"gateway": "Gateway",
|
||||
"dns": "DNS",
|
||||
"connection": "Connection",
|
||||
"connectionType": {
|
||||
"ethernet": "Ethernet",
|
||||
"wifi": "WiFi",
|
||||
"wifi-ap": "WiFi AP",
|
||||
"none": "None"
|
||||
}
|
||||
"dns": "DNS"
|
||||
},
|
||||
|
||||
"sta": {
|
||||
@@ -265,7 +242,6 @@
|
||||
"otDhwBurnerHours": "OpenTherm, number of burner operating hours (DHW)",
|
||||
"otHeatingPumpHours": "OpenTherm, number of pump operating hours (heating)",
|
||||
"otDhwPumpHours": "OpenTherm, number of pump operating hours (DHW)",
|
||||
"otCoolingHours": "OpenTherm, number of cooling hours",
|
||||
|
||||
"ntcTemp": "NTC sensor",
|
||||
"dallasTemp": "DALLAS sensor",
|
||||
@@ -342,15 +318,9 @@
|
||||
},
|
||||
"freezeProtection": {
|
||||
"title": "Freeze protection",
|
||||
"desc": "Heating will be forced to turn on if the heat carrier or indoor temperature drops below <b>Low temperature</b>.",
|
||||
"highTemp": {
|
||||
"title": "High temperature threshold",
|
||||
"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"
|
||||
}
|
||||
"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>.",
|
||||
"lowTemp": "Low temperature threshold",
|
||||
"thresholdTime": "Waiting time <small>(sec)</small>"
|
||||
},
|
||||
|
||||
"portal": {
|
||||
@@ -385,16 +355,7 @@
|
||||
},
|
||||
|
||||
"heating": {
|
||||
"hyst": {
|
||||
"title": "Hysteresis",
|
||||
"desc": "Hysteresis is useful for maintaining a set indoor temp (when using «Equitherm» and/or «PID»). Forces disable heating when <code>current indoor > target + value</code> and enable heating when <code>current indoor < (target - value)</code>.",
|
||||
"value": "Value <small>(in degrees)</small>",
|
||||
"action": {
|
||||
"title": "Action",
|
||||
"disableHeating": "Disable heating",
|
||||
"set0target": "Set null target"
|
||||
}
|
||||
},
|
||||
"hyst": "Hysteresis <small>(in degrees)</small>",
|
||||
"turboFactor": "Turbo mode coeff."
|
||||
},
|
||||
|
||||
@@ -415,7 +376,7 @@
|
||||
},
|
||||
"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": {
|
||||
"title": "Shift",
|
||||
@@ -423,7 +384,7 @@
|
||||
},
|
||||
"targetDiffFactor": {
|
||||
"title": "T factor",
|
||||
"note": "Not used if PID is enabled. Adds to the setpoint the difference between the target and current indoor temp: <code>setpoint = setpoint + ((target - indoor) * T)</code>."
|
||||
"note": "Not used if PID is enabled"
|
||||
},
|
||||
"chart": {
|
||||
"targetTemp": "Target indoor temperature",
|
||||
@@ -486,13 +447,12 @@
|
||||
"autoFaultReset": "Auto fault reset <small>(not recommended!)</small>",
|
||||
"autoDiagReset": "Auto diag reset <small>(not recommended!)</small>",
|
||||
"setDateAndTime": "Set date & time on boiler",
|
||||
"immergasFix": "Fix for Immergas boilers",
|
||||
"alwaysSendIndoorTemp": "Send current indoor temp to boiler"
|
||||
"immergasFix": "Fix for Immergas boilers"
|
||||
},
|
||||
|
||||
"nativeOTC": {
|
||||
"title": "Native OTC mode",
|
||||
"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."
|
||||
"nativeHeating": {
|
||||
"title": "Native heating control (boiler)",
|
||||
"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": {
|
||||
"use": "Use external pump",
|
||||
"gpio": "Relay GPIO",
|
||||
"invertState": "Invert GPIO state",
|
||||
"postCirculationTime": "Post circulation time <small>(min)</small>",
|
||||
"antiStuckInterval": "Anti stuck interval <small>(days)</small>",
|
||||
"antiStuckTime": "Anti stuck time <small>(min)</small>"
|
||||
|
||||
+17
-57
@@ -109,8 +109,7 @@
|
||||
|
||||
"sConnected": "Connessione OpenTherm",
|
||||
"sFlame": "Fiamma",
|
||||
"sCoolingActive": "Raffrescamento",
|
||||
"sCoolingSetpoint": "Raffrescamento setpoint",
|
||||
"sCooling": "Raffrescamento",
|
||||
"sFaultActive": "Anomalia",
|
||||
"sFaultCode": "Codice anomalia",
|
||||
"sDiagActive": "Diagnostica",
|
||||
@@ -151,7 +150,6 @@
|
||||
|
||||
"section": {
|
||||
"static": "Impostazioni statico",
|
||||
"ethernet": "Ethernet",
|
||||
"availableNetworks": "Reti disponibili",
|
||||
"staSettings": "Impostazioni WiFi",
|
||||
"apSettings": "Impostazioni AP"
|
||||
@@ -159,20 +157,7 @@
|
||||
|
||||
"scan": {
|
||||
"pos": "#",
|
||||
"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"
|
||||
"info": "Info"
|
||||
},
|
||||
|
||||
"wifi": {
|
||||
@@ -190,14 +175,7 @@
|
||||
"ip": "IP",
|
||||
"subnet": "Subnet",
|
||||
"gateway": "Gateway",
|
||||
"dns": "DNS",
|
||||
"connection": "Connessione",
|
||||
"connectionType": {
|
||||
"ethernet": "Ethernet",
|
||||
"wifi": "WiFi",
|
||||
"wifi-ap": "WiFi AP",
|
||||
"none": "Nessuno"
|
||||
}
|
||||
"dns": "DNS"
|
||||
},
|
||||
|
||||
"sta": {
|
||||
@@ -264,7 +242,6 @@
|
||||
"otDhwBurnerHours": "OpenTherm, numero di ore di funzionamento del bruciatore (ACS)",
|
||||
"otHeatingPumpHours": "OpenTherm, numero di ore di funzionamento della pompa (riscaldamento)",
|
||||
"otDhwPumpHours": "OpenTherm, numero di ore di funzionamento della pompa (ACS)",
|
||||
"otCoolingHours": "OpenTherm, numero di ore di funzionamento della cooling",
|
||||
|
||||
"ntcTemp": "Sensore NTC",
|
||||
"dallasTemp": "Sensore DALLAS",
|
||||
@@ -341,15 +318,9 @@
|
||||
},
|
||||
"freezeProtection": {
|
||||
"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>.",
|
||||
"highTemp": {
|
||||
"title": "Soglia di temperatura alta",
|
||||
"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"
|
||||
}
|
||||
"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>.",
|
||||
"lowTemp": "Soglia di temperatura minima",
|
||||
"thresholdTime": "Tempo di attesa <small>(sec)</small>"
|
||||
},
|
||||
|
||||
"portal": {
|
||||
@@ -384,16 +355,7 @@
|
||||
},
|
||||
|
||||
"heating": {
|
||||
"hyst": {
|
||||
"title": "Isteresi",
|
||||
"desc": "L'isteresi è utile per mantenere una temperatura interna impostata (quando si utilizza «Equitherm» e/o «PID»). Forza la disabilitazione del riscaldamento quando <code>current indoor > target + value</code> e abilita il riscaldamento quando <code>current indoor < (target - value)</code>.",
|
||||
"value": "Valore <small>(in gradi)</small>",
|
||||
"action": {
|
||||
"title": "Azione",
|
||||
"disableHeating": "Disabilita riscaldamento",
|
||||
"set0target": "Imposta target nullo"
|
||||
}
|
||||
},
|
||||
"hyst": "Isteresi <small>(in gradi)</small>",
|
||||
"turboFactor": "Turbo mode coeff."
|
||||
},
|
||||
|
||||
@@ -410,23 +372,23 @@
|
||||
"equitherm": {
|
||||
"slope": {
|
||||
"title": "Pendenza",
|
||||
"note": "Compensazione della perdita di calore. Parametro di regolazione principale."
|
||||
"note": "Compensazione delle perdite di calore. Principale parametro di regolazione."
|
||||
},
|
||||
"exponent": {
|
||||
"title": "Esponente",
|
||||
"note": "Efficienza del radiatore. Valori tipici: <code>1.1</code> - Riscaldamento a pavimento, <code>1.2</code> - Ghisa, <code>1.3</code> - Radiatori a pannello, <code>1.4</code> - Convettori."
|
||||
"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": {
|
||||
"title": "Spostamento",
|
||||
"note": "Compensa perdite di calore aggiuntive (ad es., nelle tubature) o fonti di calore extra."
|
||||
"title": "Spostare",
|
||||
"note": "Compensa le perdite di calore aggiuntive (ad esempio, nelle tubature) o fonti di calore extra."
|
||||
},
|
||||
"targetDiffFactor": {
|
||||
"title": "Fattore T",
|
||||
"note": "Non utilizzato se PID è abilitato. Aggiunge al setpoint la differenza tra la temperatura target e quella interna attuale: <code>setpoint = setpoint + ((target - indoor) * T)</code>."
|
||||
"note": "Non usato se PID è attivato"
|
||||
},
|
||||
"chart": {
|
||||
"targetTemp": "Temperatura interna target",
|
||||
"setpointTemp": "Temperatura del vettore termico",
|
||||
"setpointTemp": "Temperatura del portatore di calore",
|
||||
"outdoorTemp": "Temperatura esterna"
|
||||
}
|
||||
},
|
||||
@@ -485,13 +447,12 @@
|
||||
"autoFaultReset": "Ripristino automatico degli errori <small>(sconsigliato!)</small>",
|
||||
"autoDiagReset": "Ripristino diagnostico automatica <small>(sconsigliato!)</small>",
|
||||
"setDateAndTime": "Imposta data e ora sulla caldaia",
|
||||
"immergasFix": "Fix per caldiaie Immergas",
|
||||
"alwaysSendIndoorTemp": "Invia la temp attuale interna alla caldaia"
|
||||
"immergasFix": "Fix per caldiaie Immergas"
|
||||
},
|
||||
|
||||
"nativeOTC": {
|
||||
"title": "Modalità nativa di calcolo della temperatura del vettore termico",
|
||||
"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."
|
||||
"nativeHeating": {
|
||||
"title": "Controllo del riscaldamento nativo (caldaia)",
|
||||
"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": {
|
||||
"use": "Usa pompa/circolatore esterno",
|
||||
"gpio": "GPIO relè",
|
||||
"invertState": "Inverti stato GPIO",
|
||||
"postCirculationTime": "Tempo di post circolazione <small>(min)</small>",
|
||||
"antiStuckInterval": "Intervallo antiblocco <small>(days)</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",
|
||||
"sFlame": "Пламя",
|
||||
"sCoolingActive": "Охлаждение",
|
||||
"sCoolingSetpoint": "Охлаждение, уставка",
|
||||
"sCooling": "Охлаждение",
|
||||
"sFaultActive": "Ошибка",
|
||||
"sFaultCode": "Код ошибки",
|
||||
"sDiagActive": "Диагностика",
|
||||
@@ -151,7 +150,6 @@
|
||||
|
||||
"section": {
|
||||
"static": "Статические параметры",
|
||||
"ethernet": "Ethernet",
|
||||
"availableNetworks": "Доступные сети",
|
||||
"staSettings": "Настройки подключения",
|
||||
"apSettings": "Настройки точки доступа"
|
||||
@@ -159,20 +157,7 @@
|
||||
|
||||
"scan": {
|
||||
"pos": "#",
|
||||
"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"
|
||||
"info": "Инфо"
|
||||
},
|
||||
|
||||
"wifi": {
|
||||
@@ -190,14 +175,7 @@
|
||||
"ip": "IP адрес",
|
||||
"subnet": "Адрес подсети",
|
||||
"gateway": "Адрес шлюза",
|
||||
"dns": "DNS адрес",
|
||||
"connection": "Подключение",
|
||||
"connectionType": {
|
||||
"ethernet": "Ethernet",
|
||||
"wifi": "WiFi",
|
||||
"wifi-ap": "WiFi AP",
|
||||
"none": "Нет"
|
||||
}
|
||||
"dns": "DNS адрес"
|
||||
},
|
||||
|
||||
"sta": {
|
||||
@@ -264,7 +242,6 @@
|
||||
"otDhwBurnerHours": "OpenTherm, кол-во часов работы горелки (ГВС)",
|
||||
"otHeatingPumpHours": "OpenTherm, кол-во часов работы насоса (отопление)",
|
||||
"otDhwPumpHours": "OpenTherm, кол-во часов работы насоса (ГВС)",
|
||||
"otCoolingHours": "OpenTherm, кол-во часов работы охлаждения",
|
||||
|
||||
"ntcTemp": "NTC датчик",
|
||||
"dallasTemp": "DALLAS датчик",
|
||||
@@ -341,15 +318,9 @@
|
||||
},
|
||||
"freezeProtection": {
|
||||
"title": "Защита от замерзания",
|
||||
"desc": "Отопление будет принудительно включено, если темп. теплоносителя или внутренняя темп. опустится ниже <b>нижнего порога</b>.",
|
||||
"highTemp": {
|
||||
"title": "Верхний порог температуры",
|
||||
"note": "Порог, при котором система вернется в нормальное состояние после активации защиты от замерзания"
|
||||
},
|
||||
"lowTemp": {
|
||||
"title": "Нижний порог температуры",
|
||||
"note": "Порог, при котором отопление будет принудительно включено"
|
||||
}
|
||||
"desc": "Отопление будет принудительно включено, если темп. теплоносителя или внутренняя темп. опустится ниже <b>нижнего порога</b> в течение <b>времени ожидания</b>.",
|
||||
"lowTemp": "Нижний порог температуры",
|
||||
"thresholdTime": "Время ожидания <small>(сек)</small>"
|
||||
},
|
||||
|
||||
"portal": {
|
||||
@@ -384,16 +355,7 @@
|
||||
},
|
||||
|
||||
"heating": {
|
||||
"hyst": {
|
||||
"title": "Гистерезис",
|
||||
"desc": "Гистерезис полезен для поддержания заданной внутр. темп. (при использовании «ПЗА» и/или «ПИД»). Принудительно откл. отопление, когда <code>current indoor > target + value</code>, и вкл. отопление, когда <code>current indoor < (target - value)</code>.",
|
||||
"value": "Значение <small>(в градусах)</small>",
|
||||
"action": {
|
||||
"title": "Действие",
|
||||
"disableHeating": "Отключить отопление",
|
||||
"set0target": "Установить 0 в качестве целевой темп."
|
||||
}
|
||||
},
|
||||
"hyst": "Гистерезис <small>(в градусах)</small>",
|
||||
"turboFactor": "Коэфф. турбо режима"
|
||||
},
|
||||
|
||||
@@ -414,7 +376,7 @@
|
||||
},
|
||||
"exponent": {
|
||||
"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": {
|
||||
"title": "Смещение",
|
||||
@@ -422,7 +384,7 @@
|
||||
},
|
||||
"targetDiffFactor": {
|
||||
"title": "Коэффициент T",
|
||||
"note": "Не используется, если ПИД включен. Добавляет разницу между целевой и текущей температурой в помещении: <code>setpoint = setpoint + ((target - indoor) * T)</code>."
|
||||
"note": "Не используется, если ПИД включен"
|
||||
},
|
||||
"chart": {
|
||||
"targetTemp": "Целевая внутренняя температура",
|
||||
@@ -485,13 +447,12 @@
|
||||
"autoFaultReset": "Автоматический сброс ошибок <small>(не рекомендуется!)</small>",
|
||||
"autoDiagReset": "Автоматический сброс диагностики <small>(не рекомендуется!)</small>",
|
||||
"setDateAndTime": "Устанавливать время и дату на котле",
|
||||
"immergasFix": "Фикс для котлов Immergas",
|
||||
"alwaysSendIndoorTemp": "Передавать текущую темп. в помещении котлу"
|
||||
"immergasFix": "Фикс для котлов Immergas"
|
||||
},
|
||||
|
||||
"nativeOTC": {
|
||||
"title": "Нативный режим OTC (расчёт температуры теплоносителя)",
|
||||
"note": "Работает <u>ТОЛЬКО</u> если котел в режиме OTC: требует и принимает целевую температуру в помещении и сам регулирует температуру теплоносителя на основе встроенного режима кривых. Несовместимо с ПИД и ПЗА."
|
||||
"nativeHeating": {
|
||||
"title": "Передать управление отоплением котлу",
|
||||
"note": "Работает <u>ТОЛЬКО</u> если котел требует и принимает целевую температуру в помещении и сам регулирует температуру теплоносителя на основе встроенного режима кривых. Несовместимо с ПИД и ПЗА."
|
||||
}
|
||||
},
|
||||
|
||||
@@ -508,7 +469,6 @@
|
||||
"extPump": {
|
||||
"use": "Использовать доп. насос",
|
||||
"gpio": "GPIO реле",
|
||||
"invertState": "Инвертировать состояние GPIO",
|
||||
"postCirculationTime": "Время постциркуляции <small>(в минутах)</small>",
|
||||
"antiStuckInterval": "Интервал защиты от блокировки <small>(в днях)</small>",
|
||||
"antiStuckTime": "Время работы насоса <small>(в минутах)</small>"
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
<option value="en" selected>EN</option>
|
||||
<option value="cn">CN</option>
|
||||
<option value="it">IT</option>
|
||||
<option value="nl">NL</option>
|
||||
<option value="ru">RU</option>
|
||||
</select>
|
||||
</li>
|
||||
@@ -154,14 +153,9 @@
|
||||
<th scope="row" data-i18n>dashboard.states.sFlame</th>
|
||||
<td><i class="sFlame"></i></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row" data-i18n>dashboard.states.sCoolingActive</th>
|
||||
<td><i class="sCoolingActive"></i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" data-i18n>dashboard.states.sCoolingSetpoint</th>
|
||||
<td><b class="sCoolingSetpoint"></b> %</td>
|
||||
<th scope="row" data-i18n>dashboard.states.sCooling</th>
|
||||
<td><i class="sCooling"></i></td>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -195,10 +189,6 @@
|
||||
<th scope="row" data-i18n>dashboard.states.mHeatOverheat</th>
|
||||
<td><i class="mHeatOverheat"></i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" data-i18n>dashboard.states.mHeatFreezing</th>
|
||||
<td><i class="mHeatFreezing"></i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" data-i18n>dashboard.states.sHeatActive</th>
|
||||
<td><i class="sHeatActive"></i></td>
|
||||
@@ -324,7 +314,7 @@
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const lang = new Lang(document.getElementById('lang'));
|
||||
await lang.build();
|
||||
lang.build();
|
||||
|
||||
let actionTimer = null;
|
||||
let actionLongPress = false;
|
||||
@@ -567,9 +557,7 @@
|
||||
result.slave.connected ? "green" : "red"
|
||||
);
|
||||
setState('.sFlame', result.slave.flame);
|
||||
|
||||
setState('.sCoolingActive', result.slave.cooling.active);
|
||||
setValue('.sCoolingSetpoint', result.slave.cooling.setpoint);
|
||||
setState('.sCooling', result.slave.cooling);
|
||||
|
||||
setValue('.sModMin', result.slave.modulation.min);
|
||||
setValue('.sModMax', result.slave.modulation.max);
|
||||
@@ -637,11 +625,6 @@
|
||||
result.master.heating.overheat ? "success" : "error",
|
||||
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('.mHeatTargetTemp', result.master.heating.targetTemp);
|
||||
setValue('.mHeatCurrTemp', result.master.heating.currentTemp);
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
<option value="en" selected>EN</option>
|
||||
<option value="cn">CN</option>
|
||||
<option value="it">IT</option>
|
||||
<option value="nl">NL</option>
|
||||
<option value="ru">RU</option>
|
||||
</select>
|
||||
</li>
|
||||
@@ -50,19 +49,15 @@
|
||||
<th scope="row" data-i18n>network.params.mac</th>
|
||||
<td><b id="network-mac"></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" data-i18n>network.params.connection</th>
|
||||
<td><b id="network-connection"></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" data-i18n>network.wifi.connected</th>
|
||||
<td><i id="network-connected"></i></td>
|
||||
</tr>
|
||||
<tr id="network-ssid-row">
|
||||
<tr>
|
||||
<th scope="row" data-i18n>network.wifi.ssid</th>
|
||||
<td><b id="network-ssid"></b></td>
|
||||
</tr>
|
||||
<tr id="network-signal-row">
|
||||
<tr>
|
||||
<th scope="row" data-i18n>network.wifi.signal</th>
|
||||
<td><b id="network-signal"></b> %</td>
|
||||
</tr>
|
||||
@@ -173,7 +168,7 @@
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const lang = new Lang(document.getElementById('lang'));
|
||||
await lang.build();
|
||||
lang.build();
|
||||
|
||||
setTimeout(async function onLoadPage() {
|
||||
try {
|
||||
@@ -196,7 +191,6 @@
|
||||
|
||||
setValue('#network-hostname', result.network.hostname);
|
||||
setValue('#network-mac', result.network.mac);
|
||||
setValue('#network-connection', i18n(`network.params.connectionType.${result.network.connectionType}`));
|
||||
setStatus(
|
||||
'#network-connected',
|
||||
result.network.connected ? "success" : "error",
|
||||
@@ -204,14 +198,6 @@
|
||||
);
|
||||
setValue('#network-ssid', result.network.ssid);
|
||||
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-subnet', result.network.subnet);
|
||||
setValue('#network-gateway', result.network.gateway);
|
||||
|
||||
+7
-117
@@ -23,7 +23,6 @@
|
||||
<option value="en" selected>EN</option>
|
||||
<option value="cn">CN</option>
|
||||
<option value="it">IT</option>
|
||||
<option value="nl">NL</option>
|
||||
<option value="ru">RU</option>
|
||||
</select>
|
||||
</li>
|
||||
@@ -79,7 +78,6 @@
|
||||
</div>
|
||||
</article>
|
||||
|
||||
|
||||
<article>
|
||||
<div>
|
||||
<hgroup>
|
||||
@@ -101,7 +99,6 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p id="scan-unavailable" class="hidden" data-i18n>network.scan.unavailable</p>
|
||||
<button type="submit" data-i18n>button.refresh</button>
|
||||
</form>
|
||||
|
||||
@@ -164,62 +161,6 @@
|
||||
</form>
|
||||
</div>
|
||||
</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>
|
||||
|
||||
<footer class="container">
|
||||
@@ -237,7 +178,7 @@
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const lang = new Lang(document.getElementById('lang'));
|
||||
await lang.build();
|
||||
lang.build();
|
||||
|
||||
const fillData = (data) => {
|
||||
setInputValue("[name='hostname']", data.hostname);
|
||||
@@ -248,29 +189,6 @@
|
||||
setInputValue("[name='staticConfig[dns]']", data.staticConfig.dns);
|
||||
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[password]']", data.sta.password);
|
||||
setInputValue("[name='sta[channel]']", data.sta.channel);
|
||||
@@ -282,49 +200,21 @@
|
||||
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 {
|
||||
const [response, infoResponse] = await Promise.all([
|
||||
fetch("/api/network/settings", {
|
||||
cache: "no-cache",
|
||||
credentials: "include"
|
||||
}),
|
||||
fetch("/api/info", {
|
||||
cache: "no-cache",
|
||||
credentials: "include"
|
||||
})
|
||||
]);
|
||||
|
||||
const response = await fetch("/api/network/settings", {
|
||||
cache: "no-cache",
|
||||
credentials: "include"
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Response not valid');
|
||||
}
|
||||
|
||||
const info = infoResponse.ok ? await infoResponse.json() : null;
|
||||
const ethernetSupported = applyCapabilities(info);
|
||||
|
||||
const result = await response.json();
|
||||
fillData(result);
|
||||
|
||||
setupForm('#network-settings', fillData, ['hostname']);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
setupNetworkScanForm('#network-scan', '#networks');
|
||||
setupForm('#sta-settings', fillData, ['sta.ssid', 'sta.password']);
|
||||
setupForm('#ap-settings', fillData, ['ap.ssid', 'ap.password']);
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
<option value="en" selected>EN</option>
|
||||
<option value="cn">CN</option>
|
||||
<option value="it">IT</option>
|
||||
<option value="nl">NL</option>
|
||||
<option value="ru">RU</option>
|
||||
</select>
|
||||
</li>
|
||||
@@ -38,8 +37,6 @@
|
||||
<p></p>
|
||||
</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">
|
||||
<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="25" data-i18n>sensors.types.otHeatingPumpHours</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="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="254" data-i18n>sensors.types.manual</option>
|
||||
<option value="255" data-i18n>sensors.types.notConfigured</option>
|
||||
@@ -203,43 +199,21 @@
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", async () => {
|
||||
const lang = new Lang(document.getElementById("lang"));
|
||||
await lang.build();
|
||||
lang.build();
|
||||
|
||||
const container = document.querySelector("article");
|
||||
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 {
|
||||
const [response, infoResponse] = await Promise.all([
|
||||
fetch("/api/sensors", {
|
||||
cache: "no-cache",
|
||||
credentials: "include"
|
||||
}),
|
||||
fetch("/api/info", {
|
||||
cache: "no-cache",
|
||||
credentials: "include"
|
||||
})
|
||||
]);
|
||||
const response = await fetch("/api/sensors", {
|
||||
cache: "no-cache",
|
||||
credentials: "include"
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Response not valid");
|
||||
}
|
||||
|
||||
const info = infoResponse.ok ? await infoResponse.json() : null;
|
||||
applyCapabilities(info, templateNode);
|
||||
|
||||
const result = await response.json();
|
||||
for (const sensorId in result) {
|
||||
const sensorNode = templateNode.cloneNode(true);
|
||||
@@ -311,12 +285,6 @@
|
||||
|
||||
// ble
|
||||
case 52:
|
||||
if (!bleSupported) {
|
||||
parentGpio.classList.add("hidden");
|
||||
parentAddress.classList.add("hidden");
|
||||
break;
|
||||
}
|
||||
|
||||
parentGpio.classList.add("hidden");
|
||||
parentAddress.classList.remove("hidden");
|
||||
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="cn">CN</option>
|
||||
<option value="it">IT</option>
|
||||
<option value="nl">NL</option>
|
||||
<option value="ru">RU</option>
|
||||
</select>
|
||||
</li>
|
||||
@@ -106,7 +105,7 @@
|
||||
<option disabled selected data-i18n>settings.system.ntp.timezonePresets</option>
|
||||
</select>
|
||||
</div>
|
||||
</label>
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
@@ -194,47 +193,20 @@
|
||||
|
||||
<div class="grid">
|
||||
<label>
|
||||
<span data-i18n>settings.heating.turboFactor</span>
|
||||
<input type="number" inputmode="decimal" name="heating[turboFactor]" min="1.5" max="10" step="0.1" required>
|
||||
<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>
|
||||
<span data-i18n>settings.maxModulation</span>
|
||||
<input type="number" inputmode="numeric" name="heating[maxModulation]" min="1" max="100" step="1" required>
|
||||
<span data-i18n>settings.heating.turboFactor</span>
|
||||
<input type="number" inputmode="decimal" name="heating[turboFactor]" min="1.5" max="10" step="0.1" required>
|
||||
</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>
|
||||
<label>
|
||||
<span data-i18n>settings.maxModulation</span>
|
||||
<input type="number" inputmode="numeric" name="heating[maxModulation]" min="1" max="100" step="1" required>
|
||||
</label>
|
||||
|
||||
<hr />
|
||||
|
||||
@@ -265,15 +237,13 @@
|
||||
|
||||
<div class="grid">
|
||||
<label>
|
||||
<span data-i18n>settings.freezeProtection.highTemp.title</span>
|
||||
<input type="number" inputmode="numeric" name="heating[freezeProtection][highTemp]" min="0" max="0" step="1" required>
|
||||
<small data-i18n>settings.freezeProtection.highTemp.note</small>
|
||||
<span data-i18n>settings.freezeProtection.lowTemp</span>
|
||||
<input type="number" inputmode="numeric" name="heating[freezeProtection][lowTemp]" min="0" max="0" step="1" required>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<span data-i18n>settings.freezeProtection.lowTemp.title</span>
|
||||
<input type="number" inputmode="numeric" name="heating[freezeProtection][lowTemp]" min="0" max="0" step="1" required>
|
||||
<small data-i18n>settings.freezeProtection.lowTemp.note</small>
|
||||
<span data-i18n>settings.freezeProtection.thresholdTime</span>
|
||||
<input type="number" inputmode="numeric" name="heating[freezeProtection][thresholdTime]" min="30" max="1800" step="1" required>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@@ -370,7 +340,7 @@
|
||||
</details>
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
<details>
|
||||
<summary><b data-i18n>settings.section.equitherm</b></summary>
|
||||
<div>
|
||||
@@ -395,7 +365,7 @@
|
||||
<input class="etChartTargetTemp" type="range" value="0" min="0" max="0" step="0.5">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="grid">
|
||||
<label>
|
||||
<span data-i18n>settings.equitherm.slope.title</span>
|
||||
@@ -430,7 +400,7 @@
|
||||
</details>
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
<details>
|
||||
<summary><b data-i18n>settings.section.pid</b></summary>
|
||||
<div>
|
||||
@@ -476,7 +446,7 @@
|
||||
<span data-i18n>settings.temp.min</span>
|
||||
<input type="number" inputmode="decimal" name="pid[minTemp]" min="0" max="0" step="1" required>
|
||||
</label>
|
||||
|
||||
|
||||
<label>
|
||||
<span data-i18n>settings.temp.max</span>
|
||||
<input type="number" inputmode="numeric" name="pid[maxTemp]" min="0" max="0" step="1" required>
|
||||
@@ -505,12 +475,12 @@
|
||||
<span data-i18n>settings.pid.deadband.p_multiplier</span>
|
||||
<input type="number" inputmode="decimal" name="pid[deadband][p_multiplier]" min="0" max="5" step="0.001" required>
|
||||
</label>
|
||||
|
||||
|
||||
<label>
|
||||
<span data-i18n>settings.pid.deadband.i_multiplier</span>
|
||||
<input type="number" inputmode="decimal" name="pid[deadband][i_multiplier]" min="0" max="1" step="0.001" required>
|
||||
</label>
|
||||
|
||||
|
||||
<label>
|
||||
<span data-i18n>settings.pid.deadband.d_multiplier</span>
|
||||
<input type="number" inputmode="decimal" name="pid[deadband][d_multiplier]" min="0" max="1" step="0.001" required>
|
||||
@@ -522,7 +492,7 @@
|
||||
<span data-i18n>settings.pid.deadband.thresholdHigh</span>
|
||||
<input type="number" inputmode="decimal" name="pid[deadband][thresholdHigh]" min="0" max="5" step="0.01" required>
|
||||
</label>
|
||||
|
||||
|
||||
<label>
|
||||
<span data-i18n>settings.pid.deadband.thresholdLow</span>
|
||||
<input type="number" inputmode="decimal" name="pid[deadband][thresholdLow]" min="0" max="5" step="0.01" required>
|
||||
@@ -694,22 +664,17 @@
|
||||
<span data-i18n>settings.ot.options.immergasFix</span>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input type="checkbox" name="opentherm[options][alwaysSendIndoorTemp]" value="true">
|
||||
<span data-i18n>settings.ot.options.alwaysSendIndoorTemp</span>
|
||||
</label>
|
||||
|
||||
<hr />
|
||||
|
||||
<label>
|
||||
<input type="checkbox" name="opentherm[options][nativeOTC]" value="true">
|
||||
<span data-i18n>settings.ot.nativeOTC.title</span><br />
|
||||
<small data-i18n>settings.ot.nativeOTC.note</small>
|
||||
<input type="checkbox" name="opentherm[options][nativeHeatingControl]" value="true">
|
||||
<span data-i18n>settings.ot.nativeHeating.title</span><br />
|
||||
<small data-i18n>settings.ot.nativeHeating.note</small>
|
||||
</label>
|
||||
</fieldset>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
|
||||
<br />
|
||||
<button type="submit" data-i18n>button.save</button>
|
||||
</form>
|
||||
@@ -788,11 +753,6 @@
|
||||
<input type="checkbox" name="externalPump[use]" value="true">
|
||||
<span data-i18n>settings.extPump.use</span>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input type="checkbox" name="externalPump[invertState]" value="true">
|
||||
<span data-i18n>settings.externalPump.invertState</span>
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
<div class="grid">
|
||||
@@ -927,7 +887,7 @@
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const lang = new Lang(document.getElementById('lang'));
|
||||
await lang.build();
|
||||
lang.build();
|
||||
|
||||
let etChart = null;
|
||||
let etChartConfig = {
|
||||
@@ -956,7 +916,7 @@
|
||||
datasets: [{
|
||||
borderColor: (context) => {
|
||||
const chart = context.chart;
|
||||
const { ctx, chartArea } = chart;
|
||||
const {ctx, chartArea} = chart;
|
||||
|
||||
if (!chartArea) {
|
||||
return;
|
||||
@@ -1072,8 +1032,8 @@
|
||||
1 / etChartConfig.exponent
|
||||
);
|
||||
const result = etChartConfig.targetTemp + etChartConfig.shift + sf * (
|
||||
tempDelta >= 0
|
||||
? Math.pow(tempDelta, 1 / etChartConfig.exponent)
|
||||
tempDelta >= 0
|
||||
? Math.pow(tempDelta, 1 / etChartConfig.exponent)
|
||||
: -(Math.pow(-(tempDelta), 1 / etChartConfig.exponent))
|
||||
);
|
||||
|
||||
@@ -1124,9 +1084,8 @@
|
||||
setCheckboxValue("[name='opentherm[options][autoFaultReset]']", data.opentherm.options.autoFaultReset);
|
||||
setCheckboxValue("[name='opentherm[options][autoDiagReset]']", data.opentherm.options.autoDiagReset);
|
||||
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][alwaysSendIndoorTemp]']", data.opentherm.options.alwaysSendIndoorTemp);
|
||||
setBusy('#ot-settings-busy', '#ot-settings', false);
|
||||
|
||||
// MQTT
|
||||
@@ -1143,7 +1102,6 @@
|
||||
// Extpump
|
||||
setCheckboxValue("[name='externalPump[use]']", data.externalPump.use);
|
||||
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[antiStuckInterval]']", data.externalPump.antiStuckInterval);
|
||||
setInputValue("[name='externalPump[antiStuckTime]']", data.externalPump.antiStuckTime);
|
||||
@@ -1173,9 +1131,7 @@
|
||||
"min": data.system.unitSystem == 0 ? 1 : 33,
|
||||
"max": data.system.unitSystem == 0 ? 100 : 212
|
||||
});
|
||||
setCheckboxValue("[name='heating[hysteresis][enabled]']", data.heating.hysteresis.enabled);
|
||||
setInputValue("[name='heating[hysteresis][value]']", data.heating.hysteresis.value);
|
||||
setSelectValue("[name='heating[hysteresis][action]']", data.heating.hysteresis.action);
|
||||
setInputValue("[name='heating[hysteresis]']", data.heating.hysteresis);
|
||||
setInputValue("[name='heating[turboFactor]']", data.heating.turboFactor);
|
||||
setInputValue("[name='heating[maxModulation]']", data.heating.maxModulation);
|
||||
setInputValue("[name='heating[overheatProtection][highTemp]']", data.heating.overheatProtection.highTemp, {
|
||||
@@ -1186,14 +1142,11 @@
|
||||
"min": 0,
|
||||
"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, {
|
||||
"min": data.system.unitSystem == 0 ? 1 : 34,
|
||||
"max": data.system.unitSystem == 0 ? 30 : 86
|
||||
});
|
||||
setInputValue("[name='heating[freezeProtection][thresholdTime]']", data.heating.freezeProtection.thresholdTime);
|
||||
setBusy('#heating-settings-busy', '#heating-settings', false);
|
||||
|
||||
// DHW
|
||||
@@ -1217,7 +1170,7 @@
|
||||
setBusy('#dhw-settings-busy', '#dhw-settings', false);
|
||||
|
||||
// Emergency mode
|
||||
if (data.opentherm.options.nativeOTC) {
|
||||
if (data.opentherm.options.nativeHeatingControl) {
|
||||
setInputValue("[name='emergency[target]']", data.emergency.target, {
|
||||
"min": data.system.unitSystem == 0 ? 5 : 41,
|
||||
"max": data.system.unitSystem == 0 ? 40 : 104
|
||||
@@ -1265,7 +1218,7 @@
|
||||
const etMinTemp = parseInt(data.system.unitSystem == 0 ? 5 : 41);
|
||||
const etMaxTemp = parseInt(data.system.unitSystem == 0 ? 30 : 86);
|
||||
const etTargetTemp = constrain(parseFloat(data.heating.target), etMinTemp, etMaxTemp);
|
||||
|
||||
|
||||
setInputValue(".etChartTargetTemp", etTargetTemp.toFixed(1), {
|
||||
"min": etMinTemp,
|
||||
"max": etMaxTemp
|
||||
@@ -1308,7 +1261,7 @@
|
||||
cache: "no-cache",
|
||||
credentials: "include"
|
||||
});
|
||||
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Response not valid');
|
||||
}
|
||||
@@ -1376,7 +1329,7 @@
|
||||
window.addEventListener('resize', async (event) => {
|
||||
if (etChart) {
|
||||
etChart.resize();
|
||||
|
||||
|
||||
if (etChartConfig.decimated != hasNeedDecimationChart()) {
|
||||
makeEquithermChart();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
<option value="en" selected>EN</option>
|
||||
<option value="cn">CN</option>
|
||||
<option value="it">IT</option>
|
||||
<option value="nl">NL</option>
|
||||
<option value="ru">RU</option>
|
||||
</select>
|
||||
</li>
|
||||
@@ -105,7 +104,7 @@
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const lang = new Lang(document.getElementById('lang'));
|
||||
await lang.build();
|
||||
lang.build();
|
||||
|
||||
setupRestoreBackupForm('#restore');
|
||||
setupUpgradeForm('#upgrade');
|
||||
|
||||
@@ -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);
|
||||
if (!form) {
|
||||
console.error("form not found");
|
||||
@@ -253,9 +253,7 @@ const setupNetworkScanForm = (formSelector, tableSelector, autorun = true) => {
|
||||
};
|
||||
|
||||
form.addEventListener('submit', onSubmitFn);
|
||||
if (autorun) {
|
||||
onSubmitFn();
|
||||
}
|
||||
onSubmitFn();
|
||||
}
|
||||
|
||||
const setupRestoreBackupForm = (formSelector) => {
|
||||
|
||||
Reference in new issue
Block a user