diff --git a/src/ems-esp.cpp b/src/ems-esp.cpp index e15787e9f..5a2c16b4d 100644 --- a/src/ems-esp.cpp +++ b/src/ems-esp.cpp @@ -557,8 +557,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(); @@ -663,6 +661,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"); @@ -1112,6 +1111,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; } } diff --git a/src/ems.cpp b/src/ems.cpp index b052decf9..98ea21195 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; @@ -750,14 +750,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 @@ -878,7 +878,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]; @@ -900,6 +899,7 @@ void _printMessage(_EMS_RxTelegram * EMS_RxTelegram) { } if (length) { + char buffer[16] = {0}; // type strlcat(output_str, ", type 0x", sizeof(output_str)); @@ -1731,7 +1731,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; @@ -2027,17 +2028,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(); @@ -2084,22 +2087,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 diff --git a/src/ems_devices.h b/src/ems_devices.h index 620aebf5b..5a52eb7ba 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 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 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"