From 1ec05d7eb1daf248897fb851c2921e2bebe395db Mon Sep 17 00:00:00 2001 From: Paul Date: Sat, 4 Jan 2020 13:47:26 +0100 Subject: [PATCH 1/3] 1.9.5b12 --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h b/src/version.h index bea92a4f9..4d590e577 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define APP_VERSION "1.9.5b11" +#define APP_VERSION "1.9.5b12" From f31b2f3a6d9dc51d9ef21f2eb627797039512d0c Mon Sep 17 00:00:00 2001 From: Paul Date: Sat, 4 Jan 2020 13:48:02 +0100 Subject: [PATCH 2/3] tidy up --- src/ems_devices.h | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/ems_devices.h b/src/ems_devices.h index 1fdac9178..a8d3d5046 100644 --- a/src/ems_devices.h +++ b/src/ems_devices.h @@ -16,7 +16,7 @@ #define EMS_ID_BOILER 0x08 // all UBA Boilers have 0x08 #define EMS_ID_SM 0x30 // Solar Module SM10, SM100, SM200 and ISM1 #define EMS_ID_HP 0x38 // HeatPump -#define EMS_ID_GATEWAY 0x48 // Gateway e.g. KM200 Web Gateway +#define EMS_ID_GATEWAY 0x48 // Gateway Modem e.g. KM200 Web Gateway. Also on 0x0A->0x0D #define EMS_ID_MIXING1 0x20 // Mixing #define EMS_ID_MIXING2 0x21 // Mixing #define EMS_ID_SWITCH 0x11 // Switch @@ -26,7 +26,6 @@ #define EMS_ID_THERMOSTAT1 0x10 // Thermostat #define EMS_ID_THERMOSTAT2 0x17 // Thermostat #define EMS_ID_THERMOSTAT3 0x18 // Thermostat -#define EMS_ID_MODEM 0x19 // Modem // mapping for EMS_Devices_Type const _EMS_Device_Types EMS_Devices_Types[] = { @@ -45,8 +44,7 @@ const _EMS_Device_Types EMS_Devices_Types[] = { {EMS_ID_SWITCH, EMS_DEVICE_TYPE_SWITCH, "Switching Module"}, {EMS_ID_CONTROLLER, EMS_DEVICE_TYPE_CONTROLLER, "Controller"}, {EMS_ID_CONNECT1, EMS_DEVICE_TYPE_CONNECT, "Connect"}, - {EMS_ID_CONNECT2, EMS_DEVICE_TYPE_CONNECT, "Connect"}, - {EMS_ID_MODEM, EMS_DEVICE_TYPE_MODEM, "Modem"} + {EMS_ID_CONNECT2, EMS_DEVICE_TYPE_CONNECT, "Connect"} }; @@ -226,7 +224,7 @@ const _EMS_Device_Types EMS_Devices_Types[] = { static const _EMS_Device EMS_Devices[] = { // - // UBA Masters - typically with device_id of 0x08 + // UBA Masters - must have device_id of 0x08 // {72, EMS_DEVICE_TYPE_BOILER, "MC10 Module", EMS_DEVICE_FLAG_NONE}, {123, EMS_DEVICE_TYPE_BOILER, "Buderus GBx72/Nefit Trendline/Junkers Cerapur/Worcester Greenstar Si/27i", EMS_DEVICE_FLAG_NONE}, @@ -257,9 +255,8 @@ static const _EMS_Device EMS_Devices[] = { {161, EMS_DEVICE_TYPE_MIXING, "MM200 Mixing Module", EMS_DEVICE_FLAG_NONE}, {69, EMS_DEVICE_TYPE_MIXING, "MM10 Mixer Module", EMS_DEVICE_FLAG_NONE}, {159, EMS_DEVICE_TYPE_MIXING, "MM50 Mixing Module", EMS_DEVICE_FLAG_NONE}, - {79, EMS_DEVICE_TYPE_MIXING, "MM100 Mixer Module", EMS_DEVICE_FLAG_NONE}, - {80, EMS_DEVICE_TYPE_MIXING, "MM200 Mixer Module", EMS_DEVICE_FLAG_NONE}, - {78, EMS_DEVICE_TYPE_MIXING, "MM400 Mixer Module", EMS_DEVICE_FLAG_NONE}, + {79, EMS_DEVICE_TYPE_MIXING, "Junkers M100", EMS_DEVICE_FLAG_NONE}, + {80, EMS_DEVICE_TYPE_MIXING, "Junkers M200", EMS_DEVICE_FLAG_NONE}, // // HeatPump - type 0x38 @@ -286,10 +283,10 @@ static const _EMS_Device EMS_Devices[] = { {206, EMS_DEVICE_TYPE_CONNECT, "Bosch Easy Connect", EMS_DEVICE_FLAG_NONE}, // 0x02 {171, EMS_DEVICE_TYPE_CONNECT, "EMS-OT OpenTherm converter", EMS_DEVICE_FLAG_NONE}, // 0x02 {189, EMS_DEVICE_TYPE_GATEWAY, "Web Gateway KM200", EMS_DEVICE_FLAG_NONE}, // 0x48 - {94, EMS_DEVICE_TYPE_MODEM, "RC Remote Device", EMS_DEVICE_FLAG_NONE}, // 0x19 + {94, EMS_DEVICE_TYPE_MODEM, "RC Remote Device", EMS_DEVICE_FLAG_NONE}, // 0x18 // - // Thermostats, typically device id of 0x10, 0x17, 0x18 and 0x39 (easy) + // Thermostats, typically device id of 0x10, 0x17, 0x18, 0x38 (RC100), 0x39 (Easy) // // Easy devices - not currently supporting write operations @@ -303,9 +300,9 @@ static const _EMS_Device EMS_Devices[] = { {67, EMS_DEVICE_TYPE_THERMOSTAT, "RC30", EMS_DEVICE_FLAG_RC30}, // 0x10 {78, EMS_DEVICE_TYPE_THERMOSTAT, "RC30/Moduline 400", EMS_DEVICE_FLAG_RC30}, // 0x10 {86, EMS_DEVICE_TYPE_THERMOSTAT, "RC35", EMS_DEVICE_FLAG_RC35}, // 0x10 - {93, EMS_DEVICE_TYPE_THERMOSTAT, "RC20RF", EMS_DEVICE_FLAG_RC20}, // 0x18 + {93, EMS_DEVICE_TYPE_THERMOSTAT, "RC20RF", EMS_DEVICE_FLAG_RC20}, // 0x19 {158, EMS_DEVICE_TYPE_THERMOSTAT, "RC300/RC310/Moduline 3000/Bosch CW400/W-B Sense II", EMS_DEVICE_FLAG_RC300}, // 0x10 - {165, EMS_DEVICE_TYPE_THERMOSTAT, "RC100/Moduline 1010", EMS_DEVICE_FLAG_RC300 | EMS_DEVICE_FLAG_NO_WRITE}, // 0x18, cannot write + {165, EMS_DEVICE_TYPE_THERMOSTAT, "RC100/Moduline 1010", EMS_DEVICE_FLAG_RC300 | EMS_DEVICE_FLAG_NO_WRITE}, // 0x18, 0x38 - cannot write // Sieger {76, EMS_DEVICE_TYPE_THERMOSTAT, "Sieger ES73", EMS_DEVICE_FLAG_RC35}, // 0x10 From 4484c6db60cc5b727baeb29c47d3792f25404a31 Mon Sep 17 00:00:00 2001 From: Paul Date: Sat, 4 Jan 2020 13:49:11 +0100 Subject: [PATCH 3/3] #284 #283 --- src/ems.cpp | 58 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/src/ems.cpp b/src/ems.cpp index 837e6c8c9..5375cac26 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -1370,19 +1370,43 @@ int8_t _getHeatingCircuit(_EMS_RxTelegram * EMS_RxTelegram) { int8_t hc; - if ((EMS_RxTelegram->type == EMS_TYPE_RC35StatusMessage_HC1) || (EMS_RxTelegram->type = EMS_TYPE_RC35Set_HC1)) { + switch (EMS_RxTelegram->type) { + case EMS_TYPE_RC35StatusMessage_HC1: + case EMS_TYPE_RC35Set_HC1: + case EMS_TYPE_JunkersStatusMessage_HC1: + case EMS_TYPE_JunkersSetMessage_HC1: hc = 0; - } else if ((EMS_RxTelegram->type == EMS_TYPE_RC35StatusMessage_HC2) || (EMS_RxTelegram->type = EMS_TYPE_RC35Set_HC2)) { + break; + + case EMS_TYPE_RC35StatusMessage_HC2: + case EMS_TYPE_RC35Set_HC2: + case EMS_TYPE_JunkersStatusMessage_HC2: + case EMS_TYPE_JunkersSetMessage_HC2: hc = 1; - } else if ((EMS_RxTelegram->type == EMS_TYPE_RC35StatusMessage_HC3) || (EMS_RxTelegram->type = EMS_TYPE_RC35Set_HC3)) { + break; + + case EMS_TYPE_RC35StatusMessage_HC3: + case EMS_TYPE_RC35Set_HC3: + case EMS_TYPE_JunkersStatusMessage_HC3: + case EMS_TYPE_JunkersSetMessage_HC3: hc = 2; - } else if ((EMS_RxTelegram->type == EMS_TYPE_RC35StatusMessage_HC4) || (EMS_RxTelegram->type = EMS_TYPE_RC35Set_HC4)) { + break; + + case EMS_TYPE_RC35StatusMessage_HC4: + case EMS_TYPE_RC35Set_HC4: + case EMS_TYPE_JunkersStatusMessage_HC4: + case EMS_TYPE_JunkersSetMessage_HC4: hc = 3; - } else { - return -1; // not a valid HC + break; + + default: + hc = -1; // not a valid HC + break; } - EMS_Thermostat.hc[hc].active = true; + if (hc != -1) { + EMS_Thermostat.hc[hc].active = true; + } return (hc); } @@ -1577,7 +1601,7 @@ bool _addDevice(_EMS_DEVICE_TYPE device_type, uint8_t product_id, uint8_t device _Detected_Device device; // check for duplicates - // a combi of product_id and device_id make it unique + // a pair of product_id and device_id together make it unique for (std::list<_Detected_Device>::iterator it = Devices.begin(); it != Devices.end(); ++it) { if (((it)->product_id == product_id) && ((it)->device_id == device_id)) { return (true); // it already exists in the list, don't add @@ -1711,9 +1735,11 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) { uint8_t i = 0; uint8_t found_index = 0; bool typeFound = false; - while ((i < _EMS_Devices_max) && (!typeFound)) { + while (i++ < _EMS_Devices_max) { if (EMS_Devices[i].product_id == product_id) { // we have a matching product id + /* + // this code is to check also that we have a matching device type (e.g. boiler, thermostat etc) // now lets see if there is a matching device_id since product_id can be on multiple devices // e.g. with UBAMasters, there is only one device_id 0x08. To avoid https://github.com/proddy/EMS-ESP/issues/271 _EMS_DEVICE_TYPE device_type = EMS_Devices[i].type; @@ -1724,27 +1750,31 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) { break; } } + */ + typeFound = true; + found_index = i; + break; } - i++; } - // if not found, just add it as an unknown device + // if not found, just add it as an unknown device and exit if (!typeFound) { (void)_addDevice(EMS_DEVICE_TYPE_UNKNOWN, product_id, device_id, nullptr, version); return; } const char * device_desc_p = (EMS_Devices[found_index].device_desc); // pointer to the full description of the device - _EMS_DEVICE_TYPE type = EMS_Devices[found_index].type; // type + _EMS_DEVICE_TYPE type = EMS_Devices[found_index].type; // device type // we recognized it, see if we already have it in our recognized list if (_addDevice(type, product_id, device_id, device_desc_p, version)) { return; // already in list } - uint8_t flags = EMS_Devices[found_index].flags; // it's a new entry, set the specifics + uint8_t flags = EMS_Devices[found_index].flags; // it's a new entry, get the specifics - if (type == EMS_DEVICE_TYPE_BOILER) { + // for a boiler, sometimes we get a device_id of 0x09 with the same product_id, so lets make sure it is the UBA Master + if ((type == EMS_DEVICE_TYPE_BOILER) && (device_id == EMS_ID_BOILER)) { EMS_Boiler.device_id = device_id; EMS_Boiler.product_id = product_id; EMS_Boiler.device_flags = flags;