diff --git a/src/MyESP.cpp b/src/MyESP.cpp index bcc16952a..8f6ace613 100644 --- a/src/MyESP.cpp +++ b/src/MyESP.cpp @@ -2694,7 +2694,7 @@ void MyESP::_printMQTTLog(bool show_sub = false) { for (i = 0; i < MYESP_MQTTLOG_MAX; i++) { if ((MQTT_log[i].topic != nullptr) && (MQTT_log[i].type == MYESP_MQTTLOGTYPE_PUBLISH)) { - myDebug_P(PSTR(" (%02d:%02d:%02d) Topic:%s Payload:%s"), + myDebug_P(PSTR(" (%02d:%02d:%02d) Topic: %s Payload: %s"), to_hour(MQTT_log[i].timestamp), to_minute(MQTT_log[i].timestamp), to_second(MQTT_log[i].timestamp), @@ -2710,7 +2710,7 @@ void MyESP::_printMQTTLog(bool show_sub = false) { for (i = 0; i < MYESP_MQTTLOG_MAX; i++) { if ((MQTT_log[i].topic != nullptr) && (MQTT_log[i].type == MYESP_MQTTLOGTYPE_SUBSCRIBE)) { - myDebug_P(PSTR(" Topic:%s"), MQTT_log[i].topic); + myDebug_P(PSTR(" Topic: %s"), MQTT_log[i].topic); } } } diff --git a/src/custom.js b/src/custom.js index 12468ee6d..0de8b6a48 100644 --- a/src/custom.js +++ b/src/custom.js @@ -108,7 +108,7 @@ function listCustomStats() { } else if (type === "Heat Pump") { color = "list-group-item-success"; } - l.innerHTML = obj[i].model + " (Version:" + obj[i].version + " ProductID:" + obj[i].productid + " DeviceID:0x" + obj[i].deviceid + ")"; + l.innerHTML = obj[i].model + " (DeviceID: 0x" + obj[i].deviceid + ", ProductID: " + obj[i].productid + ", Version: " + obj[i].version + ")"; l.className = "list-group-item " + color; list.appendChild(l); } diff --git a/src/ems-esp.cpp b/src/ems-esp.cpp index dc8af7844..68a57ae77 100644 --- a/src/ems-esp.cpp +++ b/src/ems-esp.cpp @@ -247,7 +247,7 @@ void showInfo() { (ems_getBoilerEnabled() ? "enabled" : "disabled"), (ems_getThermostatEnabled() ? "enabled" : "disabled"), (ems_getSolarModuleEnabled() ? "enabled" : "disabled"), - (ems_getMixingDeviceEnabled() ? "enabled" : "disabled")); + (ems_getMixingModuleEnabled() ? "enabled" : "disabled")); myDebug_P(PSTR(" Shower Timer: %s, Shower Alert: %s"), ((EMSESP_Settings.shower_timer) ? "enabled" : "disabled"), @@ -485,7 +485,7 @@ void showInfo() { } // Mixing modules sensors - if (ems_getMixingDeviceEnabled()) { + if (ems_getMixingModuleEnabled()) { myDebug_P(PSTR("")); // newline myDebug_P(PSTR("%sMixing module data:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF); myDebug_P(PSTR(" Mixing Module: %s"), ems_getDeviceDescription(EMS_DEVICE_TYPE_MIXING, buffer_type, false)); @@ -530,7 +530,7 @@ void showInfo() { for (uint8_t i = 0; i < EMSESP_Settings.dallas_sensors; i++) { float sensorValue = ds18.getValue(i); if (sensorValue != DS18_DISCONNECTED) { - myDebug_P(PSTR(" Sensor #%d type:%s id:%s temperature: %s C"), + myDebug_P(PSTR(" Sensor #%d type: %s id: %s temperature: %s C"), i + 1, ds18.getDeviceType(buffer, i), ds18.getDeviceID(buffer2, i), @@ -549,7 +549,7 @@ void scanDallas() { char buffer[128]; char buffer2[128]; for (uint8_t i = 0; i < EMSESP_Settings.dallas_sensors; i++) { - myDebug_P(PSTR("External temperature sensor type:%s id:%s found"), ds18.getDeviceType(buffer, i), ds18.getDeviceID(buffer2, i)); + myDebug_P(PSTR("External temperature sensor type: %s id: %s found"), ds18.getDeviceType(buffer, i), ds18.getDeviceID(buffer2, i)); } } } @@ -789,7 +789,7 @@ void publishEMSValues(bool force) { } // handle the mixing values - if (ems_getMixingDeviceEnabled() && (ems_Device_has_flags(EMS_DEVICE_UPDATE_FLAG_MIXING) || force)) { + if (ems_getMixingModuleEnabled() && (ems_Device_has_flags(EMS_DEVICE_UPDATE_FLAG_MIXING) || force)) { doc.clear(); JsonObject rootMixing = doc.to(); diff --git a/src/ems.cpp b/src/ems.cpp index b5a015cc1..048550868 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -241,7 +241,7 @@ bool ems_getThermostatEnabled() { return (EMS_Thermostat.device_id != EMS_ID_NONE); } -bool ems_getMixingDeviceEnabled() { +bool ems_getMixingModuleEnabled() { return EMS_MixingModule.device_id != EMS_ID_NONE; } @@ -1737,11 +1737,11 @@ bool _addDevice(_EMS_DEVICE_TYPE device_type, uint8_t product_id, uint8_t device strlcat(line, device_desc_p, sizeof(line)); } - strlcat(line, " (DeviceID:0x", sizeof(line)); + strlcat(line, " (DeviceID: 0x", sizeof(line)); strlcat(line, _hextoa(device_id, tmp), sizeof(line)); - strlcat(line, " ProductID:", sizeof(line)); + strlcat(line, ", ProductID: ", sizeof(line)); strlcat(line, itoa(product_id, tmp, 10), sizeof(line)); - strlcat(line, " Version:", sizeof(line)); + strlcat(line, ", Version: ", sizeof(line)); strlcat(line, version, sizeof(line)); strlcat(line, ")", sizeof(line)); @@ -1913,7 +1913,7 @@ void _process_Version(_EMS_RxTelegram * EMS_RxTelegram) { EMS_MixingModule.device_desc_p = device_desc_p; EMS_MixingModule.device_flags = flags; strlcpy(EMS_MixingModule.version, version, sizeof(EMS_MixingModule.version)); - ems_doReadCommand(EMS_TYPE_MMPLUSStatusMessage_HC1, device_id); // fetch MM values + ems_getMixingModuleValues(); // fetch Mixing Module values } } @@ -2049,14 +2049,27 @@ void ems_getBoilerValues() { } /* - * Get other values from EMS devices + * Get solar values from EMS devices */ void ems_getSolarModuleValues() { if (ems_getSolarModuleEnabled()) { if (EMS_SolarModule.device_flags == EMS_DEVICE_FLAG_SM10) { - ems_doReadCommand(EMS_TYPE_SM10Monitor, EMS_ID_SM); // fetch all from SM10Monitor + ems_doReadCommand(EMS_TYPE_SM10Monitor, EMS_SolarModule.device_id); // fetch all from SM10Monitor } else if (EMS_SolarModule.device_flags == EMS_DEVICE_FLAG_SM100) { - ems_doReadCommand(EMS_TYPE_SM100Monitor, EMS_ID_SM); // fetch all from SM100Monitor + ems_doReadCommand(EMS_TYPE_SM100Monitor, EMS_SolarModule.device_id); // fetch all from SM100Monitor + } + } +} + +/* + * Get mixing module values from EMS devices + */ +void ems_getMixingModuleValues() { + if (ems_getMixingModuleEnabled()) { + if (EMS_MixingModule.device_flags == EMS_DEVICE_FLAG_MMPLUS) { + ems_doReadCommand(EMS_TYPE_MMPLUSStatusMessage_HC1, EMS_MixingModule.device_id); + } else if (EMS_MixingModule.device_flags == EMS_DEVICE_FLAG_MM10) { + ems_doReadCommand(EMS_TYPE_MMStatusMessage, EMS_MixingModule.device_id); } } } @@ -2159,7 +2172,7 @@ char * ems_getDeviceDescription(_EMS_DEVICE_TYPE device_type, char * buffer, boo device_desc_p = EMS_HeatPump.device_desc_p; version = EMS_HeatPump.version; } else if (device_type == EMS_DEVICE_TYPE_MIXING) { - enabled = ems_getMixingDeviceEnabled(); + enabled = ems_getMixingModuleEnabled(); device_id = EMS_MixingModule.device_id; product_id = EMS_MixingModule.product_id; device_desc_p = EMS_MixingModule.device_desc_p; @@ -2183,12 +2196,12 @@ char * ems_getDeviceDescription(_EMS_DEVICE_TYPE device_type, char * buffer, boo return buffer; // only interested in the model name } - strlcat(buffer, " (DeviceID:0x", size); + strlcat(buffer, " (DeviceID: 0x", size); char tmp[6] = {0}; strlcat(buffer, _hextoa(device_id, tmp), size); - strlcat(buffer, " ProductID:", size); + strlcat(buffer, ", ProductID: ", size); strlcat(buffer, itoa(product_id, tmp, 10), size); - strlcat(buffer, " Version:", size); + strlcat(buffer, ", Version: ", size); strlcat(buffer, version, size); strlcat(buffer, ")", size); @@ -2242,7 +2255,7 @@ void ems_printDevices() { } if ((it->device_type == EMS_DEVICE_TYPE_THERMOSTAT) && (EMS_Sys_Status.emsMasterThermostat == it->product_id)) { - myDebug_P(PSTR(" %s: %s%s%s (DeviceID:0x%02X ProductID:%d Version:%s) [master]"), + myDebug_P(PSTR(" %s: %s%s%s (DeviceID: 0x%02X, ProductID: %d, Version: %s) [master]"), device_type, COLOR_BOLD_ON, device_string, @@ -2252,7 +2265,7 @@ void ems_printDevices() { it->version); } else { - myDebug_P(PSTR(" %s: %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, @@ -3207,8 +3220,9 @@ 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(0x38); // HeatPump - 0x38 + Device_Ids.push_back(0x30); // Solar Module - 0x30 Device_Ids.push_back(0x09); // Controllers - 0x09 Device_Ids.push_back(0x02); // Connect - 0x02 Device_Ids.push_back(0x48); // Gateway - 0x48 diff --git a/src/ems.h b/src/ems.h index 13d8c0b6b..5693a6918 100644 --- a/src/ems.h +++ b/src/ems.h @@ -43,11 +43,13 @@ #define EMS_MIXING_MAXWWC 2 // max number of warm water circuits // Device Flags -#define EMS_DEVICE_FLAG_NONE 0 // no flags set -#define EMS_DEVICE_FLAG_SM10 10 // solar module1 -#define EMS_DEVICE_FLAG_SM100 11 // solar module2 +#define EMS_DEVICE_FLAG_NONE 0 // no flags set +#define EMS_DEVICE_FLAG_SM10 10 // solar module1 +#define EMS_DEVICE_FLAG_SM100 11 // solar module2 +#define EMS_DEVICE_FLAG_MMPLUS 12 // mixing module EMS+ +#define EMS_DEVICE_FLAG_MM10 13 // mixing modules MM10 and MM50 -// group flags specific for thermostats +// device flags specific for thermostats #define EMS_DEVICE_FLAG_NO_WRITE 0x80 // top bit set if write not supported #define EMS_DEVICE_FLAG_EASY 1 #define EMS_DEVICE_FLAG_RC10 2 @@ -433,47 +435,52 @@ typedef struct { } _EMS_Type; // function definitions -void ems_dumpBuffer(const char * prefix, uint8_t * telegram, uint8_t length); -void ems_parseTelegram(uint8_t * telegram, uint8_t len); -void ems_init(); -void ems_doReadCommand(uint16_t type, uint8_t dest); -void ems_sendRawTelegram(char * telegram); -void ems_printDevices(); -uint8_t ems_printDevices_s(char * buffer, uint16_t len); -void ems_printTxQueue(); -void ems_testTelegram(uint8_t test_num); -void ems_startupTelegrams(); -bool ems_checkEMSBUSAlive(); -void ems_clearDeviceList(); -void ems_setThermostatTemp(float temperature, uint8_t hc, uint8_t temptype = 0); -void ems_setThermostatMode(uint8_t mode, uint8_t hc); -void ems_setWarmWaterTemp(uint8_t temperature); -void ems_setFlowTemp(uint8_t temperature); -void ems_setWarmWaterActivated(bool activated); -void ems_setWarmWaterOnetime(bool activated); -void ems_setWarmWaterCirculation(bool activated); -void ems_setWarmTapWaterActivated(bool activated); -void ems_setPoll(bool b); -void ems_setLogging(_EMS_SYS_LOGGING loglevel, uint16_t type_id); -void ems_setLogging(_EMS_SYS_LOGGING loglevel, bool quiet = false); -void ems_setWarmWaterModeComfort(uint8_t comfort); -void ems_setModels(); -void ems_setTxDisabled(bool b); -void ems_setTxMode(uint8_t mode); -void ems_setMasterThermostat(uint8_t product_id); -char * ems_getDeviceDescription(_EMS_DEVICE_TYPE device_type, char * buffer, bool name_only = false); -bool ems_getDeviceTypeDescription(uint8_t device_id, char * buffer); -char * ems_getDeviceTypeName(_EMS_DEVICE_TYPE device_type, char * buffer); -void ems_getThermostatValues(); -void ems_getBoilerValues(); -void ems_getSolarModuleValues(); -bool ems_getPoll(); -bool ems_getTxEnabled(); -bool ems_getThermostatEnabled(); -bool ems_getMixingDeviceEnabled(); -bool ems_getBoilerEnabled(); -bool ems_getSolarModuleEnabled(); -bool ems_getHeatPumpEnabled(); +void ems_dumpBuffer(const char * prefix, uint8_t * telegram, uint8_t length); +void ems_parseTelegram(uint8_t * telegram, uint8_t len); +void ems_init(); +void ems_doReadCommand(uint16_t type, uint8_t dest); +void ems_sendRawTelegram(char * telegram); +void ems_printDevices(); +uint8_t ems_printDevices_s(char * buffer, uint16_t len); +void ems_printTxQueue(); +void ems_testTelegram(uint8_t test_num); +void ems_startupTelegrams(); +bool ems_checkEMSBUSAlive(); +void ems_clearDeviceList(); +void ems_setThermostatTemp(float temperature, uint8_t hc, uint8_t temptype = 0); +void ems_setThermostatMode(uint8_t mode, uint8_t hc); +void ems_setWarmWaterTemp(uint8_t temperature); +void ems_setFlowTemp(uint8_t temperature); +void ems_setWarmWaterActivated(bool activated); +void ems_setWarmWaterOnetime(bool activated); +void ems_setWarmWaterCirculation(bool activated); +void ems_setWarmTapWaterActivated(bool activated); +void ems_setPoll(bool b); +void ems_setLogging(_EMS_SYS_LOGGING loglevel, uint16_t type_id); +void ems_setLogging(_EMS_SYS_LOGGING loglevel, bool quiet = false); +void ems_setWarmWaterModeComfort(uint8_t comfort); +void ems_setModels(); +void ems_setTxDisabled(bool b); +void ems_setTxMode(uint8_t mode); +void ems_setMasterThermostat(uint8_t product_id); +char * ems_getDeviceDescription(_EMS_DEVICE_TYPE device_type, char * buffer, bool name_only = false); +bool ems_getDeviceTypeDescription(uint8_t device_id, char * buffer); +char * ems_getDeviceTypeName(_EMS_DEVICE_TYPE device_type, char * buffer); + +void ems_getThermostatValues(); +void ems_getBoilerValues(); +void ems_getSolarModuleValues(); +void ems_getMixingModuleValues(); + +bool ems_getPoll(); +bool ems_getTxEnabled(); + +bool ems_getThermostatEnabled(); +bool ems_getMixingModuleEnabled(); +bool ems_getBoilerEnabled(); +bool ems_getSolarModuleEnabled(); +bool ems_getHeatPumpEnabled(); + bool ems_getBusConnected(); _EMS_SYS_LOGGING ems_getLogging(); uint8_t ems_getThermostatModel(); diff --git a/src/ems_devices.h b/src/ems_devices.h index 59e3aa9ac..87748f3f1 100644 --- a/src/ems_devices.h +++ b/src/ems_devices.h @@ -12,11 +12,8 @@ #include "ems.h" // Fixed EMS Device 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, SM100, SM200 and ISM1 -#define EMS_ID_HP 0x38 // Heat Pump -#define EMS_ID_CONTROLLER 0x09 // controllers, some are built in +#define EMS_ID_ME 0x0B // our device, hardcoded as the "Service Key" +#define EMS_ID_BOILER 0x08 // all UBA Boilers have 0x08 /* * Common Type @@ -230,10 +227,10 @@ static const _EMS_Device EMS_Devices[] = { // // Mixing Devices - type 0x20 or 0x21 // - {160, EMS_DEVICE_TYPE_MIXING, "MM100 Mixing Module", EMS_DEVICE_FLAG_NONE}, - {161, EMS_DEVICE_TYPE_MIXING, "MM200 Mixing Module", EMS_DEVICE_FLAG_NONE}, - {69, EMS_DEVICE_TYPE_MIXING, "MM10 Mixing Module", EMS_DEVICE_FLAG_NONE}, - {159, EMS_DEVICE_TYPE_MIXING, "MM50 Mixing Module", EMS_DEVICE_FLAG_NONE}, + {160, EMS_DEVICE_TYPE_MIXING, "MM100 Mixing Module", EMS_DEVICE_FLAG_MMPLUS}, + {161, EMS_DEVICE_TYPE_MIXING, "MM200 Mixing Module", EMS_DEVICE_FLAG_MMPLUS}, + {69, EMS_DEVICE_TYPE_MIXING, "MM10 Mixing Module", EMS_DEVICE_FLAG_MM10}, + {159, EMS_DEVICE_TYPE_MIXING, "MM50 Mixing Module", EMS_DEVICE_FLAG_MM10}, // // HeatPump - type 0x38 diff --git a/src/version.h b/src/version.h index a017a338b..303603e7a 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define APP_VERSION "1.9.5b33" +#define APP_VERSION "1.9.5b34"