mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-12 03:04:27 +05:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c0dfc544e | ||
|
|
5fba94312b | ||
|
|
62bea87f8a | ||
|
|
f52aa8e889 | ||
|
|
df8354866f | ||
|
|
6242db7a29 | ||
|
|
dc00fdcdb6 | ||
|
|
2615e9106e | ||
|
|
0f60a07a71 | ||
|
|
f8750373d4 | ||
|
|
d5a92c47c7 | ||
|
|
bc91168bbf | ||
|
|
96c1a187cd |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
.pio
|
||||
.vscode
|
||||
.vscode
|
||||
build/*
|
||||
@@ -33,6 +33,10 @@
|
||||
| BAXI ECO Nova | default | Pressure sensor not supported, modulation level not stable |
|
||||
| BAXI Ampera | 1028 | Pressure sensor not supported, only heating (DHW not tested) |
|
||||
| [Remeha Calenta Ace 40C](https://github.com/Laxilef/OTGateway/issues/1#issuecomment-1726081554) | default | - |
|
||||
| [Baxi Nuvola DUO-TEC HT 16](https://github.com/Laxilef/OTGateway/issues/3#issuecomment-1751061488) | default | - |
|
||||
| [AEG GBA124](https://github.com/Laxilef/OTGateway/issues/3#issuecomment-1765857609) | default | Pressure sensor not supported |
|
||||
| [Ferroli DOMIcompact C 24](https://github.com/Laxilef/OTGateway/issues/3#issuecomment-1765310058)<br><sub>Board: MF08FA</sub> | 211 | Pressure sensor not supported |
|
||||
| [Thermet Ecocondens Silver 35kW)](https://github.com/Laxilef/OTGateway/issues/3#issuecomment-1767026384) | default | Pressure sensor not supported |
|
||||
|
||||
## PCB
|
||||
<img src="/assets/pcb.svg" width="27%" /> <img src="/assets/pcb_3d.png" width="30%" /> <img src="/assets/after_assembly.png" width="40%" />
|
||||
|
||||
14
build.py
Normal file
14
build.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import shutil
|
||||
import os
|
||||
Import("env")
|
||||
|
||||
def post_build(source, target, env):
|
||||
src = target[0].get_abspath()
|
||||
dest = os.path.join(env["PROJECT_DIR"], "build", "firmware_%s_%s.bin" % (env.GetProjectOption("board"), env.GetProjectOption("version")))
|
||||
|
||||
#print("dest:"+dest)
|
||||
#print("source:"+src)
|
||||
|
||||
shutil.copy(src, dest)
|
||||
|
||||
env.AddPostAction("$BUILD_DIR/firmware.bin", post_build)
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
const byte valueLB = response & 0xFF;
|
||||
const byte valueHB = (response >> 8) & 0xFF;
|
||||
|
||||
float value = (int8_t) valueHB;
|
||||
float value = (int8_t)valueHB;
|
||||
return value + (float)valueLB / 256.0;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ public:
|
||||
const char* noChecked = "type=\"checkbox\"";
|
||||
const char* trueVal = "T";
|
||||
|
||||
CheckboxParameter(const char* id, const char* label, bool value): WiFiManagerParameter("") {
|
||||
CheckboxParameter(const char* id, const char* label, bool value) : WiFiManagerParameter("") {
|
||||
init(id, label, value ? trueVal : "0", 1, "", WFM_LABEL_AFTER);
|
||||
}
|
||||
|
||||
@@ -34,5 +34,5 @@ public:
|
||||
|
||||
class SeparatorParameter : public WiFiManagerParameter {
|
||||
public:
|
||||
SeparatorParameter(): WiFiManagerParameter("<hr>") {}
|
||||
SeparatorParameter() : WiFiManagerParameter("<hr>") {}
|
||||
};
|
||||
@@ -8,9 +8,8 @@
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:d1_mini_pro]
|
||||
[env]
|
||||
platform = espressif8266
|
||||
board = d1_mini_pro
|
||||
framework = arduino
|
||||
lib_deps =
|
||||
nrwiersma/ESP8266Scheduler@^1.0
|
||||
@@ -27,3 +26,14 @@ lib_deps =
|
||||
build_flags = -D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH
|
||||
upload_speed = 921600
|
||||
monitor_speed = 115200
|
||||
extra_scripts = post:build.py
|
||||
version = 1.3.2
|
||||
|
||||
[env:d1_mini]
|
||||
board = d1_mini
|
||||
|
||||
[env:d1_mini_lite]
|
||||
board = d1_mini_lite
|
||||
|
||||
[env:d1_mini_pro]
|
||||
board = d1_mini_pro
|
||||
|
||||
@@ -51,9 +51,6 @@ public:
|
||||
doc[F("options")][2] = F("External");
|
||||
|
||||
client.beginPublish((F("homeassistant/select/") + _prefix + F("/outdoor_sensor_type/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -81,9 +78,6 @@ public:
|
||||
doc[F("options")][1] = F("External");
|
||||
|
||||
client.beginPublish((F("homeassistant/select/") + _prefix + F("/indoor_sensor_type/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -182,9 +176,6 @@ public:
|
||||
doc[F("payload_off")] = F("{\"debug\": false}");
|
||||
|
||||
client.beginPublish((F("homeassistant/switch/") + _prefix + F("/debug/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -215,9 +206,6 @@ public:
|
||||
doc[F("payload_off")] = F("{\"emergency\": {\"enable\" : false}}");
|
||||
|
||||
client.beginPublish((F("homeassistant/switch/") + _prefix + F("/emergency/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -250,9 +238,6 @@ public:
|
||||
doc[F("mode")] = "box";
|
||||
|
||||
client.beginPublish((F("homeassistant/number/") + _prefix + F("/emergency_target/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -284,9 +269,6 @@ public:
|
||||
doc[F("payload_off")] = F("{\"emergency\": {\"useEquitherm\" : false}}");
|
||||
|
||||
client.beginPublish((F("homeassistant/switch/") + _prefix + F("/emergency_use_equitherm/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -318,9 +300,6 @@ public:
|
||||
doc[F("payload_off")] = F("{\"heating\": {\"enable\" : false}}");
|
||||
|
||||
client.beginPublish((F("homeassistant/switch/") + _prefix + F("/heating/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -351,9 +330,6 @@ public:
|
||||
doc[F("payload_off")] = F("{\"heating\": {\"turbo\" : false}}");
|
||||
|
||||
client.beginPublish((F("homeassistant/switch/") + _prefix + F("/heating_turbo/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -382,14 +358,11 @@ public:
|
||||
doc[F("command_topic")] = _prefix + F("/settings/set");
|
||||
doc[F("command_template")] = F("{\"heating\": {\"target\" : {{ value }}}}");
|
||||
doc[F("min")] = minTemp;
|
||||
doc[F("max")] = maxTemp <= minTemp ? maxTemp : maxTemp;
|
||||
doc[F("max")] = maxTemp;
|
||||
doc[F("step")] = 0.5;
|
||||
doc[F("mode")] = "box";
|
||||
|
||||
client.beginPublish((F("homeassistant/number/") + _prefix + F("/heating_target/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -422,9 +395,6 @@ public:
|
||||
doc[F("mode")] = "box";
|
||||
|
||||
client.beginPublish((F("homeassistant/number/") + _prefix + F("/heating_hysteresis/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -453,9 +423,6 @@ public:
|
||||
doc[F("value_template")] = F("{{ value_json.parameters.heatingSetpoint|int(0) }}");
|
||||
|
||||
client.beginPublish((F("homeassistant/sensor/") + _prefix + F("/heating_setpoint/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -607,9 +574,6 @@ public:
|
||||
doc[F("payload_off")] = F("{\"dhw\": {\"enable\" : false}}");
|
||||
|
||||
client.beginPublish((F("homeassistant/switch/") + _prefix + F("/dhw/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -643,9 +607,6 @@ public:
|
||||
doc[F("mode")] = "box";
|
||||
|
||||
client.beginPublish((F("homeassistant/number/") + _prefix + F("/dhw_target/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -796,9 +757,6 @@ public:
|
||||
doc[F("payload_off")] = F("{\"pid\": {\"enable\" : false}}");
|
||||
|
||||
client.beginPublish((F("homeassistant/switch/") + _prefix + F("/pid/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -828,9 +786,6 @@ public:
|
||||
doc[F("mode")] = "box";
|
||||
|
||||
client.beginPublish((F("homeassistant/number/") + _prefix + F("/pid_p_factor/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -860,9 +815,6 @@ public:
|
||||
doc[F("mode")] = "box";
|
||||
|
||||
client.beginPublish((F("homeassistant/number/") + _prefix + F("/pid_i_factor/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -892,9 +844,6 @@ public:
|
||||
doc[F("mode")] = "box";
|
||||
|
||||
client.beginPublish((F("homeassistant/number/") + _prefix + F("/pid_d_factor/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -989,9 +938,6 @@ public:
|
||||
doc[F("payload_off")] = F("{\"equitherm\": {\"enable\" : false}}");
|
||||
|
||||
client.beginPublish((F("homeassistant/switch/") + _prefix + F("/equitherm/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1021,9 +967,6 @@ public:
|
||||
doc[F("mode")] = "box";
|
||||
|
||||
client.beginPublish((F("homeassistant/number/") + _prefix + F("/equitherm_n_factor/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1053,9 +996,6 @@ public:
|
||||
doc[F("mode")] = "box";
|
||||
|
||||
client.beginPublish((F("homeassistant/number/") + _prefix + F("/equitherm_k_factor/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1087,9 +1027,6 @@ public:
|
||||
doc[F("mode")] = "box";
|
||||
|
||||
client.beginPublish((F("homeassistant/number/") + _prefix + F("/equitherm_t_factor/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1120,9 +1057,6 @@ public:
|
||||
doc[F("payload_off")] = F("{\"tuning\": {\"enable\" : false}}");
|
||||
|
||||
client.beginPublish((F("homeassistant/switch/") + _prefix + F("/tuning/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1152,9 +1086,6 @@ public:
|
||||
doc[F("options")][1] = F("PID");
|
||||
|
||||
client.beginPublish((F("homeassistant/select/") + _prefix + F("/tuning_regulator/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1182,9 +1113,6 @@ public:
|
||||
doc[F("expire_after")] = 60;
|
||||
|
||||
client.beginPublish((F("homeassistant/binary_sensor/") + _prefix + F("/status/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1210,9 +1138,6 @@ public:
|
||||
doc[F("value_template")] = F("{{ iif(value_json.states.otStatus, 'OFF', 'ON') }}");
|
||||
|
||||
client.beginPublish((F("homeassistant/binary_sensor/") + _prefix + F("/ot_status/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1239,9 +1164,6 @@ public:
|
||||
doc[F("value_template")] = F("{{ iif(value_json.states.heating, 'ON', 'OFF') }}");
|
||||
|
||||
client.beginPublish((F("homeassistant/binary_sensor/") + _prefix + F("/heating/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1268,9 +1190,6 @@ public:
|
||||
doc[F("value_template")] = F("{{ iif(value_json.states.dhw, 'ON', 'OFF') }}");
|
||||
|
||||
client.beginPublish((F("homeassistant/binary_sensor/") + _prefix + F("/dhw/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1297,9 +1216,6 @@ public:
|
||||
doc[F("value_template")] = F("{{ iif(value_json.states.flame, 'ON', 'OFF') }}");
|
||||
|
||||
client.beginPublish((F("homeassistant/binary_sensor/") + _prefix + F("/flame/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1327,9 +1243,6 @@ public:
|
||||
doc[F("value_template")] = F("{{ iif(value_json.states.fault, 'ON', 'OFF') }}");
|
||||
|
||||
client.beginPublish((F("homeassistant/binary_sensor/") + _prefix + F("/fault/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1356,9 +1269,6 @@ public:
|
||||
doc[F("value_template")] = F("{{ iif(value_json.states.diagnostic, 'ON', 'OFF') }}");
|
||||
|
||||
client.beginPublish((F("homeassistant/binary_sensor/") + _prefix + F("/diagnostic/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1385,9 +1295,6 @@ public:
|
||||
doc[F("value_template")] = F("{{ \"E%02d\"|format(value_json.states.faultCode) }}");
|
||||
|
||||
client.beginPublish((F("homeassistant/sensor/") + _prefix + F("/fault_code/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1416,9 +1323,6 @@ public:
|
||||
doc["value_template"] = "{{ value_json.states.rssi|float(0)|round(1) }}";
|
||||
|
||||
client.beginPublish((F("homeassistant/sensor/") + _prefix + "/rssi/config").c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1448,9 +1352,6 @@ public:
|
||||
doc[F("value_template")] = F("{{ value_json.sensors.modulation|float(0)|round(0) }}");
|
||||
|
||||
client.beginPublish((F("homeassistant/sensor/") + _prefix + F("/modulation/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1479,9 +1380,6 @@ public:
|
||||
doc[F("value_template")] = F("{{ value_json.sensors.pressure|float(0)|round(2) }}");
|
||||
|
||||
client.beginPublish((F("homeassistant/sensor/") + _prefix + F("/pressure/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1515,9 +1413,6 @@ public:
|
||||
doc[F("mode")] = "box";
|
||||
|
||||
client.beginPublish((F("homeassistant/number/") + _prefix + F("/indoor_temp/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1547,9 +1442,6 @@ public:
|
||||
doc[F("value_template")] = F("{{ value_json.temperatures.indoor|float(0)|round(1) }}");
|
||||
|
||||
client.beginPublish((F("homeassistant/sensor/") + _prefix + F("/indoor_temp/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1582,9 +1474,6 @@ public:
|
||||
doc[F("mode")] = "box";
|
||||
|
||||
client.beginPublish((F("homeassistant/number/") + _prefix + F("/outdoor_temp/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1614,9 +1503,6 @@ public:
|
||||
doc[F("value_template")] = F("{{ value_json.temperatures.outdoor|float(0)|round(1) }}");
|
||||
|
||||
client.beginPublish((F("homeassistant/sensor/") + _prefix + F("/outdoor_temp/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1645,9 +1531,6 @@ public:
|
||||
doc[F("value_template")] = F("{{ value_json.temperatures.heating|float(0)|round(2) }}");
|
||||
|
||||
client.beginPublish((F("homeassistant/sensor/") + _prefix + F("/heating_temp/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
@@ -1676,16 +1559,13 @@ public:
|
||||
doc[F("value_template")] = F("{{ value_json.temperatures.dhw|float(0)|round(2) }}");
|
||||
|
||||
client.beginPublish((F("homeassistant/sensor/") + _prefix + F("/dhw_temp/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
|
||||
|
||||
bool publishClimateHeating(byte minTemp = 20, byte maxTemp = 90, bool enabledByDefault = true) {
|
||||
StaticJsonDocument<2048> doc;
|
||||
StaticJsonDocument<2560> doc;
|
||||
doc[F("availability")][F("topic")] = _prefix + F("/status");
|
||||
doc[F("device")][F("identifiers")][0] = _prefix;
|
||||
doc[F("device")][F("sw_version")] = _deviceVersion;
|
||||
@@ -1734,15 +1614,12 @@ public:
|
||||
doc[F("temp_step")] = 0.5;
|
||||
|
||||
client.beginPublish((F("homeassistant/climate/") + _prefix + F("_heating/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
|
||||
bool publishClimateDHW(byte minTemp = 40, byte maxTemp = 60, bool enabledByDefault = true) {
|
||||
StaticJsonDocument<1536> doc;
|
||||
StaticJsonDocument<2560> doc;
|
||||
doc[F("availability")][F("topic")] = _prefix + F("/status");
|
||||
doc[F("device")][F("identifiers")][0] = _prefix;
|
||||
doc[F("device")][F("sw_version")] = _deviceVersion;
|
||||
@@ -1783,9 +1660,6 @@ public:
|
||||
doc[F("max_temp")] = maxTemp;
|
||||
|
||||
client.beginPublish((F("homeassistant/climate/") + _prefix + F("_dhw/config")).c_str(), measureJson(doc), true);
|
||||
//BufferingPrint bufferedClient(client, 32);
|
||||
//serializeJson(doc, bufferedClient);
|
||||
//bufferedClient.flush();
|
||||
serializeJson(doc, client);
|
||||
return client.endPublish();
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ extern MqttTask* tMqtt;
|
||||
extern SensorsTask* tSensors;
|
||||
extern OpenThermTask* tOt;
|
||||
|
||||
class MainTask: public Task {
|
||||
class MainTask : public Task {
|
||||
public:
|
||||
MainTask(bool _enabled = false, unsigned long _interval = 0): Task(_enabled, _interval) {}
|
||||
MainTask(bool _enabled = false, unsigned long _interval = 0) : Task(_enabled, _interval) {}
|
||||
|
||||
protected:
|
||||
unsigned long lastHeapInfo = 0;
|
||||
@@ -25,7 +25,7 @@ protected:
|
||||
tMqtt->enable();
|
||||
}
|
||||
|
||||
if ( firstFailConnect != 0 ) {
|
||||
if (firstFailConnect != 0) {
|
||||
firstFailConnect = 0;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ protected:
|
||||
if (firstFailConnect == 0) {
|
||||
firstFailConnect = millis();
|
||||
}
|
||||
|
||||
|
||||
if (millis() - firstFailConnect > EMERGENCY_TIME_TRESHOLD) {
|
||||
vars.states.emergency = true;
|
||||
INFO("Emergency mode enabled");
|
||||
|
||||
@@ -8,9 +8,9 @@ PubSubClient client(espClient);
|
||||
HomeAssistantHelper haHelper;
|
||||
|
||||
|
||||
class MqttTask: public Task {
|
||||
class MqttTask : public Task {
|
||||
public:
|
||||
MqttTask(bool _enabled = false, unsigned long _interval = 0): Task(_enabled, _interval) {}
|
||||
MqttTask(bool _enabled = false, unsigned long _interval = 0) : Task(_enabled, _interval) {}
|
||||
|
||||
protected:
|
||||
unsigned long lastReconnectAttempt = 0;
|
||||
@@ -50,7 +50,7 @@ protected:
|
||||
if (firstFailConnect == 0) {
|
||||
firstFailConnect = millis();
|
||||
}
|
||||
|
||||
|
||||
if (millis() - firstFailConnect > EMERGENCY_TIME_TRESHOLD) {
|
||||
vars.states.emergency = true;
|
||||
INFO("Emergency mode enabled");
|
||||
@@ -101,7 +101,7 @@ protected:
|
||||
}
|
||||
|
||||
if (!doc["emergency"]["target"].isNull() && doc["emergency"]["target"].is<float>()) {
|
||||
if ( doc["emergency"]["target"].as<float>() > 0 && doc["emergency"]["target"].as<float>() < 100 ) {
|
||||
if (doc["emergency"]["target"].as<float>() > 0 && doc["emergency"]["target"].as<float>() < 100) {
|
||||
settings.emergency.target = round(doc["emergency"]["target"].as<float>() * 10) / 10;
|
||||
flag = true;
|
||||
}
|
||||
@@ -125,21 +125,21 @@ protected:
|
||||
}
|
||||
|
||||
if (!doc["heating"]["target"].isNull() && doc["heating"]["target"].is<float>()) {
|
||||
if ( doc["heating"]["target"].as<float>() > 0 && doc["heating"]["target"].as<float>() < 100 ) {
|
||||
if (doc["heating"]["target"].as<float>() > 0 && doc["heating"]["target"].as<float>() < 100) {
|
||||
settings.heating.target = round(doc["heating"]["target"].as<float>() * 10) / 10;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!doc["heating"]["hysteresis"].isNull() && doc["heating"]["hysteresis"].is<float>()) {
|
||||
if ( doc["heating"]["hysteresis"].as<float>() >= 0 && doc["heating"]["hysteresis"].as<float>() <= 5 ) {
|
||||
if (doc["heating"]["hysteresis"].as<float>() >= 0 && doc["heating"]["hysteresis"].as<float>() <= 5) {
|
||||
settings.heating.hysteresis = round(doc["heating"]["hysteresis"].as<float>() * 10) / 10;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!doc["heating"]["maxTemp"].isNull() && doc["heating"]["maxTemp"].is<unsigned char>()) {
|
||||
if ( doc["heating"]["maxTemp"].as<unsigned char>() > 0 && doc["heating"]["maxTemp"].as<unsigned char>() <= 100 && doc["heating"]["maxTemp"].as<unsigned char>() > settings.heating.minTemp ) {
|
||||
if (doc["heating"]["maxTemp"].as<unsigned char>() > 0 && doc["heating"]["maxTemp"].as<unsigned char>() <= 100 && doc["heating"]["maxTemp"].as<unsigned char>() > settings.heating.minTemp) {
|
||||
settings.heating.maxTemp = doc["heating"]["maxTemp"].as<unsigned char>();
|
||||
vars.parameters.heatingMaxTemp = settings.heating.maxTemp;
|
||||
flag = true;
|
||||
@@ -147,7 +147,7 @@ protected:
|
||||
}
|
||||
|
||||
if (!doc["heating"]["minTemp"].isNull() && doc["heating"]["minTemp"].is<unsigned char>()) {
|
||||
if ( doc["heating"]["minTemp"].as<unsigned char>() >= 0 && doc["heating"]["minTemp"].as<unsigned char>() < 100 && doc["heating"]["minTemp"].as<unsigned char>() < settings.heating.maxTemp ) {
|
||||
if (doc["heating"]["minTemp"].as<unsigned char>() >= 0 && doc["heating"]["minTemp"].as<unsigned char>() < 100 && doc["heating"]["minTemp"].as<unsigned char>() < settings.heating.maxTemp) {
|
||||
settings.heating.minTemp = doc["heating"]["minTemp"].as<unsigned char>();
|
||||
vars.parameters.heatingMinTemp = settings.heating.minTemp;
|
||||
flag = true;
|
||||
@@ -162,14 +162,14 @@ protected:
|
||||
}
|
||||
|
||||
if (!doc["dhw"]["target"].isNull() && doc["dhw"]["target"].is<unsigned char>()) {
|
||||
if ( doc["dhw"]["target"].as<unsigned char>() >= 0 && doc["dhw"]["target"].as<unsigned char>() < 100 ) {
|
||||
if (doc["dhw"]["target"].as<unsigned char>() >= 0 && doc["dhw"]["target"].as<unsigned char>() < 100) {
|
||||
settings.dhw.target = doc["dhw"]["target"].as<unsigned char>();
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!doc["dhw"]["maxTemp"].isNull() && doc["dhw"]["maxTemp"].is<unsigned char>()) {
|
||||
if ( doc["dhw"]["maxTemp"].as<unsigned char>() > 0 && doc["dhw"]["maxTemp"].as<unsigned char>() <= 100 && doc["dhw"]["maxTemp"].as<unsigned char>() > settings.dhw.minTemp ) {
|
||||
if (doc["dhw"]["maxTemp"].as<unsigned char>() > 0 && doc["dhw"]["maxTemp"].as<unsigned char>() <= 100 && doc["dhw"]["maxTemp"].as<unsigned char>() > settings.dhw.minTemp) {
|
||||
settings.dhw.maxTemp = doc["dhw"]["maxTemp"].as<unsigned char>();
|
||||
vars.parameters.dhwMaxTemp = settings.dhw.maxTemp;
|
||||
flag = true;
|
||||
@@ -177,7 +177,7 @@ protected:
|
||||
}
|
||||
|
||||
if (!doc["dhw"]["minTemp"].isNull() && doc["dhw"]["minTemp"].is<unsigned char>()) {
|
||||
if ( doc["dhw"]["minTemp"].as<unsigned char>() >= 0 && doc["dhw"]["minTemp"].as<unsigned char>() < 100 && doc["dhw"]["minTemp"].as<unsigned char>() < settings.dhw.maxTemp ) {
|
||||
if (doc["dhw"]["minTemp"].as<unsigned char>() >= 0 && doc["dhw"]["minTemp"].as<unsigned char>() < 100 && doc["dhw"]["minTemp"].as<unsigned char>() < settings.dhw.maxTemp) {
|
||||
settings.dhw.minTemp = doc["dhw"]["minTemp"].as<unsigned char>();
|
||||
vars.parameters.dhwMinTemp = settings.dhw.minTemp;
|
||||
flag = true;
|
||||
@@ -192,35 +192,35 @@ protected:
|
||||
}
|
||||
|
||||
if (!doc["pid"]["p_factor"].isNull() && doc["pid"]["p_factor"].is<float>()) {
|
||||
if ( doc["pid"]["p_factor"].as<float>() >= 0 && doc["pid"]["p_factor"].as<float>() <= 20 ) {
|
||||
if (doc["pid"]["p_factor"].as<float>() >= 0 && doc["pid"]["p_factor"].as<float>() <= 20) {
|
||||
settings.pid.p_factor = round(doc["pid"]["p_factor"].as<float>() * 1000) / 1000;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!doc["pid"]["i_factor"].isNull() && doc["pid"]["i_factor"].is<float>()) {
|
||||
if ( doc["pid"]["i_factor"].as<float>() >= 0 && doc["pid"]["i_factor"].as<float>() <= 20 ) {
|
||||
if (doc["pid"]["i_factor"].as<float>() >= 0 && doc["pid"]["i_factor"].as<float>() <= 20) {
|
||||
settings.pid.i_factor = round(doc["pid"]["i_factor"].as<float>() * 1000) / 1000;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!doc["pid"]["d_factor"].isNull() && doc["pid"]["d_factor"].is<float>()) {
|
||||
if ( doc["pid"]["d_factor"].as<float>() >= 0 && doc["pid"]["d_factor"].as<float>() <= 20 ) {
|
||||
if (doc["pid"]["d_factor"].as<float>() >= 0 && doc["pid"]["d_factor"].as<float>() <= 20) {
|
||||
settings.pid.d_factor = round(doc["pid"]["d_factor"].as<float>() * 1000) / 1000;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!doc["pid"]["maxTemp"].isNull() && doc["pid"]["maxTemp"].is<unsigned char>()) {
|
||||
if ( doc["pid"]["maxTemp"].as<unsigned char>() > 0 && doc["pid"]["maxTemp"].as<unsigned char>() <= 100 && doc["pid"]["maxTemp"].as<unsigned char>() > settings.pid.minTemp ) {
|
||||
if (doc["pid"]["maxTemp"].as<unsigned char>() > 0 && doc["pid"]["maxTemp"].as<unsigned char>() <= 100 && doc["pid"]["maxTemp"].as<unsigned char>() > settings.pid.minTemp) {
|
||||
settings.pid.maxTemp = doc["pid"]["maxTemp"].as<unsigned char>();
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!doc["pid"]["minTemp"].isNull() && doc["pid"]["minTemp"].is<unsigned char>()) {
|
||||
if ( doc["pid"]["minTemp"].as<unsigned char>() >= 0 && doc["pid"]["minTemp"].as<unsigned char>() < 100 && doc["pid"]["minTemp"].as<unsigned char>() < settings.pid.maxTemp ) {
|
||||
if (doc["pid"]["minTemp"].as<unsigned char>() >= 0 && doc["pid"]["minTemp"].as<unsigned char>() < 100 && doc["pid"]["minTemp"].as<unsigned char>() < settings.pid.maxTemp) {
|
||||
settings.pid.minTemp = doc["pid"]["minTemp"].as<unsigned char>();
|
||||
flag = true;
|
||||
}
|
||||
@@ -233,21 +233,21 @@ protected:
|
||||
}
|
||||
|
||||
if (!doc["equitherm"]["n_factor"].isNull() && doc["equitherm"]["n_factor"].is<float>()) {
|
||||
if ( doc["equitherm"]["n_factor"].as<float>() >= 0 && doc["equitherm"]["n_factor"].as<float>() <= 20 ) {
|
||||
if (doc["equitherm"]["n_factor"].as<float>() >= 0 && doc["equitherm"]["n_factor"].as<float>() <= 20) {
|
||||
settings.equitherm.n_factor = round(doc["equitherm"]["n_factor"].as<float>() * 1000) / 1000;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!doc["equitherm"]["k_factor"].isNull() && doc["equitherm"]["k_factor"].is<float>()) {
|
||||
if ( doc["equitherm"]["k_factor"].as<float>() >= 0 && doc["equitherm"]["k_factor"].as<float>() <= 20 ) {
|
||||
if (doc["equitherm"]["k_factor"].as<float>() >= 0 && doc["equitherm"]["k_factor"].as<float>() <= 20) {
|
||||
settings.equitherm.k_factor = round(doc["equitherm"]["k_factor"].as<float>() * 1000) / 1000;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!doc["equitherm"]["t_factor"].isNull() && doc["equitherm"]["t_factor"].is<float>()) {
|
||||
if ( doc["equitherm"]["t_factor"].as<float>() >= 0 && doc["equitherm"]["t_factor"].as<float>() <= 20 ) {
|
||||
if (doc["equitherm"]["t_factor"].as<float>() >= 0 && doc["equitherm"]["t_factor"].as<float>() <= 20) {
|
||||
settings.equitherm.t_factor = round(doc["equitherm"]["t_factor"].as<float>() * 1000) / 1000;
|
||||
flag = true;
|
||||
}
|
||||
@@ -256,28 +256,28 @@ protected:
|
||||
|
||||
// sensors
|
||||
if (!doc["sensors"]["outdoor"]["type"].isNull() && doc["sensors"]["outdoor"]["type"].is<unsigned char>()) {
|
||||
if ( doc["sensors"]["outdoor"]["type"].as<unsigned char>() >= 0 && doc["sensors"]["outdoor"]["type"].as<unsigned char>() <= 2 ) {
|
||||
if (doc["sensors"]["outdoor"]["type"].as<unsigned char>() >= 0 && doc["sensors"]["outdoor"]["type"].as<unsigned char>() <= 2) {
|
||||
settings.sensors.outdoor.type = doc["sensors"]["outdoor"]["type"].as<unsigned char>();
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!doc["sensors"]["outdoor"]["offset"].isNull() && doc["sensors"]["outdoor"]["offset"].is<float>()) {
|
||||
if ( doc["sensors"]["outdoor"]["offset"].as<float>() >= -10 && doc["sensors"]["outdoor"]["offset"].as<float>() <= 10 ) {
|
||||
if (doc["sensors"]["outdoor"]["offset"].as<float>() >= -10 && doc["sensors"]["outdoor"]["offset"].as<float>() <= 10) {
|
||||
settings.sensors.outdoor.offset = round(doc["sensors"]["outdoor"]["offset"].as<float>() * 1000) / 1000;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!doc["sensors"]["indoor"]["type"].isNull() && doc["sensors"]["indoor"]["type"].is<unsigned char>()) {
|
||||
if ( doc["sensors"]["indoor"]["type"].as<unsigned char>() >= 1 && doc["sensors"]["indoor"]["type"].as<unsigned char>() <= 2 ) {
|
||||
if (doc["sensors"]["indoor"]["type"].as<unsigned char>() >= 1 && doc["sensors"]["indoor"]["type"].as<unsigned char>() <= 2) {
|
||||
settings.sensors.indoor.type = doc["sensors"]["indoor"]["type"].as<unsigned char>();
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!doc["sensors"]["indoor"]["offset"].isNull() && doc["sensors"]["indoor"]["offset"].is<float>()) {
|
||||
if ( doc["sensors"]["indoor"]["offset"].as<float>() >= -10 && doc["sensors"]["indoor"]["offset"].as<float>() <= 10 ) {
|
||||
if (doc["sensors"]["indoor"]["offset"].as<float>() >= -10 && doc["sensors"]["indoor"]["offset"].as<float>() <= 10) {
|
||||
settings.sensors.indoor.offset = round(doc["sensors"]["indoor"]["offset"].as<float>() * 1000) / 1000;
|
||||
flag = true;
|
||||
}
|
||||
@@ -314,14 +314,14 @@ protected:
|
||||
}
|
||||
|
||||
if (!doc["temperatures"]["indoor"].isNull() && doc["temperatures"]["indoor"].is<float>()) {
|
||||
if ( settings.sensors.indoor.type == 1 && doc["temperatures"]["indoor"].as<float>() > -100 && doc["temperatures"]["indoor"].as<float>() < 100 ) {
|
||||
if (settings.sensors.indoor.type == 1 && doc["temperatures"]["indoor"].as<float>() > -100 && doc["temperatures"]["indoor"].as<float>() < 100) {
|
||||
vars.temperatures.indoor = round(doc["temperatures"]["indoor"].as<float>() * 100) / 100;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!doc["temperatures"]["outdoor"].isNull() && doc["temperatures"]["outdoor"].is<float>()) {
|
||||
if ( settings.sensors.outdoor.type == 1 && doc["temperatures"]["outdoor"].as<float>() > -100 && doc["temperatures"]["outdoor"].as<float>() < 100 ) {
|
||||
if (settings.sensors.outdoor.type == 1 && doc["temperatures"]["outdoor"].as<float>() > -100 && doc["temperatures"]["outdoor"].as<float>() < 100) {
|
||||
vars.temperatures.outdoor = round(doc["temperatures"]["outdoor"].as<float>() * 100) / 100;
|
||||
flag = true;
|
||||
}
|
||||
@@ -560,7 +560,7 @@ protected:
|
||||
|
||||
doc["sensors"]["outdoor"]["type"] = settings.sensors.outdoor.type;
|
||||
doc["sensors"]["outdoor"]["offset"] = settings.sensors.outdoor.offset;
|
||||
|
||||
|
||||
doc["sensors"]["indoor"]["type"] = settings.sensors.indoor.type;
|
||||
doc["sensors"]["indoor"]["offset"] = settings.sensors.indoor.offset;
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
CustomOpenTherm* ot;
|
||||
|
||||
class OpenThermTask: public Task {
|
||||
class OpenThermTask : public Task {
|
||||
public:
|
||||
OpenThermTask(bool _enabled = false, unsigned long _interval = 0): Task(_enabled, _interval) {}
|
||||
OpenThermTask(bool _enabled = false, unsigned long _interval = 0) : Task(_enabled, _interval) {}
|
||||
|
||||
protected:
|
||||
void setup() {
|
||||
@@ -28,7 +28,7 @@ protected:
|
||||
static byte currentHeatingTemp, currentDHWTemp = 0;
|
||||
unsigned long localResponse;
|
||||
|
||||
if ( setMasterMemberIdCode() ) {
|
||||
if (setMasterMemberIdCode()) {
|
||||
DEBUG_F("Slave member id code: %u\r\n", vars.parameters.slaveMemberIdCode);
|
||||
DEBUG_F("Master member id code: %u\r\n", settings.opentherm.memberIdCode > 0 ? settings.opentherm.memberIdCode : vars.parameters.slaveMemberIdCode);
|
||||
|
||||
@@ -42,13 +42,13 @@ protected:
|
||||
settings.opentherm.dhwPresent && settings.dhw.enable,
|
||||
false, false, true, false, false
|
||||
);
|
||||
|
||||
|
||||
if (!ot->isValidResponse(localResponse)) {
|
||||
WARN_F("Invalid response after setBoilerStatus: %s\r\n", ot->statusToString(ot->getLastResponseStatus()));
|
||||
return;
|
||||
}
|
||||
|
||||
if ( vars.parameters.heatingEnabled != heatingEnabled ) {
|
||||
if (vars.parameters.heatingEnabled != heatingEnabled) {
|
||||
vars.parameters.heatingEnabled = heatingEnabled;
|
||||
INFO_F("Heating enabled: %s\r\n", heatingEnabled ? "on\0" : "off\0");
|
||||
}
|
||||
@@ -70,7 +70,7 @@ protected:
|
||||
DEBUG_F("Master type: %u, version: %u\r\n", vars.parameters.masterType, vars.parameters.masterVersion);
|
||||
DEBUG_F("Slave type: %u, version: %u\r\n", vars.parameters.slaveType, vars.parameters.slaveVersion);
|
||||
|
||||
if ( settings.opentherm.dhwPresent ) {
|
||||
if (settings.opentherm.dhwPresent) {
|
||||
updateMinMaxDhwTemp();
|
||||
}
|
||||
updateMinMaxHeatingTemp();
|
||||
@@ -83,7 +83,7 @@ protected:
|
||||
ot->sendBoilerReset();
|
||||
}
|
||||
|
||||
if ( vars.states.diagnostic ) {
|
||||
if (vars.states.diagnostic) {
|
||||
ot->sendServiceReset();
|
||||
}
|
||||
|
||||
@@ -92,28 +92,27 @@ protected:
|
||||
}
|
||||
|
||||
updatePressure();
|
||||
if ((settings.opentherm.dhwPresent && settings.dhw.enable) || settings.heating.enable || heatingEnabled ) {
|
||||
if ((settings.opentherm.dhwPresent && settings.dhw.enable) || settings.heating.enable || heatingEnabled) {
|
||||
updateModulationLevel();
|
||||
|
||||
} else {
|
||||
vars.sensors.modulation = 0;
|
||||
}
|
||||
yield();
|
||||
|
||||
if ( settings.opentherm.dhwPresent && settings.dhw.enable ) {
|
||||
if (settings.opentherm.dhwPresent) {
|
||||
updateDHWTemp();
|
||||
} else {
|
||||
vars.temperatures.dhw = 0;
|
||||
}
|
||||
|
||||
//if ( settings.heating.enable || heatingEnabled ) {
|
||||
updateHeatingTemp();
|
||||
//} else {
|
||||
// vars.temperatures.heating = 0;
|
||||
//}
|
||||
updateHeatingTemp();
|
||||
yield();
|
||||
|
||||
//
|
||||
// Температура ГВС
|
||||
byte newDHWTemp = settings.dhw.target;
|
||||
if (settings.opentherm.dhwPresent && settings.dhw.enable && newDHWTemp != currentDHWTemp) {
|
||||
if (settings.opentherm.dhwPresent && settings.dhw.enable && (needSetDhwTemp() || newDHWTemp != currentDHWTemp)) {
|
||||
if (newDHWTemp < vars.parameters.dhwMinTemp || newDHWTemp > vars.parameters.dhwMaxTemp) {
|
||||
newDHWTemp = constrain(newDHWTemp, vars.parameters.dhwMinTemp, vars.parameters.dhwMaxTemp);
|
||||
}
|
||||
@@ -123,6 +122,7 @@ protected:
|
||||
// Записываем заданную температуру ГВС
|
||||
if (ot->setDHWSetpoint(newDHWTemp)) {
|
||||
currentDHWTemp = newDHWTemp;
|
||||
dhwSetTempTime = millis();
|
||||
|
||||
} else {
|
||||
WARN("Failed set DHW temp");
|
||||
@@ -131,12 +131,13 @@ protected:
|
||||
|
||||
//
|
||||
// Температура отопления
|
||||
if (heatingEnabled && fabs(vars.parameters.heatingSetpoint - currentHeatingTemp) > 0.0001) {
|
||||
if (heatingEnabled && (needSetHeatingTemp() || fabs(vars.parameters.heatingSetpoint - currentHeatingTemp) > 0.0001)) {
|
||||
INFO_F("Setting heating temp = %u \n", vars.parameters.heatingSetpoint);
|
||||
|
||||
// Записываем заданную температуру
|
||||
if (ot->setBoilerTemperature(vars.parameters.heatingSetpoint)) {
|
||||
currentHeatingTemp = vars.parameters.heatingSetpoint;
|
||||
heatingSetTempTime = millis();
|
||||
|
||||
} else {
|
||||
WARN("Failed set heating temp");
|
||||
@@ -153,7 +154,7 @@ protected:
|
||||
} else if (!pump && vars.temperatures.indoor - settings.heating.target - 0.0001 <= -(halfHyst)) {
|
||||
pump = true;
|
||||
}
|
||||
|
||||
|
||||
} else if (!pump) {
|
||||
pump = true;
|
||||
}
|
||||
@@ -200,13 +201,27 @@ protected:
|
||||
}
|
||||
|
||||
protected:
|
||||
unsigned short readyTime = 60000;
|
||||
unsigned short dhwSetTempInterval = 60000;
|
||||
unsigned short heatingSetTempInterval = 60000;
|
||||
|
||||
bool pump = true;
|
||||
unsigned long prevUpdateNonEssentialVars = 0;
|
||||
unsigned long startupTime = millis();
|
||||
unsigned long dhwSetTempTime = 0;
|
||||
unsigned long heatingSetTempTime = 0;
|
||||
|
||||
|
||||
bool isReady() {
|
||||
return millis() - startupTime > 60000;
|
||||
return millis() - startupTime > readyTime;
|
||||
}
|
||||
|
||||
bool needSetDhwTemp() {
|
||||
return millis() - dhwSetTempTime > dhwSetTempInterval;
|
||||
}
|
||||
|
||||
bool needSetHeatingTemp() {
|
||||
return millis() - heatingSetTempTime > heatingSetTempInterval;
|
||||
}
|
||||
|
||||
void static printRequestDetail(OpenThermMessageID id, OpenThermResponseStatus status, unsigned long request, unsigned long response, byte attempt) {
|
||||
@@ -248,16 +263,16 @@ protected:
|
||||
response & 0xFF
|
||||
);*/
|
||||
|
||||
} else if ( settings.opentherm.memberIdCode <= 0 ) {
|
||||
} else if (settings.opentherm.memberIdCode <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
response = ot->sendRequest(ot->buildRequest(
|
||||
OpenThermRequestType::WRITE,
|
||||
OpenThermMessageID::MConfigMMemberIDcode,
|
||||
settings.opentherm.memberIdCode > 0 ? settings.opentherm.memberIdCode : vars.parameters.slaveMemberIdCode
|
||||
));
|
||||
|
||||
|
||||
return ot->isValidResponse(response);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ Equitherm etRegulator;
|
||||
GyverPID pidRegulator(0, 0, 0);
|
||||
PIDtuner pidTuner;
|
||||
|
||||
class RegulatorTask: public LeanTask {
|
||||
class RegulatorTask : public LeanTask {
|
||||
public:
|
||||
RegulatorTask(bool _enabled = false, unsigned long _interval = 0): LeanTask(_enabled, _interval) {}
|
||||
RegulatorTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {}
|
||||
|
||||
protected:
|
||||
bool tunerInit = false;
|
||||
@@ -139,7 +139,7 @@ protected:
|
||||
newTemp += prevPidResult;
|
||||
}
|
||||
|
||||
} else if ( settings.pid.enable && !vars.parameters.heatingEnabled && prevPidResult != 0 ) {
|
||||
} else if (settings.pid.enable && !vars.parameters.heatingEnabled && prevPidResult != 0) {
|
||||
newTemp += prevPidResult;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#include <OneWire.h>
|
||||
#include <DallasTemperature.h>
|
||||
|
||||
class SensorsTask: public LeanTask {
|
||||
class SensorsTask : public LeanTask {
|
||||
public:
|
||||
SensorsTask(bool _enabled = false, unsigned long _interval = 0): LeanTask(_enabled, _interval) {}
|
||||
SensorsTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {}
|
||||
|
||||
protected:
|
||||
OneWire* oneWireOutdoorSensor;
|
||||
@@ -24,17 +24,17 @@ protected:
|
||||
|
||||
void setup() {}
|
||||
void loop() {
|
||||
if ( settings.sensors.outdoor.type == 2 ) {
|
||||
if (settings.sensors.outdoor.type == 2) {
|
||||
outdoorTemperatureSensor();
|
||||
}
|
||||
|
||||
if ( settings.sensors.indoor.type == 2 ) {
|
||||
if (settings.sensors.indoor.type == 2) {
|
||||
indoorTemperatureSensor();
|
||||
}
|
||||
}
|
||||
|
||||
void outdoorTemperatureSensor() {
|
||||
if ( !initOutdoorSensor ) {
|
||||
if (!initOutdoorSensor) {
|
||||
oneWireOutdoorSensor = new OneWire(settings.sensors.outdoor.pin);
|
||||
outdoorSensor = new DallasTemperature(oneWireOutdoorSensor);
|
||||
outdoorSensor->begin();
|
||||
@@ -46,12 +46,12 @@ protected:
|
||||
}
|
||||
|
||||
unsigned long estimateConversionTime = millis() - startConversionTime;
|
||||
if ( estimateConversionTime < outdoorSensor->millisToWaitForConversion() ) {
|
||||
if (estimateConversionTime < outdoorSensor->millisToWaitForConversion()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool completed = outdoorSensor->isConversionComplete();
|
||||
if ( !completed && estimateConversionTime >= 1000 ) {
|
||||
if (!completed && estimateConversionTime >= 1000) {
|
||||
// fail, retry
|
||||
outdoorSensor->requestTemperatures();
|
||||
startConversionTime = millis();
|
||||
@@ -59,7 +59,7 @@ protected:
|
||||
ERROR("[SENSORS][OUTDOOR] Could not read temperature data (no response)");
|
||||
}
|
||||
|
||||
if ( !completed ) {
|
||||
if (!completed) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ protected:
|
||||
}
|
||||
|
||||
void indoorTemperatureSensor() {
|
||||
if ( !initIndoorSensor ) {
|
||||
if (!initIndoorSensor) {
|
||||
oneWireIndoorSensor = new OneWire(settings.sensors.indoor.pin);
|
||||
indoorSensor = new DallasTemperature(oneWireIndoorSensor);
|
||||
indoorSensor->begin();
|
||||
@@ -103,12 +103,12 @@ protected:
|
||||
}
|
||||
|
||||
unsigned long estimateConversionTime = millis() - startConversionTime;
|
||||
if ( estimateConversionTime < indoorSensor->millisToWaitForConversion() ) {
|
||||
if (estimateConversionTime < indoorSensor->millisToWaitForConversion()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool completed = indoorSensor->isConversionComplete();
|
||||
if ( !completed && estimateConversionTime >= 1000 ) {
|
||||
if (!completed && estimateConversionTime >= 1000) {
|
||||
// fail, retry
|
||||
indoorSensor->requestTemperatures();
|
||||
startConversionTime = millis();
|
||||
@@ -116,7 +116,7 @@ protected:
|
||||
ERROR("[SENSORS][INDOOR] Could not read temperature data (no response)");
|
||||
}
|
||||
|
||||
if ( !completed ) {
|
||||
if (!completed) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -107,11 +107,11 @@ struct Variables {
|
||||
|
||||
struct {
|
||||
bool heatingEnabled = false;
|
||||
byte heatingMinTemp = 0;
|
||||
byte heatingMaxTemp = 0;
|
||||
byte heatingMinTemp = 20;
|
||||
byte heatingMaxTemp = 90;
|
||||
byte heatingSetpoint = 0.0f;
|
||||
byte dhwMinTemp = 0;
|
||||
byte dhwMaxTemp = 0;
|
||||
byte dhwMinTemp = 30;
|
||||
byte dhwMaxTemp = 60;
|
||||
uint8_t slaveMemberIdCode;
|
||||
uint8_t slaveType;
|
||||
uint8_t slaveVersion;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#define OT_GATEWAY_VERSION "1.3.1"
|
||||
#define OT_GATEWAY_VERSION "1.3.2"
|
||||
#define AP_SSID "OpenTherm Gateway"
|
||||
#define AP_PASSWORD "otgateway123456"
|
||||
#define USE_TELNET
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
#define EXT_SENSORS_INTERVAL 5000
|
||||
#define EXT_SENSORS_FILTER_K 0.15
|
||||
#define DS_CHECK_CRC true
|
||||
#define DS_CRC_USE_TABLE true
|
||||
|
||||
#define LED_STATUS_PIN 13
|
||||
#define LED_OT_RX_PIN 15
|
||||
|
||||
@@ -40,7 +40,7 @@ void setup() {
|
||||
if (eeSettingsResult == 0) {
|
||||
INFO("Settings loaded");
|
||||
|
||||
if ( strcmp(SETTINGS_VALID_VALUE, settings.validationValue) != 0 ) {
|
||||
if (strcmp(SETTINGS_VALID_VALUE, settings.validationValue) != 0) {
|
||||
INFO("Settings not valid, reset and restart...");
|
||||
eeSettings.reset();
|
||||
delay(1000);
|
||||
|
||||
Reference in New Issue
Block a user