From b56e12f33e30d4772b9a24731dc2e6d0955a68ec Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 13 Nov 2019 22:22:51 +0100 Subject: [PATCH] added outdoor temp 0xD1 - https://github.com/proddy/EMS-ESP/issues/220 --- src/ems-esp.cpp | 2 +- src/ems.cpp | 20 +++++++++++++++++++- src/ems_devices.h | 3 +++ src/ems_utils.cpp | 2 +- src/test_data.h | 3 ++- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/ems-esp.cpp b/src/ems-esp.cpp index c98086d36..52a24c8b0 100644 --- a/src/ems-esp.cpp +++ b/src/ems-esp.cpp @@ -103,7 +103,7 @@ static const command_t project_cmds[] PROGMEM = { {true, "tx_mode ", "changes Tx logic. 1=EMS generic, 2=EMS+, 3=HT3"}, {false, "info", "show current values deciphered from the EMS messages"}, - {false, "log ", "set logging mode to none, basic, thermostat only, solar module only, raw, jabber or verbose"}, + {false, "log ", "set logging to none, basic, thermostat, solar module, raw, jabber, verbose or specific type"}, #ifdef TESTS {false, "test ", "insert a test telegram on to the EMS bus"}, diff --git a/src/ems.cpp b/src/ems.cpp index 80bae5ab7..3c9c4bd52 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -48,6 +48,9 @@ void _process_UBATotalUptimeMessage(_EMS_RxTelegram * EMS_RxTelegram); void _process_UBAParametersMessage(_EMS_RxTelegram * EMS_RxTelegram); void _process_SetPoints(_EMS_RxTelegram * EMS_RxTelegram); +// EMS+ specific +void _process_UBAOutdoorTemp(_EMS_RxTelegram * EMS_RxTelegram); + // SM10 void _process_SM10Monitor(_EMS_RxTelegram * EMS_RxTelegram); @@ -120,6 +123,9 @@ const _EMS_Type EMS_Types[] = { {EMS_TYPE_UBAParametersMessage, "UBAParametersMessage", _process_UBAParametersMessage}, {EMS_TYPE_UBASetPoints, "UBASetPoints", _process_SetPoints}, + // UBA/Boiler EMS+ + {EMS_TYPE_UBAOutdoorTemp, "UBAOutdoorTemp", _process_UBAOutdoorTemp}, + // Solar Module devices {EMS_TYPE_SM10Monitor, "SM10Monitor", _process_SM10Monitor}, {EMS_TYPE_SM100Monitor, "SM100Monitor", _process_SM100Monitor}, @@ -1307,9 +1313,12 @@ void _process_UBAMonitorFast(_EMS_RxTelegram * EMS_RxTelegram) { /** * UBAMonitorSlow - type 0x19 - central heating monitor part 2 (27 bytes long) * received every 60 seconds + * e.g. 08 00 19 00 80 00 02 41 80 00 00 00 00 00 03 91 7B 05 B8 40 00 00 00 04 92 AD 00 5E EE 80 00 (CRC=C9) #data=27 */ void _process_UBAMonitorSlow(_EMS_RxTelegram * EMS_RxTelegram) { - EMS_Boiler.extTemp = _toShort(0); // 0x8000 if not available + if (_toShort(0) != EMS_VALUE_USHORT_NOTSET) { // 0x8000 if not available + EMS_Boiler.extTemp = _toShort(0); + } // set boiler temp only if we actually have a real value if (_toShort(2) != EMS_VALUE_USHORT_NOTSET) { @@ -1323,6 +1332,15 @@ void _process_UBAMonitorSlow(_EMS_RxTelegram * EMS_RxTelegram) { EMS_Boiler.switchTemp = _toShort(25); } +/** + * UBAOutdoorTemp - type 0xD1 - external temperature + */ +void _process_UBAOutdoorTemp(_EMS_RxTelegram * EMS_RxTelegram) { + if (_toShort(0) != EMS_VALUE_USHORT_NOTSET) { // 0x8000 if not available + EMS_Boiler.extTemp = _toShort(0); + } +} + /** * type 0xB1 - data from the RC10 thermostat (0x17) * For reading the temp values only diff --git a/src/ems_devices.h b/src/ems_devices.h index a7218634b..cd55e3bf0 100644 --- a/src/ems_devices.h +++ b/src/ems_devices.h @@ -32,6 +32,9 @@ #define EMS_TYPE_UBASetPoints 0x1A #define EMS_TYPE_UBAFunctionTest 0x1D +// EMS+ specific +#define EMS_TYPE_UBAOutdoorTemp 0xD1 // external temp + #define EMS_OFFSET_UBAParameterWW_wwtemp 2 // WW Temperature #define EMS_OFFSET_UBAParameterWW_wwactivated 1 // WW Activated #define EMS_OFFSET_UBAParameterWW_wwOneTime 0x00 // WW OneTime loading diff --git a/src/ems_utils.cpp b/src/ems_utils.cpp index b622aa253..cb584a244 100644 --- a/src/ems_utils.cpp +++ b/src/ems_utils.cpp @@ -108,7 +108,7 @@ char * _ushort_to_char(char * s, uint16_t value, uint8_t decimals) { } // takes a signed short value (2 bytes), converts to a fraction and prints it -// decimals: 0 = no division, 1=divide value by 10, 2=divide by 2, 10=divide value by 100 +// decimals: 0=no division, 1=divide value by 10 (default), 2=divide by 2, 10=divide value by 100 void _renderShortValue(const char * prefix, const char * postfix, int16_t value, uint8_t decimals) { static char buffer[200] = {0}; static char s[20] = {0}; diff --git a/src/test_data.h b/src/test_data.h index c47805977..697ab0004 100644 --- a/src/test_data.h +++ b/src/test_data.h @@ -54,7 +54,8 @@ static const char * TEST_DATA[] = { "88 00 19 00 00 DC 80 00 80 00 FF FF 00 00 00 21 9A 06 E1 7C 00 00 00 06 C2 13 00 1E 90 80 00", // test 49 - check max length "30 00 FF 00 02 8E 00 00 41 82 00 00 28 36 00 00 82 21", // test 50 - SM100 "10 00 FF 08 01 B9 26", // test 51 - EMS+ 0x1B9 set temp - "10 00 F7 00 FF 01 B9 21 E9" // test 52 - EMS+ 0x1B9 F7 test + "10 00 F7 00 FF 01 B9 21 E9", // test 52 - EMS+ 0x1B9 F7 test + "08 00 D1 00 00 80" // test 53 - outdoor temp };