mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-11 02:34:29 +05:00
feat: ability to use return heat carrier temp as indoor temp
This commit is contained in:
@@ -185,10 +185,14 @@ protected:
|
||||
} else if (vars.states.otStatus && millis() - this->lastSuccessResponse > 1150) {
|
||||
Log.swarningln(FPSTR(L_OT), F("Disconnected"));
|
||||
|
||||
if (settings.sensors.outdoor.type == SensorType::BOILER) {
|
||||
if (settings.sensors.outdoor.type == SensorType::BOILER_OUTDOOR) {
|
||||
vars.sensors.outdoor.connected = false;
|
||||
}
|
||||
|
||||
if (settings.sensors.indoor.type == SensorType::BOILER_RETURN) {
|
||||
vars.sensors.indoor.connected = false;
|
||||
}
|
||||
|
||||
vars.states.otStatus = false;
|
||||
this->isInitialized = false;
|
||||
}
|
||||
@@ -396,7 +400,7 @@ protected:
|
||||
// update these parameters once a minute
|
||||
if (!settings.opentherm.filterNumValues.enable) {
|
||||
// Get outdoor temp (if necessary)
|
||||
if (settings.sensors.outdoor.type == SensorType::BOILER) {
|
||||
if (settings.sensors.outdoor.type == SensorType::BOILER_OUTDOOR) {
|
||||
if (this->updateOutdoorTemp()) {
|
||||
if (!vars.sensors.outdoor.connected) {
|
||||
vars.sensors.outdoor.connected = true;
|
||||
@@ -486,9 +490,21 @@ protected:
|
||||
|
||||
// Get heating return temp
|
||||
if (this->updateHeatingReturnTemp()) {
|
||||
if (settings.sensors.indoor.type == SensorType::BOILER_RETURN) {
|
||||
vars.temperatures.indoor = settings.sensors.outdoor.offset + vars.temperatures.heatingReturn;
|
||||
|
||||
if (!vars.sensors.outdoor.connected) {
|
||||
vars.sensors.indoor.connected = true;
|
||||
}
|
||||
}
|
||||
|
||||
Log.snoticeln(FPSTR(L_OT_HEATING), F("Received return temp: %.2f"), vars.temperatures.heatingReturn);
|
||||
|
||||
} else {
|
||||
if (settings.sensors.indoor.type == SensorType::BOILER_RETURN && vars.sensors.outdoor.connected) {
|
||||
vars.sensors.indoor.connected = false;
|
||||
}
|
||||
|
||||
Log.swarningln(FPSTR(L_OT_HEATING), F("Failed receive return temp"));
|
||||
}
|
||||
|
||||
@@ -504,7 +520,7 @@ protected:
|
||||
// must be updated every time.
|
||||
if (settings.opentherm.filterNumValues.enable) {
|
||||
// Get outdoor temp (if necessary)
|
||||
if (settings.sensors.outdoor.type == SensorType::BOILER) {
|
||||
if (settings.sensors.outdoor.type == SensorType::BOILER_OUTDOOR) {
|
||||
if (this->updateOutdoorTemp()) {
|
||||
if (!vars.sensors.outdoor.connected) {
|
||||
vars.sensors.outdoor.connected = true;
|
||||
|
||||
@@ -126,7 +126,7 @@ struct Settings {
|
||||
|
||||
struct {
|
||||
struct {
|
||||
SensorType type = SensorType::BOILER;
|
||||
SensorType type = SensorType::BOILER_OUTDOOR;
|
||||
byte gpio = DEFAULT_SENSOR_OUTDOOR_GPIO;
|
||||
uint8_t bleAddress[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
float offset = 0.0f;
|
||||
|
||||
@@ -147,10 +147,11 @@
|
||||
#define GPIO_IS_VALID(gpioNum) (gpioNum != GPIO_IS_NOT_CONFIGURED && GPIO_IS_VALID_GPIO(gpioNum))
|
||||
|
||||
enum class SensorType : byte {
|
||||
BOILER,
|
||||
MANUAL,
|
||||
DS18B20,
|
||||
BLUETOOTH
|
||||
BOILER_OUTDOOR = 0,
|
||||
BOILER_RETURN = 4,
|
||||
MANUAL = 1,
|
||||
DS18B20 = 2,
|
||||
BLUETOOTH = 3
|
||||
};
|
||||
|
||||
enum class UnitSystem : byte {
|
||||
|
||||
17
src/utils.h
17
src/utils.h
@@ -1178,9 +1178,9 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
||||
byte value = src["sensors"]["outdoor"]["type"].as<unsigned char>();
|
||||
|
||||
switch (value) {
|
||||
case static_cast<byte>(SensorType::BOILER):
|
||||
if (dst.sensors.outdoor.type != SensorType::BOILER) {
|
||||
dst.sensors.outdoor.type = SensorType::BOILER;
|
||||
case static_cast<byte>(SensorType::BOILER_OUTDOOR):
|
||||
if (dst.sensors.outdoor.type != SensorType::BOILER_OUTDOOR) {
|
||||
dst.sensors.outdoor.type = SensorType::BOILER_OUTDOOR;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
@@ -1248,7 +1248,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
||||
if (!src["sensors"]["outdoor"]["offset"].isNull()) {
|
||||
float value = src["sensors"]["outdoor"]["offset"].as<float>();
|
||||
|
||||
if (value >= -10 && value <= 10 && fabs(value - dst.sensors.outdoor.offset) > 0.0001f) {
|
||||
if (value >= -20.0f && value <= 20.0f && fabs(value - dst.sensors.outdoor.offset) > 0.0001f) {
|
||||
dst.sensors.outdoor.offset = roundd(value, 2);
|
||||
changed = true;
|
||||
}
|
||||
@@ -1258,6 +1258,13 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
||||
byte value = src["sensors"]["indoor"]["type"].as<unsigned char>();
|
||||
|
||||
switch (value) {
|
||||
case static_cast<byte>(SensorType::BOILER_RETURN):
|
||||
if (dst.sensors.indoor.type != SensorType::BOILER_RETURN) {
|
||||
dst.sensors.indoor.type = SensorType::BOILER_RETURN;
|
||||
changed = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case static_cast<byte>(SensorType::MANUAL):
|
||||
if (dst.sensors.indoor.type != SensorType::MANUAL) {
|
||||
dst.sensors.indoor.type = SensorType::MANUAL;
|
||||
@@ -1321,7 +1328,7 @@ bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false
|
||||
if (!src["sensors"]["indoor"]["offset"].isNull()) {
|
||||
float value = src["sensors"]["indoor"]["offset"].as<float>();
|
||||
|
||||
if (value >= -10 && value <= 10 && fabs(value - dst.sensors.indoor.offset) > 0.0001f) {
|
||||
if (value >= -20.0f && value <= 20.0f && fabs(value - dst.sensors.indoor.offset) > 0.0001f) {
|
||||
dst.sensors.indoor.offset = roundd(value, 2);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user