From 634e7cb7cd7f1c3acc2ab7a21f9050835bbc99bc Mon Sep 17 00:00:00 2001 From: ypaindaveine Date: Sun, 1 Mar 2020 12:23:13 +0100 Subject: [PATCH] Added mixer log, and stub for EMS type 0xAC. --- src/MyESP.h | 2 +- src/ems-esp.cpp | 7 ++++++- src/ems.cpp | 35 ++++++++++++++++++++++++++++------- src/ems.h | 3 ++- src/ems_devices.h | 1 + 5 files changed, 38 insertions(+), 10 deletions(-) diff --git a/src/MyESP.h b/src/MyESP.h index 573b04e6f..25adf82aa 100644 --- a/src/MyESP.h +++ b/src/MyESP.h @@ -215,7 +215,7 @@ static_assert(sizeof(RtcmemData) <= (RTCMEM_BLOCKS * 4u), "RTCMEM struct is too typedef struct { bool set; // is it a set command? - char key[50]; + char key[55]; // longest is log (alternatively, the log command description could be shortened) char description[110]; } command_t; diff --git a/src/ems-esp.cpp b/src/ems-esp.cpp index 415aeb715..f9fa985ff 100644 --- a/src/ems-esp.cpp +++ b/src/ems-esp.cpp @@ -107,7 +107,7 @@ static const command_t project_cmds[] PROGMEM = { {true, "master_thermostat [product id]", "set default thermostat to use. No argument lists options"}, {false, "info", "show current values deciphered from the EMS messages"}, - {false, "log ", "logging: none, basic, thermo, solar, raw, jabber, verbose, watch a type or device"}, + {false, "log ", "logging: none, basic, thermo, solar, mixer, raw, jabber, verbose, watch a type or device"}, #ifdef TESTS {false, "test ", "insert a test telegram on to the EMS bus"}, @@ -231,6 +231,8 @@ void showInfo() { myDebug_P(PSTR(" System logging set to Thermostat only")); } else if (sysLog == EMS_SYS_LOGGING_SOLARMODULE) { myDebug_P(PSTR(" System logging set to Solar Module only")); + } else if (sysLog == EMS_SYS_LOGGING_MIXERMODULE) { + myDebug_P(PSTR(" System logging set to Mixer Module only")); } else if (sysLog == EMS_SYS_LOGGING_JABBER) { myDebug_P(PSTR(" System logging set to Jabber")); } else if (sysLog == EMS_SYS_LOGGING_WATCH) { @@ -1584,6 +1586,9 @@ void TelnetCommandCallback(uint8_t wc, const char * commandLine) { } else if (strcmp(second_cmd, "s") == 0) { ems_setLogging(EMS_SYS_LOGGING_SOLARMODULE); ok = true; + } else if (strcmp(second_cmd, "m") == 0) { + ems_setLogging(EMS_SYS_LOGGING_MIXERMODULE); + ok = true; } else if (strcmp(second_cmd, "r") == 0) { ems_setLogging(EMS_SYS_LOGGING_RAW); ok = true; diff --git a/src/ems.cpp b/src/ems.cpp index ac6179c46..c103e18dc 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -326,6 +326,8 @@ void ems_setLogging(_EMS_SYS_LOGGING loglevel, bool quiet) { myDebug_P(PSTR("System Logging set to Thermostat only")); } else if (loglevel == EMS_SYS_LOGGING_SOLARMODULE) { myDebug_P(PSTR("System Logging set to Solar Module only")); + } else if (loglevel == EMS_SYS_LOGGING_MIXERMODULE) { + myDebug_P(PSTR("System Logging set to Mixer Module only")); } else if (loglevel == EMS_SYS_LOGGING_RAW) { myDebug_P(PSTR("System Logging set to Raw mode")); } else if (loglevel == EMS_SYS_LOGGING_JABBER) { @@ -1079,7 +1081,7 @@ void _process_UBAMonitorFast(_EMS_RxTelegram * EMS_RxTelegram) { } /** - * UBAMonitorFast2 - type 0xE4 - central heating monitor + * UBAMonitorFast2 - type 0xE4 - central heating monitor EMS+ */ void _process_UBAMonitorFast2(_EMS_RxTelegram * EMS_RxTelegram) { _setValue(EMS_RxTelegram, &EMS_Boiler.selFlowTemp, 6); @@ -1125,7 +1127,7 @@ void _process_UBAMonitorSlow(_EMS_RxTelegram * EMS_RxTelegram) { } /** - * UBAMonitorSlow2 - type 0xE5 - central heating monitor + * UBAMonitorSlow2 - type 0xE5 - central heating monitor EMS+ */ void _process_UBAMonitorSlow2(_EMS_RxTelegram * EMS_RxTelegram) { _setValue(EMS_RxTelegram, &EMS_Boiler.fanWork, 2, 2); @@ -1139,7 +1141,7 @@ void _process_UBAMonitorSlow2(_EMS_RxTelegram * EMS_RxTelegram) { } /** - * UBAOutdoorTemp - type 0xD1 - external temperature + * UBAOutdoorTemp - type 0xD1 - external temperature EMS+ */ void _process_UBAOutdoorTemp(_EMS_RxTelegram * EMS_RxTelegram) { _setValue(EMS_RxTelegram, &EMS_Boiler.extTemp, 0); @@ -1315,6 +1317,17 @@ void _process_MMStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) { //_setValue(EMS_RxTelegram, &EMS_MixingModule.hc[hc].valveStatus, EMS_OFFSET_MMStatusMessage_valve_status); } +// Mixer Parameters - 0xAC +// We assume MM10 is on HC2 and WM10 is using HC1 +void _process_MM10ParameterMessage(_EMS_RxTelegram * EMS_RxTelegram) { + //uint8_t hc = 1; // fixed to HC2 + //EMS_MixingModule.hc[hc].active = true; + + //_setValue(EMS_RxTelegram, &EMS_MixingModule.hc[hc].flowTemp, EMS_OFFSET_MMStatusMessage_flow_temp); + //_setValue(EMS_RxTelegram, &EMS_MixingModule.hc[hc].pumpMod, EMS_OFFSET_MMStatusMessage_pump_mod); + //_setValue(EMS_RxTelegram, &EMS_MixingModule.hc[hc].flowSetTemp, EMS_OFFSET_MMStatusMessage_flow_set); +} + /** * type 0x01A5 - data from the Nefit RC1010/3000 thermostat (0x18) and RC300/310s on 0x10 * EMS+ messages may come in with different offsets so handle them here @@ -2943,9 +2956,8 @@ const _EMS_Type EMS_Types[] = { {EMS_DEVICE_UPDATE_FLAG_MIXING, EMS_TYPE_MMPLUSStatusMessage_HC4, "MMPLUSStatusMessage_HC4", _process_MMPLUSStatusMessage}, {EMS_DEVICE_UPDATE_FLAG_MIXING, EMS_TYPE_MMPLUSStatusMessage_WWC1, "MMPLUSStatusMessage_WWC1", _process_MMPLUSStatusMessageWW}, {EMS_DEVICE_UPDATE_FLAG_MIXING, EMS_TYPE_MMPLUSStatusMessage_WWC2, "MMPLUSStatusMessage_WWC2", _process_MMPLUSStatusMessageWW}, - {EMS_DEVICE_UPDATE_FLAG_MIXING, EMS_TYPE_MMStatusMessage, "MMStatusMessage", _process_MMStatusMessage} - - + {EMS_DEVICE_UPDATE_FLAG_MIXING, EMS_TYPE_MMStatusMessage, "MMStatusMessage", _process_MMStatusMessage}, + {EMS_DEVICE_UPDATE_FLAG_MIXING, EMS_TYPE_MM10ParameterMessage, "MM10ParameterMessage", _process_MM10ParameterMessage} }; // calculate sizes of arrays at compile time @@ -3039,10 +3051,19 @@ void _printMessage(_EMS_RxTelegram * EMS_RxTelegram, const int8_t show_type) { _debugPrintTelegram(output_str, EMS_RxTelegram, color_s); } } else if (EMS_Sys_Status.emsLogging == EMS_SYS_LOGGING_SOLARMODULE) { - // only print ones to/from thermostat if logging is set to thermostat only + // only print ones to/from solar module if logging is set to solar module only if ((src == EMS_SolarModule.device_id) || (dest == EMS_SolarModule.device_id)) { _debugPrintTelegram(output_str, EMS_RxTelegram, color_s); } + } else if (EMS_Sys_Status.emsLogging == EMS_SYS_LOGGING_MIXERMODULE) { + // only print ones to/from mixer module if logging is set to mixer module only + if ((src == EMS_MixingModule.device_id) || (dest == EMS_MixingModule.device_id)) { + _debugPrintTelegram(output_str, EMS_RxTelegram, color_s); + // also analyse the sequence of instructions prior to instructions to/from mixer module + // typically: EMS_TYPE_MM10ParameterMessage(0xAC) - EMS_TYPE_UBASetPoints(0x1A) - EMS_TYPE_UBAFlags(0x35) + } else if ((type == EMS_TYPE_MMStatusMessage) || (type == EMS_TYPE_MM10ParameterMessage) || (type == EMS_TYPE_UBASetPoints) || (type == EMS_TYPE_UBAFlags)) { + _debugPrintTelegram(output_str, EMS_RxTelegram, color_s); + } } else if (EMS_Sys_Status.emsLogging == EMS_SYS_LOGGING_DEVICE) { // only print ones to/from DeviceID if ((src == EMS_Sys_Status.emsLogging_ID) || (dest == EMS_Sys_Status.emsLogging_ID)) { diff --git a/src/ems.h b/src/ems.h index 98f7cb860..b5e5d00cb 100644 --- a/src/ems.h +++ b/src/ems.h @@ -125,7 +125,8 @@ typedef enum { EMS_SYS_LOGGING_WATCH, // watch a specific type ID EMS_SYS_LOGGING_BASIC, // only basic read/write messages EMS_SYS_LOGGING_THERMOSTAT, // only telegrams sent from thermostat - EMS_SYS_LOGGING_SOLARMODULE, // only telegrams sent from solarmodule + EMS_SYS_LOGGING_SOLARMODULE, // only telegrams sent from solar module + EMS_SYS_LOGGING_MIXERMODULE, // only telegrams sent from mixer module EMS_SYS_LOGGING_VERBOSE, // everything EMS_SYS_LOGGING_JABBER, // lots of debug output... EMS_SYS_LOGGING_DEVICE // watch the device ID diff --git a/src/ems_devices.h b/src/ems_devices.h index 75b6e2001..7960a0685 100644 --- a/src/ems_devices.h +++ b/src/ems_devices.h @@ -72,6 +72,7 @@ #define EMS_OFFSET_MMStatusMessage_flow_temp 1 // flow temperature #define EMS_OFFSET_MMStatusMessage_pump_mod 3 // pump modulation in percent #define EMS_OFFSET_MMStatusMessage_valve_status 4 // valve 0..255 +#define EMS_TYPE_MM10ParameterMessage 0xAC // mixer parameters // Solar Module // Assuming here that the SM200 behaves like SM100