8 Commits

Author SHA1 Message Date
Yurii
98e5fe42e8 feat: added more hysteresis settings 2025-10-02 17:50:10 +03:00
Yurii
14826c10cd chore: `byte to uint8_t` 2025-09-23 04:03:36 +03:00
Yurii
28a5218b7c fix: various fixes
Found by PVS-Studio
2025-09-23 04:02:40 +03:00
Yurii
f3ba43adbd docs: fix typo 2025-09-19 21:14:38 +03:00
Yurii
062c6714d1 chore: bump dependencies 2025-09-19 21:09:55 +03:00
Yurii
502f73db0e chore: bump pioarduino/platform-espressif32 from 3.3.0 to 3.3.1 2025-09-19 21:06:17 +03:00
zedward
c2ee30d1ab fix: added `nodemcu_32_160mhz` env, deadband usage in PID fixed (#176)
* Small fixes: CPU limit for odemcu_32,  deadbamd usage in PID

* PR review fixes

* Fix: remove spaces

---------

Co-authored-by: Edward Zhuravlov <Edward.Zhuravlev@topsoft.by>
2025-09-19 21:00:11 +03:00
dependabot[bot]
9217bb7448 chore: bump actions/stale from 9 to 10 (#172)
Bumps [actions/stale](https://github.com/actions/stale) from 9 to 10.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v9...v10)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-version: '10'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-05 06:33:43 +03:00
16 changed files with 204 additions and 98 deletions

View File

@@ -7,7 +7,7 @@ jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@v9 - uses: actions/stale@v10
with: with:
stale-issue-message: > stale-issue-message: >
This issue is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 5 days. This issue is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 5 days.

View File

@@ -72,7 +72,7 @@ All available information and instructions can be found in the wiki:
* [Leds on board](https://github.com/Laxilef/OTGateway/wiki/OT-adapters#leds-on-board) * [Leds on board](https://github.com/Laxilef/OTGateway/wiki/OT-adapters#leds-on-board)
## Gratitude ## Gratitude
* To the developers of the libraries used: [OpenTherm Library](https://github.com/ihormelnyk/opentherm_library), [ESP8266Scheduler](https://github.com/nrwiersma/ESP8266Scheduler), [ArduinoJson](https://github.com/bblanchon/ArduinoJson), [NimBLE-Arduino](https://github.com/h2zero/NimBLE-Arduino), [ArduinoMqttClient](https://github.com/arduino-libraries/ArduinoMqttClient), [ESPTelnet](https://github.com/LennartHennigs/ESPTelnet), [FileData](https://github.com/GyverLibs/FileData), [GyverPID](https://github.com/GyverLibs/GyverPID), [GyverBlinker](https://github.com/GyverLibs/GyverBlinker), [FileData](https://github.com/GyverLibs/FileData), [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), [OneWireNg](https://github.com/pstolarz/OneWireNg) & [OneWire](https://github.com/PaulStoffregen/OneWire)
* To the [PlatformIO](https://platformio.org/) Team * To the [PlatformIO](https://platformio.org/) Team
* To the team and contributors of the [pioarduino](https://github.com/pioarduino/platform-espressif32) project * To the team and contributors of the [pioarduino](https://github.com/pioarduino/platform-espressif32) project
* To the [BrowserStack](https://www.browserstack.com/) team. This project is tested with BrowserStack. * To the [BrowserStack](https://www.browserstack.com/) team. This project is tested with BrowserStack.

View File

@@ -4,8 +4,8 @@
class CustomOpenTherm : public OpenTherm { class CustomOpenTherm : public OpenTherm {
public: public:
typedef std::function<void(unsigned int)> DelayCallback; typedef std::function<void(unsigned int)> DelayCallback;
typedef std::function<void(unsigned long, byte)> BeforeSendRequestCallback; typedef std::function<void(unsigned long, uint8_t)> BeforeSendRequestCallback;
typedef std::function<void(unsigned long, unsigned long, OpenThermResponseStatus, byte)> AfterSendRequestCallback; typedef std::function<void(unsigned long, unsigned long, OpenThermResponseStatus, uint8_t)> AfterSendRequestCallback;
CustomOpenTherm(int inPin = 4, int outPin = 5, bool isSlave = false, bool alwaysReceive = false) : OpenTherm(inPin, outPin, isSlave, alwaysReceive) {} CustomOpenTherm(int inPin = 4, int outPin = 5, bool isSlave = false, bool alwaysReceive = false) : OpenTherm(inPin, outPin, isSlave, alwaysReceive) {}
~CustomOpenTherm() {} ~CustomOpenTherm() {}
@@ -106,15 +106,14 @@ public:
return isValidResponse(response) && isValidResponseId(response, OpenThermMessageID::RemoteRequest); return isValidResponse(response) && isValidResponseId(response, OpenThermMessageID::RemoteRequest);
} }
static bool isCh2Active(unsigned long response) static bool isCh2Active(unsigned long response) {
{
return response & 0x20; return response & 0x20;
} }
static bool isValidResponseId(unsigned long response, OpenThermMessageID id) { static bool isValidResponseId(unsigned long response, OpenThermMessageID id) {
byte responseId = (response >> 16) & 0xFF; uint8_t responseId = (response >> 16) & 0xFF;
return (byte)id == responseId; return (uint8_t)id == responseId;
} }
static uint8_t getResponseMessageTypeId(unsigned long response) { static uint8_t getResponseMessageTypeId(unsigned long response) {

View File

@@ -35,7 +35,7 @@ namespace NetworkUtils {
return this; return this;
} }
NetworkMgr* setApCredentials(const char* ssid, const char* password = nullptr, byte channel = 0) { NetworkMgr* setApCredentials(const char* ssid, const char* password = nullptr, uint8_t channel = 0) {
this->apName = ssid; this->apName = ssid;
this->apPassword = password; this->apPassword = password;
this->apChannel = channel; this->apChannel = channel;
@@ -43,7 +43,7 @@ namespace NetworkUtils {
return this; return this;
} }
NetworkMgr* setStaCredentials(const char* ssid = nullptr, const char* password = nullptr, byte channel = 0) { NetworkMgr* setStaCredentials(const char* ssid = nullptr, const char* password = nullptr, uint8_t channel = 0) {
this->staSsid = ssid; this->staSsid = ssid;
this->staPassword = password; this->staPassword = password;
this->staChannel = channel; this->staChannel = channel;
@@ -140,7 +140,7 @@ namespace NetworkUtils {
return this->staPassword; return this->staPassword;
} }
byte getStaChannel() { uint8_t getStaChannel() {
return this->staChannel; return this->staChannel;
} }
@@ -377,7 +377,7 @@ namespace NetworkUtils {
} }
} }
static byte rssiToSignalQuality(short int rssi) { static uint8_t rssiToSignalQuality(short int rssi) {
return constrain(map(rssi, -100, -50, 0, 100), 0, 100); return constrain(map(rssi, -100, -50, 0, 100), 0, 100);
} }
@@ -397,11 +397,11 @@ namespace NetworkUtils {
const char* hostname = "esp"; const char* hostname = "esp";
const char* apName = "ESP"; const char* apName = "ESP";
const char* apPassword = nullptr; const char* apPassword = nullptr;
byte apChannel = 1; uint8_t apChannel = 1;
const char* staSsid = nullptr; const char* staSsid = nullptr;
const char* staPassword = nullptr; const char* staPassword = nullptr;
byte staChannel = 0; uint8_t staChannel = 0;
bool useDhcp = true; bool useDhcp = true;
IPAddress staticIp; IPAddress staticIp;

View File

@@ -17,12 +17,12 @@ core_dir = .pio
version = 1.5.6 version = 1.5.6
framework = arduino framework = arduino
lib_deps = lib_deps =
bblanchon/ArduinoJson@^7.3.0 bblanchon/ArduinoJson@^7.4.2
;ihormelnyk/OpenTherm Library@^1.1.5 ;ihormelnyk/OpenTherm Library@^1.1.5
https://github.com/Laxilef/opentherm_library#esp32_timer https://github.com/Laxilef/opentherm_library#esp32_timer
arduino-libraries/ArduinoMqttClient@^0.1.8 arduino-libraries/ArduinoMqttClient@^0.1.8
lennarthennigs/ESP Telnet@^2.2 lennarthennigs/ESP Telnet@^2.2.3
gyverlibs/FileData@^1.0.2 gyverlibs/FileData@^1.0.3
gyverlibs/GyverPID@^3.3.2 gyverlibs/GyverPID@^3.3.2
gyverlibs/GyverBlinker@^1.1.1 gyverlibs/GyverBlinker@^1.1.1
https://github.com/pstolarz/Arduino-Temperature-Control-Library.git#OneWireNg https://github.com/pstolarz/Arduino-Temperature-Control-Library.git#OneWireNg
@@ -92,13 +92,13 @@ check_flags = ${env.check_flags}
;platform_packages = ;platform_packages =
; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.5 ; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.5
; framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip ; framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.30-2/platform-espressif32.zip platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.31/platform-espressif32.zip
platform_packages = ${env.platform_packages} platform_packages = ${env.platform_packages}
board_build.partitions = esp32_partitions.csv board_build.partitions = esp32_partitions.csv
lib_deps = lib_deps =
${env.lib_deps} ${env.lib_deps}
laxilef/ESP32Scheduler@^1.0.1 laxilef/ESP32Scheduler@^1.0.1
nimble_lib = h2zero/NimBLE-Arduino@^2.1.0 nimble_lib = h2zero/NimBLE-Arduino@^2.3.6
lib_ignore = lib_ignore =
extra_scripts = extra_scripts =
post:tools/esp32.py post:tools/esp32.py
@@ -294,6 +294,10 @@ build_flags =
check_tool = ${esp32_defaults.check_tool} check_tool = ${esp32_defaults.check_tool}
check_flags = ${esp32_defaults.check_flags} check_flags = ${esp32_defaults.check_flags}
[env:nodemcu_32_160mhz]
extends = env:nodemcu_32
board_build.f_cpu = 160000000L ; set frequency to 160MHz
[env:d1_mini32] [env:d1_mini32]
platform = ${esp32_defaults.platform} platform = ${esp32_defaults.platform}
platform_packages = ${esp32_defaults.platform_packages} platform_packages = ${esp32_defaults.platform_packages}

View File

@@ -3,8 +3,8 @@
class HaHelper : public HomeAssistantHelper { class HaHelper : public HomeAssistantHelper {
public: public:
static const byte TEMP_SOURCE_HEATING = 0; static const uint8_t TEMP_SOURCE_HEATING = 0;
static const byte TEMP_SOURCE_INDOOR = 1; static const uint8_t TEMP_SOURCE_INDOOR = 1;
static const char AVAILABILITY_OT_CONN[]; static const char AVAILABILITY_OT_CONN[];
static const char AVAILABILITY_SENSOR_CONN[]; static const char AVAILABILITY_SENSOR_CONN[];
@@ -439,6 +439,28 @@ public:
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_SWITCH), F("heating_turbo")).c_str(), doc); return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_SWITCH), F("heating_turbo")).c_str(), doc);
} }
bool publishSwitchHeatingHysteresis(bool enabledByDefault = true) {
JsonDocument doc;
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
doc[FPSTR(HA_UNIQUE_ID)] = this->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_NAME)] = F("Use heating hysteresis");
doc[FPSTR(HA_ICON)] = F("mdi:altimeter");
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
doc[FPSTR(HA_STATE_ON)] = true;
doc[FPSTR(HA_STATE_OFF)] = false;
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.heating.hysteresis.enabled }}");
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
doc[FPSTR(HA_PAYLOAD_ON)] = F("{\"heating\": {\"hysteresis\" : {\"enabled\" : true}}}");
doc[FPSTR(HA_PAYLOAD_OFF)] = F("{\"heating\": {\"hysteresis\" : {\"enabled\" : false}}}");
doc[FPSTR(HA_EXPIRE_AFTER)] = this->expireAfter;
doc.shrinkToFit();
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_SWITCH), F("heating_hysteresis")).c_str(), doc);
}
bool publishInputHeatingHysteresis(UnitSystem unit = UnitSystem::METRIC, bool enabledByDefault = true) { bool publishInputHeatingHysteresis(UnitSystem unit = UnitSystem::METRIC, bool enabledByDefault = true) {
JsonDocument doc; JsonDocument doc;
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str(); doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
@@ -458,9 +480,9 @@ public:
doc[FPSTR(HA_NAME)] = F("Heating hysteresis"); doc[FPSTR(HA_NAME)] = F("Heating hysteresis");
doc[FPSTR(HA_ICON)] = F("mdi:altimeter"); doc[FPSTR(HA_ICON)] = F("mdi:altimeter");
doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str(); doc[FPSTR(HA_STATE_TOPIC)] = this->settingsTopic.c_str();
doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.heating.hysteresis|float(0)|round(2) }}"); doc[FPSTR(HA_VALUE_TEMPLATE)] = F("{{ value_json.heating.hysteresis.value|float(0)|round(2) }}");
doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str(); doc[FPSTR(HA_COMMAND_TOPIC)] = this->setSettingsTopic.c_str();
doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"heating\": {\"hysteresis\" : {{ value }}}}"); doc[FPSTR(HA_COMMAND_TEMPLATE)] = F("{\"heating\": {\"hysteresis\" : {\"value\" : {{ value }}}}}");
doc[FPSTR(HA_MIN)] = 0; doc[FPSTR(HA_MIN)] = 0;
doc[FPSTR(HA_MAX)] = 15; doc[FPSTR(HA_MAX)] = 15;
doc[FPSTR(HA_STEP)] = 0.01f; doc[FPSTR(HA_STEP)] = 0.01f;
@@ -1170,7 +1192,7 @@ public:
} }
bool publishClimateHeating(UnitSystem unit = UnitSystem::METRIC, byte minTemp = 20, byte maxTemp = 90, bool enabledByDefault = true) { bool publishClimateHeating(UnitSystem unit = UnitSystem::METRIC, uint8_t minTemp = 20, uint8_t maxTemp = 90, bool enabledByDefault = true) {
JsonDocument doc; JsonDocument doc;
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str(); doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault; doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
@@ -1222,7 +1244,7 @@ public:
return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_CLIMATE), F("heating"), '_').c_str(), doc); return this->publish(this->makeConfigTopic(FPSTR(HA_ENTITY_CLIMATE), F("heating"), '_').c_str(), doc);
} }
bool publishClimateDhw(UnitSystem unit = UnitSystem::METRIC, byte minTemp = 40, byte maxTemp = 60, bool enabledByDefault = true) { bool publishClimateDhw(UnitSystem unit = UnitSystem::METRIC, uint8_t minTemp = 40, uint8_t maxTemp = 60, bool enabledByDefault = true) {
JsonDocument doc; JsonDocument doc;
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str(); doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault; doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;

View File

@@ -486,6 +486,7 @@ protected:
void publishHaEntities() { void publishHaEntities() {
// heating // heating
this->haHelper->publishSwitchHeatingTurbo(false); this->haHelper->publishSwitchHeatingTurbo(false);
this->haHelper->publishSwitchHeatingHysteresis();
this->haHelper->publishInputHeatingHysteresis(settings.system.unitSystem); this->haHelper->publishInputHeatingHysteresis(settings.system.unitSystem);
this->haHelper->publishInputHeatingTurboFactor(false); this->haHelper->publishInputHeatingTurboFactor(false);
this->haHelper->publishInputHeatingMinTemp(settings.system.unitSystem); this->haHelper->publishInputHeatingMinTemp(settings.system.unitSystem);
@@ -557,7 +558,7 @@ protected:
} }
bool publishNonStaticHaEntities(bool force = false) { bool publishNonStaticHaEntities(bool force = false) {
static byte _heatingMinTemp, _heatingMaxTemp, _dhwMinTemp, _dhwMaxTemp = 0; static uint8_t _heatingMinTemp, _heatingMaxTemp, _dhwMinTemp, _dhwMaxTemp = 0;
static bool _indoorTempControl, _dhwSupport = false; static bool _indoorTempControl, _dhwSupport = false;
bool published = false; bool published = false;

View File

@@ -19,8 +19,8 @@ protected:
CustomOpenTherm* instance = nullptr; CustomOpenTherm* instance = nullptr;
unsigned long instanceCreatedTime = 0; unsigned long instanceCreatedTime = 0;
byte instanceInGpio = 0; uint8_t instanceInGpio = 0;
byte instanceOutGpio = 0; uint8_t instanceOutGpio = 0;
bool initialized = false; bool initialized = false;
unsigned long connectedTime = 0; unsigned long connectedTime = 0;
unsigned long disconnectedTime = 0; unsigned long disconnectedTime = 0;
@@ -31,7 +31,7 @@ protected:
unsigned long heatingSetTempTime = 0; unsigned long heatingSetTempTime = 0;
unsigned long dhwSetTempTime = 0; unsigned long dhwSetTempTime = 0;
unsigned long ch2SetTempTime = 0; unsigned long ch2SetTempTime = 0;
byte configuredRxLedGpio = GPIO_IS_NOT_CONFIGURED; uint8_t configuredRxLedGpio = GPIO_IS_NOT_CONFIGURED;
#if defined(ARDUINO_ARCH_ESP32) #if defined(ARDUINO_ARCH_ESP32)
const char* getTaskName() override { const char* getTaskName() override {
@@ -90,7 +90,7 @@ protected:
Log.sinfoln(FPSTR(L_OT), F("Started. GPIO IN: %hhu, GPIO OUT: %hhu"), settings.opentherm.inGpio, settings.opentherm.outGpio); Log.sinfoln(FPSTR(L_OT), F("Started. GPIO IN: %hhu, GPIO OUT: %hhu"), settings.opentherm.inGpio, settings.opentherm.outGpio);
this->instance->setAfterSendRequestCallback([this](unsigned long request, unsigned long response, OpenThermResponseStatus status, byte attempt) { this->instance->setAfterSendRequestCallback([this](unsigned long request, unsigned long response, OpenThermResponseStatus status, uint8_t attempt) {
Log.sverboseln( Log.sverboseln(
FPSTR(L_OT), FPSTR(L_OT),
F("ID: %4d Request: %8lx Response: %8lx Msg type: %s Attempt: %2d Status: %s"), F("ID: %4d Request: %8lx Response: %8lx Msg type: %s Attempt: %2d Status: %s"),
@@ -171,7 +171,7 @@ protected:
vars.master.heating.enabled = this->isReady() vars.master.heating.enabled = this->isReady()
&& settings.heating.enabled && settings.heating.enabled
&& vars.cascadeControl.input && vars.cascadeControl.input
&& !vars.master.heating.blocking && (!vars.master.heating.blocking || settings.heating.hysteresis.action != HysteresisAction::DISABLE_HEATING)
&& !vars.master.heating.overheat; && !vars.master.heating.overheat;
// DHW settings // DHW settings

View File

@@ -59,12 +59,23 @@ protected:
this->turbo(); this->turbo();
this->hysteresis(); this->hysteresis();
vars.master.heating.targetTemp = settings.heating.target; if (vars.master.heating.blocking && settings.heating.hysteresis.action == HysteresisAction::SET_ZERO_TARGET) {
vars.master.heating.setpointTemp = roundf(constrain( vars.master.heating.targetTemp = 0.0f;
this->getHeatingSetpointTemp(), vars.master.heating.setpointTemp = 0.0f;
this->getHeatingMinSetpointTemp(),
this->getHeatingMaxSetpointTemp() // tick if PID enabled
), 0); if (settings.pid.enabled) {
this->getHeatingSetpointTemp();
}
} else {
vars.master.heating.targetTemp = settings.heating.target;
vars.master.heating.setpointTemp = roundf(constrain(
this->getHeatingSetpointTemp(),
this->getHeatingMinSetpointTemp(),
this->getHeatingMaxSetpointTemp()
), 0);
}
Sensors::setValueByType( Sensors::setValueByType(
Sensors::Type::HEATING_SETPOINT_TEMP, vars.master.heating.setpointTemp, Sensors::Type::HEATING_SETPOINT_TEMP, vars.master.heating.setpointTemp,
@@ -92,15 +103,15 @@ protected:
void hysteresis() { void hysteresis() {
bool useHyst = false; bool useHyst = false;
if (settings.heating.hysteresis > 0.01f && this->indoorSensorsConnected) { if (settings.heating.hysteresis.enabled && this->indoorSensorsConnected) {
useHyst = settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeHeatingControl; useHyst = settings.equitherm.enabled || settings.pid.enabled || settings.opentherm.options.nativeHeatingControl;
} }
if (useHyst) { if (useHyst) {
if (!vars.master.heating.blocking && vars.master.heating.indoorTemp - settings.heating.target + 0.0001f >= settings.heating.hysteresis) { if (!vars.master.heating.blocking && vars.master.heating.indoorTemp - settings.heating.target + 0.0001f >= settings.heating.hysteresis.value) {
vars.master.heating.blocking = true; vars.master.heating.blocking = true;
} else if (vars.master.heating.blocking && vars.master.heating.indoorTemp - settings.heating.target - 0.0001f <= -(settings.heating.hysteresis)) { } else if (vars.master.heating.blocking && vars.master.heating.indoorTemp - settings.heating.target - 0.0001f <= -(settings.heating.hysteresis.value)) {
vars.master.heating.blocking = false; vars.master.heating.blocking = false;
} }
@@ -213,7 +224,8 @@ protected:
}*/ }*/
float error = pidRegulator.setpoint - pidRegulator.input; float error = pidRegulator.setpoint - pidRegulator.input;
bool hasDeadband = (error > -(settings.pid.deadband.thresholdHigh)) bool hasDeadband = settings.pid.deadband.enabled
&& (error > -(settings.pid.deadband.thresholdHigh))
&& (error < settings.pid.deadband.thresholdLow); && (error < settings.pid.deadband.thresholdLow);
if (hasDeadband) { if (hasDeadband) {

View File

@@ -334,7 +334,7 @@ public:
uint8_t valueId = (uint8_t) valueType; uint8_t valueId = (uint8_t) valueType;
if (!isValidValueId(valueId)) { if (!isValidValueId(valueId)) {
return false; return 0;
} }
float value = 0.0f; float value = 0.0f;

View File

@@ -385,7 +385,7 @@ protected:
continue; continue;
} }
const float sensorResistance = value > 0.001f const float sensorResistance = value > 1
? DEFAULT_NTC_REF_RESISTANCE / (DEFAULT_NTC_VREF / (float) value - 1.0f) ? DEFAULT_NTC_REF_RESISTANCE / (DEFAULT_NTC_VREF / (float) value - 1.0f)
: 0.0f; : 0.0f;
const float rawTemp = 1.0f / ( const float rawTemp = 1.0f / (
@@ -577,7 +577,7 @@ protected:
bool subscribeToBleDevice(const uint8_t sensorId, NimBLEClient* pClient) { bool subscribeToBleDevice(const uint8_t sensorId, NimBLEClient* pClient) {
auto& sSensor = Sensors::settings[sensorId]; auto& sSensor = Sensors::settings[sensorId];
auto pAddress = pClient->getPeerAddress().toString().c_str(); auto pAddress = pClient->getPeerAddress().toString();
NimBLERemoteService* pService = nullptr; NimBLERemoteService* pService = nullptr;
NimBLERemoteCharacteristic* pChar = nullptr; NimBLERemoteCharacteristic* pChar = nullptr;
@@ -588,13 +588,13 @@ protected:
if (!pService) { if (!pService) {
Log.straceln( Log.straceln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to find env service (%s) on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to find env service (%s) on device %s"),
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
); );
} else { } else {
Log.straceln( Log.straceln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found env service (%s) on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found env service (%s) on device %s"),
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
); );
// 0x2A6E - Notify temperature x0.01C (pvvx) // 0x2A6E - Notify temperature x0.01C (pvvx)
@@ -606,7 +606,7 @@ protected:
if (pChar && (pChar->canNotify() || pChar->canIndicate())) { if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
Log.straceln( Log.straceln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found temp char (%s) in env service on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found temp char (%s) in env service on device %s"),
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
); );
pChar->unsubscribe(); pChar->unsubscribe();
@@ -661,14 +661,14 @@ protected:
Log.straceln( Log.straceln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to temp char (%s) in env service on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to temp char (%s) in env service on device %s"),
sensorId, sSensor.name, sensorId, sSensor.name,
charUuid.toString().c_str(), pAddress charUuid.toString().c_str(), pAddress.c_str()
); );
} else { } else {
Log.swarningln( Log.swarningln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to temp char (%s) in env service on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to temp char (%s) in env service on device %s"),
sensorId, sSensor.name, sensorId, sSensor.name,
charUuid.toString().c_str(), pAddress charUuid.toString().c_str(), pAddress.c_str()
); );
} }
} }
@@ -683,7 +683,7 @@ protected:
if (pChar && (pChar->canNotify() || pChar->canIndicate())) { if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
Log.straceln( Log.straceln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found temp char (%s) in env service on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found temp char (%s) in env service on device %s"),
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
); );
pChar->unsubscribe(); pChar->unsubscribe();
@@ -738,14 +738,14 @@ protected:
Log.straceln( Log.straceln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to temp char (%s) in env service on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to temp char (%s) in env service on device %s"),
sensorId, sSensor.name, sensorId, sSensor.name,
charUuid.toString().c_str(), pAddress charUuid.toString().c_str(), pAddress.c_str()
); );
} else { } else {
Log.swarningln( Log.swarningln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to temp char (%s) in env service on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to temp char (%s) in env service on device %s"),
sensorId, sSensor.name, sensorId, sSensor.name,
charUuid.toString().c_str(), pAddress charUuid.toString().c_str(), pAddress.c_str()
); );
} }
} }
@@ -754,7 +754,7 @@ protected:
if (!tempNotifyCreated) { if (!tempNotifyCreated) {
Log.swarningln( Log.swarningln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported temp chars in env service on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported temp chars in env service on device %s"),
sensorId, sSensor.name, pAddress sensorId, sSensor.name, pAddress.c_str()
); );
pClient->disconnect(); pClient->disconnect();
@@ -772,7 +772,7 @@ protected:
if (pChar && (pChar->canNotify() || pChar->canIndicate())) { if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
Log.straceln( Log.straceln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found humidity char (%s) in env service on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found humidity char (%s) in env service on device %s"),
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
); );
pChar->unsubscribe(); pChar->unsubscribe();
@@ -827,14 +827,14 @@ protected:
Log.straceln( Log.straceln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to humidity char (%s) in env service on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to humidity char (%s) in env service on device %s"),
sensorId, sSensor.name, sensorId, sSensor.name,
charUuid.toString().c_str(), pAddress charUuid.toString().c_str(), pAddress.c_str()
); );
} else { } else {
Log.swarningln( Log.swarningln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to humidity char (%s) in env service on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to humidity char (%s) in env service on device %s"),
sensorId, sSensor.name, sensorId, sSensor.name,
charUuid.toString().c_str(), pAddress charUuid.toString().c_str(), pAddress.c_str()
); );
} }
} }
@@ -843,7 +843,7 @@ protected:
if (!humidityNotifyCreated) { if (!humidityNotifyCreated) {
Log.swarningln( Log.swarningln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported humidity chars in env service on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported humidity chars in env service on device %s"),
sensorId, sSensor.name, pAddress sensorId, sSensor.name, pAddress.c_str()
); );
} }
} }
@@ -857,13 +857,13 @@ protected:
if (!pService) { if (!pService) {
Log.straceln( Log.straceln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to find battery service (%s) on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to find battery service (%s) on device %s"),
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
); );
} else { } else {
Log.straceln( Log.straceln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found battery service (%s) on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found battery service (%s) on device %s"),
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
); );
// 0x2A19 - Notify the battery charge level 0..99% (pvvx) // 0x2A19 - Notify the battery charge level 0..99% (pvvx)
@@ -875,7 +875,7 @@ protected:
if (pChar && (pChar->canNotify() || pChar->canIndicate())) { if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
Log.straceln( Log.straceln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found battery char (%s) in battery service on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found battery char (%s) in battery service on device %s"),
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
); );
pChar->unsubscribe(); pChar->unsubscribe();
@@ -930,14 +930,14 @@ protected:
Log.straceln( Log.straceln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to battery char (%s) in battery service on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to battery char (%s) in battery service on device %s"),
sensorId, sSensor.name, sensorId, sSensor.name,
charUuid.toString().c_str(), pAddress charUuid.toString().c_str(), pAddress.c_str()
); );
} else { } else {
Log.swarningln( Log.swarningln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to battery char (%s) in battery service on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to battery char (%s) in battery service on device %s"),
sensorId, sSensor.name, sensorId, sSensor.name,
charUuid.toString().c_str(), pAddress charUuid.toString().c_str(), pAddress.c_str()
); );
} }
} }
@@ -946,7 +946,7 @@ protected:
if (!batteryNotifyCreated) { if (!batteryNotifyCreated) {
Log.swarningln( Log.swarningln(
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported battery chars in battery service on device %s"), FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported battery chars in battery service on device %s"),
sensorId, sSensor.name, pAddress sensorId, sSensor.name, pAddress.c_str()
); );
} }
} }

View File

@@ -12,13 +12,13 @@ struct NetworkSettings {
struct { struct {
char ssid[33] = DEFAULT_AP_SSID; char ssid[33] = DEFAULT_AP_SSID;
char password[65] = DEFAULT_AP_PASSWORD; char password[65] = DEFAULT_AP_PASSWORD;
byte channel = 6; uint8_t channel = 6;
} ap; } ap;
struct { struct {
char ssid[33] = DEFAULT_STA_SSID; char ssid[33] = DEFAULT_STA_SSID;
char password[65] = DEFAULT_STA_PASSWORD; char password[65] = DEFAULT_STA_PASSWORD;
byte channel = 0; uint8_t channel = 0;
} sta; } sta;
} networkSettings; } networkSettings;
@@ -42,7 +42,7 @@ struct Settings {
} ntp; } ntp;
UnitSystem unitSystem = UnitSystem::METRIC; UnitSystem unitSystem = UnitSystem::METRIC;
byte statusLedGpio = DEFAULT_STATUS_LED_GPIO; uint8_t statusLedGpio = DEFAULT_STATUS_LED_GPIO;
} system; } system;
struct { struct {
@@ -54,9 +54,9 @@ struct Settings {
struct { struct {
UnitSystem unitSystem = UnitSystem::METRIC; UnitSystem unitSystem = UnitSystem::METRIC;
byte inGpio = DEFAULT_OT_IN_GPIO; uint8_t inGpio = DEFAULT_OT_IN_GPIO;
byte outGpio = DEFAULT_OT_OUT_GPIO; uint8_t outGpio = DEFAULT_OT_OUT_GPIO;
byte rxLedGpio = DEFAULT_OT_RX_LED_GPIO; uint8_t rxLedGpio = DEFAULT_OT_RX_LED_GPIO;
uint8_t memberId = 0; uint8_t memberId = 0;
uint8_t flags = 0; uint8_t flags = 0;
float minPower = 0.0f; float minPower = 0.0f;
@@ -103,12 +103,17 @@ struct Settings {
bool enabled = true; bool enabled = true;
bool turbo = false; bool turbo = false;
float target = DEFAULT_HEATING_TARGET_TEMP; float target = DEFAULT_HEATING_TARGET_TEMP;
float hysteresis = 0.5f;
float turboFactor = 7.5f; float turboFactor = 7.5f;
byte minTemp = DEFAULT_HEATING_MIN_TEMP; uint8_t minTemp = DEFAULT_HEATING_MIN_TEMP;
byte maxTemp = DEFAULT_HEATING_MAX_TEMP; uint8_t maxTemp = DEFAULT_HEATING_MAX_TEMP;
uint8_t maxModulation = 100; uint8_t maxModulation = 100;
struct {
bool enabled = true;
float value = 0.5f;
HysteresisAction action = HysteresisAction::DISABLE_HEATING;
} hysteresis;
struct { struct {
uint8_t highTemp = 95; uint8_t highTemp = 95;
uint8_t lowTemp = 90; uint8_t lowTemp = 90;
@@ -123,8 +128,8 @@ struct Settings {
struct { struct {
bool enabled = true; bool enabled = true;
float target = DEFAULT_DHW_TARGET_TEMP; float target = DEFAULT_DHW_TARGET_TEMP;
byte minTemp = DEFAULT_DHW_MIN_TEMP; uint8_t minTemp = DEFAULT_DHW_MIN_TEMP;
byte maxTemp = DEFAULT_DHW_MAX_TEMP; uint8_t maxTemp = DEFAULT_DHW_MAX_TEMP;
uint8_t maxModulation = 100; uint8_t maxModulation = 100;
struct { struct {
@@ -161,7 +166,7 @@ struct Settings {
struct { struct {
bool use = false; bool use = false;
byte gpio = DEFAULT_EXT_PUMP_GPIO; uint8_t gpio = DEFAULT_EXT_PUMP_GPIO;
unsigned short postCirculationTime = 600; unsigned short postCirculationTime = 600;
unsigned int antiStuckInterval = 2592000; unsigned int antiStuckInterval = 2592000;
unsigned short antiStuckTime = 300; unsigned short antiStuckTime = 300;
@@ -170,15 +175,15 @@ struct Settings {
struct { struct {
struct { struct {
bool enabled = false; bool enabled = false;
byte gpio = GPIO_IS_NOT_CONFIGURED; uint8_t gpio = GPIO_IS_NOT_CONFIGURED;
byte invertState = false; bool invertState = false;
unsigned short thresholdTime = 60; unsigned short thresholdTime = 60;
} input; } input;
struct { struct {
bool enabled = false; bool enabled = false;
byte gpio = GPIO_IS_NOT_CONFIGURED; uint8_t gpio = GPIO_IS_NOT_CONFIGURED;
byte invertState = false; bool invertState = false;
unsigned short thresholdTime = 60; unsigned short thresholdTime = 60;
bool onFault = true; bool onFault = true;
bool onLossConnection = true; bool onLossConnection = true;

View File

@@ -163,4 +163,9 @@ enum class UnitSystem : uint8_t {
IMPERIAL = 1 IMPERIAL = 1
}; };
enum class HysteresisAction : uint8_t {
DISABLE_HEATING = 0,
SET_ZERO_TARGET = 1
};
char buffer[255]; char buffer[255];

View File

@@ -34,6 +34,7 @@ const char L_CASCADE_OUTPUT[] PROGMEM = "CASCADE.OUTPUT";
const char L_EXTPUMP[] PROGMEM = "EXTPUMP"; const char L_EXTPUMP[] PROGMEM = "EXTPUMP";
const char S_ACTION[] PROGMEM = "action";
const char S_ACTIONS[] PROGMEM = "actions"; const char S_ACTIONS[] PROGMEM = "actions";
const char S_ACTIVE[] PROGMEM = "active"; const char S_ACTIVE[] PROGMEM = "active";
const char S_ADDRESS[] PROGMEM = "address"; const char S_ADDRESS[] PROGMEM = "address";

View File

@@ -72,7 +72,7 @@ time_t mkgmtime(const struct tm *ptm) {
inline bool isDigit(const char* ptr) { inline bool isDigit(const char* ptr) {
char* endPtr; char* endPtr;
strtol(ptr, &endPtr, 10); auto tmp = strtol(ptr, &endPtr, 10);
return *endPtr == 0; return *endPtr == 0;
} }
@@ -490,7 +490,9 @@ void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
heating[FPSTR(S_ENABLED)] = src.heating.enabled; heating[FPSTR(S_ENABLED)] = src.heating.enabled;
heating[FPSTR(S_TURBO)] = src.heating.turbo; heating[FPSTR(S_TURBO)] = src.heating.turbo;
heating[FPSTR(S_TARGET)] = roundf(src.heating.target, 2); heating[FPSTR(S_TARGET)] = roundf(src.heating.target, 2);
heating[FPSTR(S_HYSTERESIS)] = roundf(src.heating.hysteresis, 3); 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_TURBO_FACTOR)] = roundf(src.heating.turboFactor, 3); heating[FPSTR(S_TURBO_FACTOR)] = roundf(src.heating.turboFactor, 3);
heating[FPSTR(S_MIN_TEMP)] = src.heating.minTemp; heating[FPSTR(S_MIN_TEMP)] = src.heating.minTemp;
heating[FPSTR(S_MAX_TEMP)] = src.heating.maxTemp; heating[FPSTR(S_MAX_TEMP)] = src.heating.maxTemp;
@@ -1303,15 +1305,41 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
} }
} }
if (!src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)].isNull()) { if (src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_ENABLED)].is<bool>()) {
float value = src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)].as<float>(); bool value = src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_ENABLED)].as<bool>();
if (value >= 0.0f && value <= 15.0f && fabsf(value - dst.heating.hysteresis) > 0.0001f) { if (value != dst.heating.hysteresis.enabled) {
dst.heating.hysteresis = roundf(value, 2); dst.heating.hysteresis.enabled = value;
changed = true; changed = true;
} }
} }
if (!src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_VALUE)].isNull()) {
float value = src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_VALUE)].as<float>();
if (value >= 0.0f && value <= 15.0f && fabsf(value - dst.heating.hysteresis.value) > 0.0001f) {
dst.heating.hysteresis.value = roundf(value, 2);
changed = true;
}
}
if (!src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_ACTION)].isNull()) {
uint8_t value = src[FPSTR(S_HEATING)][FPSTR(S_HYSTERESIS)][FPSTR(S_ACTION)].as<uint8_t>();
switch (value) {
case static_cast<uint8_t>(HysteresisAction::DISABLE_HEATING):
case static_cast<uint8_t>(HysteresisAction::SET_ZERO_TARGET):
if (static_cast<uint8_t>(dst.heating.hysteresis.action) != value) {
dst.heating.hysteresis.action = static_cast<HysteresisAction>(value);
changed = true;
}
break;
default:
break;
}
}
if (!src[FPSTR(S_HEATING)][FPSTR(S_TURBO_FACTOR)].isNull()) { if (!src[FPSTR(S_HEATING)][FPSTR(S_TURBO_FACTOR)].isNull()) {
float value = src[FPSTR(S_HEATING)][FPSTR(S_TURBO_FACTOR)].as<float>(); float value = src[FPSTR(S_HEATING)][FPSTR(S_TURBO_FACTOR)].as<float>();
@@ -1324,7 +1352,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
if (!src[FPSTR(S_HEATING)][FPSTR(S_MIN_TEMP)].isNull()) { if (!src[FPSTR(S_HEATING)][FPSTR(S_MIN_TEMP)].isNull()) {
unsigned char value = src[FPSTR(S_HEATING)][FPSTR(S_MIN_TEMP)].as<unsigned char>(); unsigned char value = src[FPSTR(S_HEATING)][FPSTR(S_MIN_TEMP)].as<unsigned char>();
if (value != dst.heating.minTemp && value >= vars.slave.heating.minTemp && value < vars.slave.heating.maxTemp && value != dst.heating.minTemp) { if (value != dst.heating.minTemp && value >= vars.slave.heating.minTemp && value < vars.slave.heating.maxTemp && value != dst.heating.maxTemp) {
dst.heating.minTemp = value; dst.heating.minTemp = value;
changed = true; changed = true;
} }
@@ -1333,7 +1361,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
if (!src[FPSTR(S_HEATING)][FPSTR(S_MAX_TEMP)].isNull()) { if (!src[FPSTR(S_HEATING)][FPSTR(S_MAX_TEMP)].isNull()) {
unsigned char value = src[FPSTR(S_HEATING)][FPSTR(S_MAX_TEMP)].as<unsigned char>(); unsigned char value = src[FPSTR(S_HEATING)][FPSTR(S_MAX_TEMP)].as<unsigned char>();
if (value != dst.heating.maxTemp && value > vars.slave.heating.minTemp && value <= vars.slave.heating.maxTemp && value != dst.heating.maxTemp) { if (value != dst.heating.maxTemp && value > vars.slave.heating.minTemp && value <= vars.slave.heating.maxTemp && value != dst.heating.minTemp) {
dst.heating.maxTemp = value; dst.heating.maxTemp = value;
changed = true; changed = true;
} }
@@ -1894,7 +1922,7 @@ bool jsonToSensorSettings(const uint8_t sensorId, const JsonVariantConst src, Se
// gpio // gpio
if (!src[FPSTR(S_GPIO)].isNull()) { if (!src[FPSTR(S_GPIO)].isNull()) {
if (dst.type != Sensors::Type::DALLAS_TEMP && dst.type == Sensors::Type::BLUETOOTH && dst.type == Sensors::Type::NTC_10K_TEMP) { if (dst.type != Sensors::Type::DALLAS_TEMP && dst.type != Sensors::Type::NTC_10K_TEMP) {
if (dst.gpio != GPIO_IS_NOT_CONFIGURED) { if (dst.gpio != GPIO_IS_NOT_CONFIGURED) {
dst.gpio = GPIO_IS_NOT_CONFIGURED; dst.gpio = GPIO_IS_NOT_CONFIGURED;
changed = true; changed = true;

View File

@@ -192,21 +192,48 @@
</div> </div>
<div class="grid"> <div class="grid">
<label>
<span data-i18n>settings.heating.hyst</span>
<input type="number" inputmode="decimal" name="heating[hysteresis]" min="0" max="5" step="0.05" required>
</label>
<label> <label>
<span data-i18n>settings.heating.turboFactor</span> <span data-i18n>settings.heating.turboFactor</span>
<input type="number" inputmode="decimal" name="heating[turboFactor]" min="1.5" max="10" step="0.1" required> <input type="number" inputmode="decimal" name="heating[turboFactor]" min="1.5" max="10" step="0.1" required>
</label> </label>
<label>
<span data-i18n>settings.maxModulation</span>
<input type="number" inputmode="numeric" name="heating[maxModulation]" min="1" max="100" step="1" required>
</label>
</div> </div>
<label> <hr />
<span data-i18n>settings.maxModulation</span>
<input type="number" inputmode="numeric" name="heating[maxModulation]" min="1" max="100" step="1" required> <details>
</label> <summary><b data-i18n>settings.heating.hyst.title</b></summary>
<div>
<fieldset>
<label>
<input type="checkbox" name="heating[hysteresis][enabled]" value="true">
<span data-i18n>settings.enable</span>
</label>
</fieldset>
<div class="grid">
<label>
<span data-i18n>settings.heating.hyst.value</span>
<input type="number" inputmode="decimal" name="heating[hysteresis][value]" min="0" max="5" step="0.05" required>
</label>
<label>
<span data-i18n>settings.heating.hyst.action.title</span>
<select name="heating[hysteresis][action]">
<option value="0" data-i18n>settings.heating.hyst.action.disableHeating</option>
<option value="1" data-i18n>settings.heating.hyst.action.set0target</option>
</select>
</label>
</div>
</div>
<small data-i18n>settings.heating.hyst.desc</small>
</details>
<hr /> <hr />
@@ -956,7 +983,9 @@
"min": data.system.unitSystem == 0 ? 1 : 33, "min": data.system.unitSystem == 0 ? 1 : 33,
"max": data.system.unitSystem == 0 ? 100 : 212 "max": data.system.unitSystem == 0 ? 100 : 212
}); });
setInputValue("[name='heating[hysteresis]']", data.heating.hysteresis); 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[turboFactor]']", data.heating.turboFactor); setInputValue("[name='heating[turboFactor]']", data.heating.turboFactor);
setInputValue("[name='heating[maxModulation]']", data.heating.maxModulation); setInputValue("[name='heating[maxModulation]']", data.heating.maxModulation);
setInputValue("[name='heating[overheatProtection][highTemp]']", data.heating.overheatProtection.highTemp, { setInputValue("[name='heating[overheatProtection][highTemp]']", data.heating.overheatProtection.highTemp, {