From 1e7a9483e22f5d14a39d3374383abb725c24d6af Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 30 Dec 2019 20:45:09 +0100 Subject: [PATCH 1/7] added w-B ErP controller (#240) --- src/ems_devices.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ems_devices.h b/src/ems_devices.h index 620aebf5b..2ecdc8c20 100644 --- a/src/ems_devices.h +++ b/src/ems_devices.h @@ -198,7 +198,7 @@ const _EMS_Device_Types EMS_Devices_Types[] = { #define EMS_OFFSET_MMPLUSStatusMessage_valve_status 2 // valve in percent // MM10 -#define EMS_TYPE_MMStatusMessage 0xAB // mixer status +#define EMS_TYPE_MMStatusMessage 0xAB // mixer status #define EMS_OFFSET_MMStatusMessage_flow_set 0 // flow setpoint #define EMS_OFFSET_MMStatusMessage_flow_temp 1 // flow temperature #define EMS_OFFSET_MMStatusMessage_pump_mod 3 // pump modulation in percent @@ -264,6 +264,7 @@ static const _EMS_Device EMS_Devices[] = { {169, EMS_DEVICE_TYPE_CONTROLLER, "BC40 Base Controller", EMS_DEVICE_FLAG_NONE}, // 0x09 {152, EMS_DEVICE_TYPE_CONTROLLER, "Controller", EMS_DEVICE_FLAG_NONE}, // 0x09 {95, EMS_DEVICE_TYPE_CONTROLLER, "HT3 Controller", EMS_DEVICE_FLAG_NONE}, // 0x09 + {209, EMS_DEVICE_TYPE_CONTROLLER, "W-B Greenstar Erp Controller", EMS_DEVICE_FLAG_NONE}, // 0x09 {230, EMS_DEVICE_TYPE_CONTROLLER, "BC Base Controller", EMS_DEVICE_FLAG_NONE}, // 0x09 {205, EMS_DEVICE_TYPE_CONNECT, "Nefit Moduline Easy Connect", EMS_DEVICE_FLAG_NONE}, // 0x02 {206, EMS_DEVICE_TYPE_CONNECT, "Bosch Easy Connect", EMS_DEVICE_FLAG_NONE}, // 0x02 From 75b47c1609efc5e39832f37c03cc455cbe5b3006 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 30 Dec 2019 20:48:03 +0100 Subject: [PATCH 2/7] force autodetect after changing thermostat - #238 --- src/ems-esp.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ems-esp.cpp b/src/ems-esp.cpp index 728b45b33..f146d7e5c 100644 --- a/src/ems-esp.cpp +++ b/src/ems-esp.cpp @@ -1106,6 +1106,9 @@ bool SetListCallback(MYESP_FSACTION_t action, uint8_t wc, const char * setting, uint8_t pid = atoi(value); EMSESP_Settings.master_thermostat = pid; ems_setMasterThermostat(pid); + // force a scan + ems_clearDeviceList(); + ems_doReadCommand(EMS_TYPE_UBADevices, EMS_Boiler.device_id); ok = true; } } From 6798b59246c1d19b29a3c17ca28af14788004fbb Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 31 Dec 2019 11:34:40 +0100 Subject: [PATCH 3/7] prevent controller and boiler competing for ubamaster - #271 --- src/ems.cpp | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/ems.cpp b/src/ems.cpp index b47b791f2..1aa312bb2 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -1729,7 +1729,8 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) { uint8_t flags = EMS_Devices[i].flags; // its a new entry, set the specifics - if (type == EMS_DEVICE_TYPE_BOILER) { + if ((type == EMS_DEVICE_TYPE_BOILER) && (device_id == EMS_ID_BOILER)) { + // with UBAMasters, there is only one device_id 0x08. To avoid https://github.com/proddy/EMS-ESP/issues/271 EMS_Boiler.device_id = device_id; EMS_Boiler.product_id = product_id; EMS_Boiler.device_flags = flags; @@ -2018,17 +2019,19 @@ void ems_scanDevices() { std::list Device_Ids; // create a new list - Device_Ids.push_back(EMS_ID_BOILER); // UBAMaster/Boilers - 0x08 - Device_Ids.push_back(EMS_ID_HP); // HeatPump - 0x38 - Device_Ids.push_back(EMS_ID_SM); // Solar Module - 0x30 - Device_Ids.push_back(0x09); // Controllers - 0x09 - Device_Ids.push_back(0x02); // Connect - 0x02 - Device_Ids.push_back(0x48); // Gateway - 0x48 - Device_Ids.push_back(0x20); // Mixing Devices - 0x20, 0x21 - Device_Ids.push_back(0x21); // Mixing Devices - 0x20, 0x21 - Device_Ids.push_back(0x10); // Thermostats - 0x10, 0x17, 0x18 - Device_Ids.push_back(0x17); // Thermostats - 0x10, 0x17, 0x18 - Device_Ids.push_back(0x18); // Thermostats - 0x10, 0x17, 0x18 + Device_Ids.push_back(EMS_ID_BOILER); // UBAMaster/Boilers - 0x08 + Device_Ids.push_back(EMS_ID_HP); // HeatPump - 0x38 + Device_Ids.push_back(EMS_ID_SM); // Solar Module - 0x30 + Device_Ids.push_back(EMS_ID_CONTROLLER); // Controllers - 0x09 + Device_Ids.push_back(EMS_ID_CONNECT1); // Connect - 0x02 + Device_Ids.push_back(EMS_ID_CONNECT2); // Connect - 0x50 + Device_Ids.push_back(EMS_ID_GATEWAY); // Gateway - 0x48 + Device_Ids.push_back(EMS_ID_MIXING1); // Mixing Devices - 0x20, 0x21 + Device_Ids.push_back(EMS_ID_MIXING2); // Mixing Devices - 0x20, 0x21 + Device_Ids.push_back(EMS_ID_THERMOSTAT1); // Thermostats - 0x10, 0x17, 0x18 + Device_Ids.push_back(EMS_ID_THERMOSTAT2); // Thermostats - 0x10, 0x17, 0x18 + Device_Ids.push_back(EMS_ID_THERMOSTAT3); // Thermostats - 0x10, 0x17, 0x18 + Device_Ids.push_back(EMS_ID_SWITCH); // Switch - 0x11 // remove duplicates and reserved IDs (like our own device) Device_Ids.sort(); @@ -2075,22 +2078,26 @@ void ems_printDevices() { if (!Devices.empty()) { bool have_unknowns = false; char device_string[100]; + char device_type[30]; myDebug_P(PSTR("and %d were recognized by EMS-ESP as:"), Devices.size()); for (std::list<_Detected_Device>::iterator it = Devices.begin(); it != Devices.end(); ++it) { - if ((it)->known) { - strlcpy(device_string, (it)->device_desc_p, sizeof(device_string)); + ems_getDeviceTypeDescription(it->device_id, device_type); // get type string, e.g. "Boiler" + + if (it->known) { + strlcpy(device_string, it->device_desc_p, sizeof(device_string)); } else { strlcpy(device_string, EMS_MODELTYPE_UNKNOWN_STRING, sizeof(device_string)); // Unknown have_unknowns = true; } - myDebug_P(PSTR(" %s%s%s (DeviceID:0x%02X ProductID:%d Version:%s)"), + myDebug_P(PSTR(" %s: %s%s%s (DeviceID:0x%02X ProductID:%d Version:%s)"), + device_type, COLOR_BOLD_ON, device_string, COLOR_BOLD_OFF, - (it)->device_id, - (it)->product_id, - (it)->version); + it->device_id, + it->product_id, + it->version); } myDebug_P(PSTR("")); // newline From a8d993188d048293aafc9c7f8229b99ab36ffb0e Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 31 Dec 2019 11:34:59 +0100 Subject: [PATCH 4/7] b8 --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h b/src/version.h index 1caa42c6a..72543df5c 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define APP_VERSION "1.9.5b7" +#define APP_VERSION "1.9.5b8" From d8bf33e4dbdbd274b8b27108bcdb8cb5da393a31 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 31 Dec 2019 11:48:07 +0100 Subject: [PATCH 5/7] rename W-B ErP Boiler Control Panel --- src/ems_devices.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ems_devices.h b/src/ems_devices.h index 2ecdc8c20..5a52eb7ba 100644 --- a/src/ems_devices.h +++ b/src/ems_devices.h @@ -264,7 +264,7 @@ static const _EMS_Device EMS_Devices[] = { {169, EMS_DEVICE_TYPE_CONTROLLER, "BC40 Base Controller", EMS_DEVICE_FLAG_NONE}, // 0x09 {152, EMS_DEVICE_TYPE_CONTROLLER, "Controller", EMS_DEVICE_FLAG_NONE}, // 0x09 {95, EMS_DEVICE_TYPE_CONTROLLER, "HT3 Controller", EMS_DEVICE_FLAG_NONE}, // 0x09 - {209, EMS_DEVICE_TYPE_CONTROLLER, "W-B Greenstar Erp Controller", EMS_DEVICE_FLAG_NONE}, // 0x09 + {209, EMS_DEVICE_TYPE_CONTROLLER, "W-B ErP Boiler Control Panel", EMS_DEVICE_FLAG_NONE}, // 0x09 {230, EMS_DEVICE_TYPE_CONTROLLER, "BC Base Controller", EMS_DEVICE_FLAG_NONE}, // 0x09 {205, EMS_DEVICE_TYPE_CONNECT, "Nefit Moduline Easy Connect", EMS_DEVICE_FLAG_NONE}, // 0x02 {206, EMS_DEVICE_TYPE_CONNECT, "Bosch Easy Connect", EMS_DEVICE_FLAG_NONE}, // 0x02 From ca5912ddbdbf9ce0184bcdafd653c52d695997c6 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 31 Dec 2019 11:48:20 +0100 Subject: [PATCH 6/7] codacy/lint warnings --- src/ems-esp.cpp | 3 +-- src/ems.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/ems-esp.cpp b/src/ems-esp.cpp index f146d7e5c..24310a706 100644 --- a/src/ems-esp.cpp +++ b/src/ems-esp.cpp @@ -551,8 +551,6 @@ void publishEMSValues(bool force) { StaticJsonDocument doc; char data[MQTT_MAX_PAYLOAD_SIZE] = {0}; - static uint8_t last_boilerActive = 0xFF; // for remembering last setting of the tap water or heating on/off - // do we have boiler changes? if (ems_getBoilerEnabled() && (ems_Device_has_flags(EMS_DEVICE_UPDATE_FLAG_BOILER) || force)) { JsonObject rootBoiler = doc.to(); @@ -657,6 +655,7 @@ void publishEMSValues(bool force) { // see if the heating or hot tap water has changed, if so send // last_boilerActive stores heating in bit 1 and tap water in bit 2 + static uint8_t last_boilerActive = 0xFF; // for remembering last setting of the tap water or heating on/off if ((last_boilerActive != ((EMS_Boiler.tapwaterActive << 1) + EMS_Boiler.heatingActive)) || force) { myDebugLog("Publishing hot water and heating states via MQTT"); myESP.mqttPublish(TOPIC_BOILER_TAPWATER_ACTIVE, EMS_Boiler.tapwaterActive == 1 ? "1" : "0"); diff --git a/src/ems.cpp b/src/ems.cpp index 1aa312bb2..d0de591d0 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -749,14 +749,14 @@ void ems_parseTelegram(uint8_t * telegram, uint8_t length) { * or either a return code like 0x01 or 0x04 from the last Write command */ if (length == 1) { - uint8_t value = telegram[0]; // 1st byte of data package - static uint32_t _last_emsPollFrequency = 0; + uint8_t value = telegram[0]; // 1st byte of data package // check first for a Poll for us if ((value ^ 0x80 ^ EMS_Sys_Status.emsIDMask) == EMS_ID_ME) { - uint32_t timenow_microsecs = micros(); - EMS_Sys_Status.emsPollFrequency = (timenow_microsecs - _last_emsPollFrequency); - _last_emsPollFrequency = timenow_microsecs; + static uint32_t _last_emsPollFrequency = 0; + uint32_t timenow_microsecs = micros(); + EMS_Sys_Status.emsPollFrequency = (timenow_microsecs - _last_emsPollFrequency); + _last_emsPollFrequency = timenow_microsecs; // do we have something to send thats waiting in the Tx queue? // if so send it if the Queue is not in a wait state @@ -877,7 +877,6 @@ void _printMessage(_EMS_RxTelegram * EMS_RxTelegram) { uint8_t length = EMS_RxTelegram->data_length; char output_str[200] = {0}; - char buffer[16] = {0}; char color_s[20] = {0}; char type_s[30]; @@ -899,6 +898,7 @@ void _printMessage(_EMS_RxTelegram * EMS_RxTelegram) { } if (length) { + char buffer[16] = {0}; // type strlcat(output_str, ", type 0x", sizeof(output_str)); From 9358544a7d6c64a215b6e2efa3d6c2155f272cb8 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 31 Dec 2019 13:31:13 +0100 Subject: [PATCH 7/7] minor fix for rendering mixer flowtemp - #270 --- src/ems.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ems.cpp b/src/ems.cpp index d0de591d0..2b7dc589c 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -123,7 +123,7 @@ void ems_init() { // init all mixing modules for (uint8_t i = 0; i < EMS_THERMOSTAT_MAXHC; i++) { EMS_Mixing.hc[i].hc = i + 1; - EMS_Mixing.hc[i].flowTemp = EMS_VALUE_SHORT_NOTSET; + EMS_Mixing.hc[i].flowTemp = EMS_VALUE_USHORT_NOTSET; EMS_Mixing.hc[i].pumpMod = EMS_VALUE_INT_NOTSET; EMS_Mixing.hc[i].valveStatus = EMS_VALUE_INT_NOTSET; EMS_Mixing.hc[i].flowSetTemp = EMS_VALUE_INT_NOTSET;