From 4d974bbfa07d780417f26fbae8cad58fe22bad67 Mon Sep 17 00:00:00 2001 From: proddy Date: Mon, 27 May 2019 22:13:37 +0200 Subject: [PATCH] set emsReverse if a Junkers heatronic is detected --- src/ems.cpp | 31 +++++++++++++++---------------- src/ems.h | 13 +++++++------ src/ems_devices.h | 21 +++++++++++---------- 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/src/ems.cpp b/src/ems.cpp index 21e098d18..bf6111248 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -345,7 +345,7 @@ void ems_setTxMode(uint8_t mode) { // https://github.com/proddy/EMS-ESP/issues/103#issuecomment-495945850 if (mode == 3) { EMS_Sys_Status.emsReverse = true; - myDebug_P(PSTR("Setting for Tx Junkers logic and enabled the poll reverse flag")); + myDebug_P(PSTR("Forcing emsReverse")); } } @@ -1553,28 +1553,29 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) { if (typeFound) { // its a boiler - myDebug_P(PSTR("Boiler found. Model %s (DeviceID:0x%02X ProductID:%d Version:%s)"), - Boiler_Types[i].model_string, - Boiler_Types[i].device_id, - product_id, - version); + myDebug_P(PSTR("Boiler found. Model %s (DeviceID:0x%02X ProductID:%d Version:%s)"), Boiler_Types[i].model_string, EMS_ID_BOILER, product_id, version); // add to list - _addDevice(product_id, Boiler_Types[i].device_id, version, Boiler_Types[i].model_string); + _addDevice(product_id, EMS_ID_BOILER, version, Boiler_Types[i].model_string); // if its a boiler set it, unless it already has been set by checking for a productID // it will take the first one found in the list - if (((EMS_Boiler.device_id == EMS_ID_NONE) || (EMS_Boiler.device_id == Boiler_Types[i].device_id)) && EMS_Boiler.product_id == EMS_ID_NONE) { + if ((EMS_Boiler.device_id == EMS_ID_NONE) || ((EMS_Boiler.device_id == EMS_ID_BOILER) && EMS_Boiler.product_id == EMS_ID_NONE)) { myDebug_P(PSTR("* Setting Boiler to model %s (DeviceID:0x%02X ProductID:%d Version:%s)"), Boiler_Types[i].model_string, - Boiler_Types[i].device_id, + EMS_ID_BOILER, product_id, version); - EMS_Boiler.device_id = Boiler_Types[i].device_id; + EMS_Boiler.device_id = EMS_ID_BOILER; EMS_Boiler.product_id = Boiler_Types[i].product_id; strlcpy(EMS_Boiler.version, version, sizeof(EMS_Boiler.version)); + // check to see if its a Junkers Heatronic3, which has a different poll'ing logic + if (EMS_Boiler.product_id == EMS_PRODUCTID_HEATRONICS) { + EMS_Sys_Status.emsReverse = true; + } + myESP.fs_saveConfig(); // save config to SPIFFS ems_getBoilerValues(); // get Boiler values that we would usually have to wait for @@ -1603,7 +1604,7 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) { } // add to list - _addDevice(product_id, Boiler_Types[i].device_id, version, Thermostat_Types[i].model_string); + _addDevice(product_id, Thermostat_Types[i].device_id, version, Thermostat_Types[i].model_string); // if we don't have a thermostat set, use this one if (((EMS_Thermostat.device_id == EMS_ID_NONE) || (EMS_Thermostat.model_id == EMS_MODEL_NONE) @@ -1895,10 +1896,8 @@ void ems_scanDevices() { std::list Device_Ids; // create a new list - // copy over boilers - for (_Boiler_Type bt : Boiler_Types) { - Device_Ids.push_back(bt.device_id); - } + // add boiler device_id which is always 0x08 + Device_Ids.push_back(EMS_ID_BOILER); // copy over thermostats for (_Thermostat_Type tt : Thermostat_Types) { @@ -1933,7 +1932,7 @@ void ems_printAllDevices() { COLOR_BOLD_ON, Boiler_Types[i].model_string, COLOR_BOLD_OFF, - Boiler_Types[i].device_id, + EMS_ID_BOILER, Boiler_Types[i].product_id); } diff --git a/src/ems.h b/src/ems.h index d40d90dd4..eb7e3e092 100644 --- a/src/ems.h +++ b/src/ems.h @@ -12,15 +12,17 @@ #include -// EMS IDs -#define EMS_ID_NONE 0x00 // Fixed - used as a dest in broadcast messages and empty device IDs -#define EMS_PLUS_ID_NONE 0x01 // Fixed - used as a dest in broadcast messages and empty device IDs -#define EMS_ID_ME 0x0B // Fixed - our device, hardcoded as the "Service Key" -#define EMS_ID_DEFAULT_BOILER 0x08 +#define EMS_ID_NONE 0x00 // used as a dest in broadcast messages and empty device IDs + +// Fixed EMS IDs +#define EMS_ID_ME 0x0B // our device, hardcoded as the "Service Key" +#define EMS_ID_BOILER 0x08 // all UBA Boilers have 0x08 #define EMS_ID_SM 0x30 // Solar Module SM10 and SM100 #define EMS_ID_HP 0x38 // HeatPump #define EMS_ID_GATEWAY 0x48 // KM200 Web Gateway +#define EMS_PRODUCTID_HEATRONICS 95 // ProductID for a Junkers Heatronic3 device + #define EMS_MIN_TELEGRAM_LENGTH 6 // minimal length for a validation telegram, including CRC // max length of a telegram, including CRC, for Rx and Tx. @@ -150,7 +152,6 @@ const _EMS_TxTelegram EMS_TX_TELEGRAM_NEW = { typedef struct { uint8_t model_id; uint8_t product_id; - uint8_t device_id; char model_string[50]; } _Boiler_Type; diff --git a/src/ems_devices.h b/src/ems_devices.h index 8f4814ef1..84fdb43b9 100644 --- a/src/ems_devices.h +++ b/src/ems_devices.h @@ -146,18 +146,19 @@ typedef enum { } _EMS_MODEL_ID; // EMS types for known Buderus/Bosch devices. This list will be extended when new devices are recognized. -// format is MODEL_ID, PRODUCT ID, TYPE_ID, DESCRIPTION +// The device_id is always 0x08 +// format is MODEL_ID, PRODUCT ID, DESCRIPTION const _Boiler_Type Boiler_Types[] = { - {EMS_MODEL_UBA, 72, 0x08, "MC10 Module"}, - {EMS_MODEL_UBA, 123, 0x08, "Buderus GB172/Nefit Trendline"}, - {EMS_MODEL_UBA, 115, 0x08, "Nefit Topline Compact/Buderus GB162"}, - {EMS_MODEL_UBA, 203, 0x08, "Buderus Logamax U122/Junkers Cerapur"}, - {EMS_MODEL_UBA, 208, 0x08, "Buderus Logamax plus/GB192"}, - {EMS_MODEL_UBA, 64, 0x08, "Sieger BK15 Boiler/Nefit Smartline"}, - {EMS_MODEL_UBA, 95, 0x08, "Bosch Condens 2500/Junkers Heatronics3"}, - {EMS_MODEL_UBA, 122, 0x08, "Nefit Proline"}, - {EMS_MODEL_UBA, 172, 0x08, "Nefit Enviline"} + {EMS_MODEL_UBA, 72, "MC10 Module"}, + {EMS_MODEL_UBA, 123, "Buderus GB172/Nefit Trendline"}, + {EMS_MODEL_UBA, 115, "Nefit Topline Compact/Buderus GB162"}, + {EMS_MODEL_UBA, 203, "Buderus Logamax U122/Junkers Cerapur"}, + {EMS_MODEL_UBA, 208, "Buderus Logamax plus/GB192"}, + {EMS_MODEL_UBA, 64, "Sieger BK15 Boiler/Nefit Smartline"}, + {EMS_MODEL_UBA, EMS_PRODUCTID_HEATRONICS, "Bosch Condens 2500/Junkers Heatronics3"}, // Junkers + {EMS_MODEL_UBA, 122, "Nefit Proline"}, + {EMS_MODEL_UBA, 172, "Nefit Enviline"} };