mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
minor changes to mixing
This commit is contained in:
@@ -484,7 +484,7 @@ void showInfo() {
|
||||
_renderUShortValue("Switch temperature", "C", EMS_Boiler.switchTemp);
|
||||
}
|
||||
|
||||
for (uint8_t hc_num = 1; hc_num <= EMS_THERMOSTAT_MAXHC; hc_num++) {
|
||||
for (uint8_t hc_num = 1; hc_num <= EMS_MIXING_MAXHC; hc_num++) {
|
||||
if (EMS_MixingModule.hc[hc_num - 1].active) {
|
||||
myDebug_P(PSTR(" Mixing Circuit %d"), hc_num);
|
||||
if (EMS_MixingModule.hc[hc_num - 1].flowTemp < EMS_VALUE_USHORT_NOTSET)
|
||||
@@ -497,7 +497,8 @@ void showInfo() {
|
||||
_renderIntValue(" Current valve status", "", EMS_MixingModule.hc[hc_num - 1].valveStatus);
|
||||
}
|
||||
}
|
||||
for (uint8_t wwc_num = 1; wwc_num <= EMS_THERMOSTAT_MAXWWC; wwc_num++) {
|
||||
|
||||
for (uint8_t wwc_num = 1; wwc_num <= EMS_MIXING_MAXWWC; wwc_num++) {
|
||||
if (EMS_MixingModule.wwc[wwc_num - 1].active) {
|
||||
myDebug_P(PSTR(" Warm Water Circuit %d"), wwc_num);
|
||||
if (EMS_MixingModule.wwc[wwc_num - 1].flowTemp < EMS_VALUE_USHORT_NOTSET)
|
||||
@@ -774,19 +775,19 @@ void publishEMSValues(bool force) {
|
||||
ems_Device_remove_flags(EMS_DEVICE_UPDATE_FLAG_THERMOSTAT); // unset flag
|
||||
}
|
||||
|
||||
// handle the thermostat values
|
||||
// handle the mixing values
|
||||
if (ems_getMixingDeviceEnabled() && (ems_Device_has_flags(EMS_DEVICE_UPDATE_FLAG_MIXING) || force)) {
|
||||
doc.clear();
|
||||
JsonObject rootMixing = doc.to<JsonObject>();
|
||||
|
||||
for (uint8_t hc_v = 1; hc_v <= EMS_THERMOSTAT_MAXHC; hc_v++) {
|
||||
for (uint8_t hc_v = 1; hc_v <= EMS_MIXING_MAXHC; hc_v++) {
|
||||
_EMS_MixingModule_HC * mixing = &EMS_MixingModule.hc[hc_v - 1];
|
||||
|
||||
// only send if we have an active Heating Circuit with real data
|
||||
if (mixing->active) {
|
||||
// build new json object
|
||||
char hc[10]; // hc{1-4}
|
||||
strlcpy(hc, THERMOSTAT_HC, sizeof(hc));
|
||||
strlcpy(hc, MIXING_HC, sizeof(hc));
|
||||
strlcat(hc, _int_to_char(s, mixing->hc), sizeof(hc));
|
||||
JsonObject dataMixing = rootMixing.createNestedObject(hc);
|
||||
if (mixing->flowTemp < EMS_VALUE_USHORT_NOTSET)
|
||||
@@ -799,13 +800,14 @@ void publishEMSValues(bool force) {
|
||||
dataMixing["valveStatus"] = mixing->valveStatus;
|
||||
}
|
||||
}
|
||||
for (uint8_t wwc_v = 1; wwc_v <= EMS_THERMOSTAT_MAXWWC; wwc_v++) {
|
||||
|
||||
for (uint8_t wwc_v = 1; wwc_v <= EMS_MIXING_MAXWWC; wwc_v++) {
|
||||
_EMS_MixingModule_WWC * mixing = &EMS_MixingModule.wwc[wwc_v - 1];
|
||||
// only send if we have an active Warm water Circuit with real data
|
||||
if (mixing->active) {
|
||||
// build new json object
|
||||
char wwc[10]; // wc{1-2}
|
||||
strlcpy(wwc, "wwc", sizeof(wwc));
|
||||
char wwc[10]; // wwc{1-2}
|
||||
strlcpy(wwc, MIXING_WWC, sizeof(wwc));
|
||||
strlcat(wwc, _int_to_char(s, mixing->wwc), sizeof(wwc));
|
||||
JsonObject dataMixing = rootMixing.createNestedObject(wwc);
|
||||
if (mixing->flowTemp < EMS_VALUE_USHORT_NOTSET)
|
||||
|
||||
32
src/ems.cpp
32
src/ems.cpp
@@ -121,15 +121,19 @@ void ems_init() {
|
||||
|
||||
EMS_MixingModule.device_id = EMS_ID_NONE;
|
||||
// init all mixing modules
|
||||
for (uint8_t i = 0; i < EMS_THERMOSTAT_MAXHC; i++) {
|
||||
for (uint8_t i = 0; i < EMS_MIXING_MAXHC; i++) {
|
||||
EMS_MixingModule.hc[i].hc = i + 1;
|
||||
EMS_MixingModule.hc[i].active = false;
|
||||
EMS_MixingModule.hc[i].flowTemp = EMS_VALUE_USHORT_NOTSET;
|
||||
EMS_MixingModule.hc[i].pumpMod = EMS_VALUE_INT_NOTSET;
|
||||
EMS_MixingModule.hc[i].valveStatus = EMS_VALUE_INT_NOTSET;
|
||||
EMS_MixingModule.hc[i].flowSetTemp = EMS_VALUE_INT_NOTSET;
|
||||
}
|
||||
for (uint8_t i = 0; i < EMS_THERMOSTAT_MAXWWC; i++) {
|
||||
|
||||
// init ww circuits
|
||||
for (uint8_t i = 0; i < EMS_MIXING_MAXWWC; i++) {
|
||||
EMS_MixingModule.wwc[i].wwc = i + 1;
|
||||
EMS_MixingModule.wwc[i].active = false;
|
||||
EMS_MixingModule.wwc[i].flowTemp = EMS_VALUE_USHORT_NOTSET;
|
||||
EMS_MixingModule.wwc[i].pumpMod = EMS_VALUE_INT_NOTSET;
|
||||
EMS_MixingModule.wwc[i].tempStatus = EMS_VALUE_INT_NOTSET;
|
||||
@@ -1086,9 +1090,12 @@ void _process_UBAMonitorFast(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||
_setValue(EMS_RxTelegram, &EMS_Boiler.wWHeat, 7, 6);
|
||||
_setValue(EMS_RxTelegram, &EMS_Boiler.wWCirc, 7, 7);
|
||||
|
||||
// there may also be a BoilTemp in this telgram for Bosch - see https://github.com/proddy/EMS-ESP/issues/206
|
||||
// there may also be a BoilTemp in this telegram for Bosch - see https://github.com/proddy/EMS-ESP/issues/206
|
||||
// as well as the one from UBAMonitorSlow
|
||||
// brand is 0=unknown, 1=bosch, 2=junkers, 3=buderus, 4=nefit, 5=sieger, 11=worcester
|
||||
if ((EMS_Boiler.brand == 1) || (EMS_Boiler.brand == 2) || (EMS_Boiler.brand == 11)) {
|
||||
_setValue(EMS_RxTelegram, &EMS_Boiler.boilTemp, 11); // 0x8000 if not available
|
||||
}
|
||||
|
||||
_setValue(EMS_RxTelegram, &EMS_Boiler.retTemp, 13);
|
||||
_setValue(EMS_RxTelegram, &EMS_Boiler.flameCurr, 15);
|
||||
@@ -1281,10 +1288,10 @@ void _process_EasyStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||
_setValue(EMS_RxTelegram, &EMS_Thermostat.hc[hc].setpoint_roomTemp, EMS_OFFSET_EasyStatusMessage_setpoint); // is * 100
|
||||
}
|
||||
|
||||
// Mixer - 0x01D7, 0x01D8
|
||||
// Mixing module - 0x01D7, 0x01D8
|
||||
void _process_MMPLUSStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||
uint8_t hc = (EMS_RxTelegram->type - EMS_TYPE_MMPLUSStatusMessage_HC1); // 0 to 3
|
||||
if (hc >= EMS_THERMOSTAT_MAXHC) {
|
||||
if (hc >= EMS_MIXING_MAXHC) {
|
||||
return; // invalid type
|
||||
}
|
||||
EMS_MixingModule.hc[hc].active = true;
|
||||
@@ -1293,11 +1300,11 @@ void _process_MMPLUSStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||
_setValue(EMS_RxTelegram, &EMS_MixingModule.hc[hc].pumpMod, EMS_OFFSET_MMPLUSStatusMessage_pump_mod);
|
||||
_setValue(EMS_RxTelegram, &EMS_MixingModule.hc[hc].valveStatus, EMS_OFFSET_MMPLUSStatusMessage_valve_status);
|
||||
}
|
||||
// Mixer warm water loading - 0x0231, 0x0232
|
||||
|
||||
// Mixing module warm water loading - 0x0231, 0x0232
|
||||
void _process_MMPLUSStatusMessageWW(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||
uint8_t wwc = (EMS_RxTelegram->type - EMS_TYPE_MMPLUSStatusMessage_WWC1); // 0 to 3
|
||||
if (wwc >= EMS_THERMOSTAT_MAXWWC) {
|
||||
uint8_t wwc = (EMS_RxTelegram->type - EMS_TYPE_MMPLUSStatusMessage_WWC1); // 0 to 1
|
||||
if (wwc >= EMS_MIXING_MAXWWC) {
|
||||
return; // invalid type
|
||||
}
|
||||
EMS_MixingModule.wwc[wwc].active = true;
|
||||
@@ -1831,6 +1838,10 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||
EMS_Boiler.product_id = product_id;
|
||||
EMS_Boiler.device_desc_p = EMS_Devices[i].device_desc;
|
||||
strlcpy(EMS_Boiler.version, version, sizeof(EMS_Boiler.version));
|
||||
|
||||
// set brand of boiler
|
||||
EMS_Boiler.brand = brand;
|
||||
|
||||
_addDevice(EMS_DEVICE_TYPE_BOILER, product_id, EMS_ID_BOILER, EMS_Devices[i].device_desc, version, brand);
|
||||
ems_getBoilerValues(); // get Boiler values that we would usually have to wait for
|
||||
return; // quit
|
||||
@@ -2937,7 +2948,10 @@ const _EMS_Type EMS_Types[] = {
|
||||
{EMS_DEVICE_UPDATE_FLAG_MIXING, EMS_TYPE_MMPLUSStatusMessage_HC4, "MMPLUSStatusMessage_HC4", _process_MMPLUSStatusMessage},
|
||||
{EMS_DEVICE_UPDATE_FLAG_MIXING, EMS_TYPE_MMPLUSStatusMessage_WWC1, "MMPLUSStatusMessage_WWC1", _process_MMPLUSStatusMessageWW},
|
||||
{EMS_DEVICE_UPDATE_FLAG_MIXING, EMS_TYPE_MMPLUSStatusMessage_WWC2, "MMPLUSStatusMessage_WWC2", _process_MMPLUSStatusMessageWW},
|
||||
{EMS_DEVICE_UPDATE_FLAG_MIXING, EMS_TYPE_MMStatusMessage, "MMStatusMessage", _process_MMStatusMessage}};
|
||||
{EMS_DEVICE_UPDATE_FLAG_MIXING, EMS_TYPE_MMStatusMessage, "MMStatusMessage", _process_MMStatusMessage}
|
||||
|
||||
|
||||
};
|
||||
|
||||
// calculate sizes of arrays at compile time
|
||||
uint8_t _EMS_Types_max = ArraySize(EMS_Types);
|
||||
|
||||
Reference in New Issue
Block a user