From d2d3e3db8b84e4a8a378913f7e333427b8b82c60 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 23 Dec 2018 14:28:58 +0100 Subject: [PATCH 1/4] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index d8734694d..1893db526 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,7 +2,7 @@ name: Bug report about: Create a report to help us improve title: '' -labels: '' +labels: bug assignees: '' --- From 70ea72047d467fdd7c3f3e319c0ff87618e8e8fe Mon Sep 17 00:00:00 2001 From: The Codacy Badger Date: Tue, 25 Dec 2018 11:44:06 +0000 Subject: [PATCH 2/4] Add Codacy badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2b79fa89b..d1db5d055 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ EMS-ESP-Boiler is a project to build a controller circuit running with an ESP826 There are 3 parts to this project, first the design of the circuit, second the code for the ESP8266 microcontroller firmware and lastly an example configuration for Home Assistant to monitor the data and issue direct commands via MQTT. +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/b8880625bdf841d4adb2829732030887)](https://app.codacy.com/app/proddy/EMS-ESP-Boiler?utm_source=github.com&utm_medium=referral&utm_content=proddy/EMS-ESP-Boiler&utm_campaign=Badge_Grade_Settings) [![version](https://img.shields.io/badge/version-1.1.0-brightgreen.svg)](CHANGELOG.md) - [EMS-ESP-Boiler](#ems-esp-boiler) From d520b97aa73b84b2fd897fdb643b5890f753cf65 Mon Sep 17 00:00:00 2001 From: Bonusbartus <35781016+Bonusbartus@users.noreply.github.com> Date: Fri, 28 Dec 2018 11:05:37 +0100 Subject: [PATCH 3/4] added EMS_BOILER_TAPWATER_TEMPERATURE_MAX to my_config.h, not all boilers support 90 degrees max changed tapwater detection mechanism: - added EMS_BOILER.wWCurFlow to be read from 0x34 messages, this gives the current amount of tapwater flowing in dl/min - added wWCurFlow to mqtt message - added wWCurFlow to telnet statistics changed detection from: selBurnPow and selFlowTemp to wWCurFlow added the current servicecode as seen on thermostat and boieler display to telnet statistics and mqtt message --- src/boiler.ino | 20 ++++++++++++++++++++ src/ems.cpp | 14 +++++++++++--- src/ems.h | 29 ++++++++++++++++------------- src/my_config.h | 3 +++ 4 files changed, 50 insertions(+), 16 deletions(-) diff --git a/src/boiler.ino b/src/boiler.ino index e236ad58e..dbefd8b46 100644 --- a/src/boiler.ino +++ b/src/boiler.ino @@ -238,6 +238,19 @@ void _renderIntValue(const char * prefix, const char * postfix, uint8_t value) { myDebug("\n"); } +// takes an int value at prints it to debug log +void _renderIntfractionalValue(const char * prefix, const char * postfix, uint8_t value, uint8_t decimals) { + myDebug(" %s: ", prefix); + char s[20]; + myDebug("%s.", _int_to_char(s, value/(decimals*10))); + myDebug("%s", _int_to_char(s, value%(decimals*10))); + if (postfix != NULL) { + myDebug(" %s", postfix); + } + + myDebug("\n"); +} + // takes a bool value at prints it to debug log void _renderBoolValue(const char * prefix, uint8_t value) { myDebug(" %s: ", prefix); @@ -291,6 +304,7 @@ void showInfo() { // UBAMonitorWWMessage _renderFloatValue("Warm Water current temperature", "C", EMS_Boiler.wWCurTmp); + _renderIntfractionalValue("Warm Water current tapwater flow", "l/min", EMS_Boiler.wWCurFlow, 1); _renderIntValue("Warm Water # starts", "times", EMS_Boiler.wWStarts); myDebug(" Warm Water active time: %d days %d hours %d minutes\n", EMS_Boiler.wWWorkM / 1440, @@ -311,6 +325,7 @@ void showInfo() { _renderIntValue("Burner current power", "%", EMS_Boiler.curBurnPow); _renderFloatValue("Flame current", "uA", EMS_Boiler.flameCurr); _renderFloatValue("System pressure", "bar", EMS_Boiler.sysPress); + myDebug(" Current System Service Code: %c%c \n", EMS_Boiler.serviceCodeChar1, EMS_Boiler.serviceCodeChar2); // UBAMonitorSlow _renderFloatValue("Outside temperature", "C", EMS_Boiler.extTemp); @@ -382,6 +397,9 @@ void publishValues(bool force) { rootBoiler["wWSelTemp"] = _int_to_char(s, EMS_Boiler.wWSelTemp); rootBoiler["wWActivated"] = _bool_to_char(s, EMS_Boiler.wWActivated); rootBoiler["wWCurTmp"] = _float_to_char(s, EMS_Boiler.wWCurTmp); + + sprintf(s, "%i.%i", EMS_Boiler.wWCurFlow/10, EMS_Boiler.wWCurFlow%10); + rootBoiler["wWCurFlow"] = s; rootBoiler["wWHeat"] = _bool_to_char(s, EMS_Boiler.wWHeat); rootBoiler["curFlowTemp"] = _float_to_char(s, EMS_Boiler.curFlowTemp); rootBoiler["retTemp"] = _float_to_char(s, EMS_Boiler.retTemp); @@ -395,6 +413,8 @@ void publishValues(bool force) { rootBoiler["sysPress"] = _float_to_char(s, EMS_Boiler.sysPress); rootBoiler["boilTemp"] = _float_to_char(s, EMS_Boiler.boilTemp); rootBoiler["pumpMod"] = _int_to_char(s, EMS_Boiler.pumpMod); + sprintf(s, "%c%c", EMS_Boiler.serviceCodeChar1, EMS_Boiler.serviceCodeChar2); + rootBoiler["ServiceCode"] = s; size_t len = rootBoiler.measureLength(); rootBoiler.printTo(data, len + 1); // form the json string diff --git a/src/ems.cpp b/src/ems.cpp index 05cb30c2e..ba7c58349 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -176,6 +176,8 @@ void ems_init() { EMS_Boiler.curBurnPow = EMS_VALUE_INT_NOTSET; // Burner current power EMS_Boiler.flameCurr = EMS_VALUE_FLOAT_NOTSET; // Flame current in micro amps EMS_Boiler.sysPress = EMS_VALUE_FLOAT_NOTSET; // System pressure + EMS_Boiler.serviceCodeChar1 = EMS_VALUE_INT_NOTSET; // + EMS_Boiler.serviceCodeChar2 = EMS_VALUE_INT_NOTSET; // // UBAMonitorSlow EMS_Boiler.extTemp = EMS_VALUE_FLOAT_NOTSET; // Outside temperature @@ -190,6 +192,7 @@ void ems_init() { EMS_Boiler.wWStarts = EMS_VALUE_INT_NOTSET; // Warm Water # starts EMS_Boiler.wWWorkM = EMS_VALUE_INT_NOTSET; // Warm Water # minutes EMS_Boiler.wWOneTime = EMS_VALUE_INT_NOTSET; // Warm Water one time function on/off + EMS_Boiler.wWCurFlow = EMS_VALUE_INT_NOTSET; EMS_Boiler.tapwaterActive = EMS_VALUE_INT_NOTSET; // Hot tap water is on/off EMS_Boiler.heatingActive = EMS_VALUE_INT_NOTSET; // Central heating is on/off @@ -723,8 +726,8 @@ void _processType(uint8_t * telegram, uint8_t length) { bool _checkActive() { // hot tap water EMS_Boiler.tapwaterActive = - ((EMS_Boiler.selFlowTemp == 0) - && (EMS_Boiler.selBurnPow >= EMS_BOILER_BURNPOWER_TAPWATER) & (EMS_Boiler.burnGas == EMS_VALUE_INT_ON)); + ((EMS_Boiler.wWCurFlow != 0) //this is easier + && (EMS_Boiler.burnGas == EMS_VALUE_INT_ON)); // heating EMS_Boiler.heatingActive = @@ -754,6 +757,7 @@ void _process_UBAMonitorWWMessage(uint8_t * data, uint8_t length) { EMS_Boiler.wWStarts = _toLong(13, data); EMS_Boiler.wWWorkM = _toLong(10, data); EMS_Boiler.wWOneTime = bitRead(data[5], 1); + EMS_Boiler.wWCurFlow = data[9]; } /** @@ -778,6 +782,10 @@ void _process_UBAMonitorFast(uint8_t * data, uint8_t length) { EMS_Boiler.flameCurr = _toFloat(15, data); + //read the service code / installation status as appears on the display + EMS_Boiler.serviceCodeChar1 = data[18]; //ascii character 1 + EMS_Boiler.serviceCodeChar2 = data[19]; //ascii character 2 + if (data[17] == 0xFF) { // missing value for system pressure EMS_Boiler.sysPress = 0; } else { @@ -1187,7 +1195,7 @@ void ems_setThermostatMode(uint8_t mode) { */ void ems_setWarmWaterTemp(uint8_t temperature) { // check for invalid temp values - if ((temperature < 30) || (temperature > 90)) { + if ((temperature < 30) || (temperature > EMS_BOILER_TAPWATER_TEMPERATURE_MAX)) { return; } diff --git a/src/ems.h b/src/ems.h index bce7ae158..f28ac3904 100644 --- a/src/ems.h +++ b/src/ems.h @@ -162,19 +162,21 @@ typedef struct { // UBAParameterWW uint8_t wWDesiredTemp; // Warm Water desired temperature // UBAMonitorFast - uint8_t selFlowTemp; // Selected flow temperature - float curFlowTemp; // Current flow temperature - float retTemp; // Return temperature - uint8_t burnGas; // Gas on/off - uint8_t fanWork; // Fan on/off - uint8_t ignWork; // Ignition on/off - uint8_t heatPmp; // Circulating pump on/off - uint8_t wWHeat; // 3-way valve on WW - uint8_t wWCirc; // Circulation on/off - uint8_t selBurnPow; // Burner max power - uint8_t curBurnPow; // Burner current power - float flameCurr; // Flame current in micro amps - float sysPress; // System pressure + uint8_t selFlowTemp; // Selected flow temperature + float curFlowTemp; // Current flow temperature + float retTemp; // Return temperature + uint8_t burnGas; // Gas on/off + uint8_t fanWork; // Fan on/off + uint8_t ignWork; // Ignition on/off + uint8_t heatPmp; // Circulating pump on/off + uint8_t wWHeat; // 3-way valve on WW + uint8_t wWCirc; // Circulation on/off + uint8_t selBurnPow; // Burner max power + uint8_t curBurnPow; // Burner current power + float flameCurr; // Flame current in micro amps + float sysPress; // System pressure + uint8_t serviceCodeChar1; // First Character in status/service code + uint8_t serviceCodeChar2; // Second Character in status/service code // UBAMonitorSlow float extTemp; // Outside temperature @@ -189,6 +191,7 @@ typedef struct { // UBAParameterWW uint32_t wWStarts; // Warm Water # starts uint32_t wWWorkM; // Warm Water # minutes uint8_t wWOneTime; // Warm Water one time function on/off + uint8_t wWCurFlow; // Warm Water current flow in l/min // calculated values uint8_t tapwaterActive; // Hot tap water is on/off diff --git a/src/my_config.h b/src/my_config.h index d2a1a4840..ae612b8ea 100644 --- a/src/my_config.h +++ b/src/my_config.h @@ -34,6 +34,9 @@ #define EMS_BOILER_BURNPOWER_TAPWATER 100 #define EMS_BOILER_SELFLOWTEMP_HEATING 70 +//define maximum settable tapwater temperature, not every installation supports 90 degrees +#define EMS_BOILER_TAPWATER_TEMPERATURE_MAX 60 + // if using the shower timer, change these settings #define SHOWER_PAUSE_TIME 15000 // in ms. 15 seconds, max time if water is switched off & on during a shower #define SHOWER_MIN_DURATION 120000 // in ms. 2 minutes, before recognizing its a shower From 099df4d5f75c2ce1d9c4b777ce3f4a70212e0b68 Mon Sep 17 00:00:00 2001 From: Bonusbartus <35781016+Bonusbartus@users.noreply.github.com> Date: Fri, 28 Dec 2018 17:31:00 +0100 Subject: [PATCH 4/4] add functionality to get and set the tapwater eco/comfort mode --- src/boiler.ino | 3 +++ src/ems.cpp | 16 ++++++++++++++++ src/ems.h | 6 ++++++ 3 files changed, 25 insertions(+) diff --git a/src/boiler.ino b/src/boiler.ino index dbefd8b46..d89cd3fa7 100644 --- a/src/boiler.ino +++ b/src/boiler.ino @@ -299,6 +299,7 @@ void showInfo() { // UBAParameterWW _renderBoolValue("Warm Water activated", EMS_Boiler.wWActivated); _renderBoolValue("Warm Water circulation pump available", EMS_Boiler.wWCircPump); + myDebug(" Warm Water is set to %s\n", (EMS_Boiler.wWComfort ? "Comfort" : "ECO")); _renderIntValue("Warm Water selected temperature", "C", EMS_Boiler.wWSelTemp); _renderIntValue("Warm Water desired temperature", "C", EMS_Boiler.wWDesiredTemp); @@ -396,6 +397,8 @@ void publishValues(bool force) { rootBoiler["wWSelTemp"] = _int_to_char(s, EMS_Boiler.wWSelTemp); rootBoiler["wWActivated"] = _bool_to_char(s, EMS_Boiler.wWActivated); + sprintf(s, "%s", (EMS_Boiler.wWComfort ? "Comfort" : "ECO")); + rootBoiler["wWComfort"] = s; rootBoiler["wWCurTmp"] = _float_to_char(s, EMS_Boiler.wWCurTmp); sprintf(s, "%i.%i", EMS_Boiler.wWCurFlow/10, EMS_Boiler.wWCurFlow%10); diff --git a/src/ems.cpp b/src/ems.cpp index ba7c58349..e46908a04 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -161,6 +161,7 @@ void ems_init() { EMS_Boiler.wWSelTemp = EMS_VALUE_INT_NOTSET; // Warm Water selected temperature EMS_Boiler.wWCircPump = EMS_VALUE_INT_NOTSET; // Warm Water circulation pump available EMS_Boiler.wWDesiredTemp = EMS_VALUE_INT_NOTSET; // Warm Water desired temperature to prevent infection + EMS_Boiler.wWComfort = EMS_VALUE_INT_NOTSET; // UBAMonitorFast EMS_Boiler.selFlowTemp = EMS_VALUE_INT_NOTSET; // Selected flow temperature @@ -743,6 +744,7 @@ void _process_UBAParameterWW(uint8_t * data, uint8_t length) { EMS_Boiler.wWSelTemp = data[2]; EMS_Boiler.wWCircPump = (data[6] == 0xFF); // 0xFF means on EMS_Boiler.wWDesiredTemp = data[8]; + EMS_Boiler.wWComfort = (data[EMS_OFFSET_UBAParameterWW_wwComfort] == 0x00); // when we receieve this, lets force an MQTT publish EMS_Sys_Status.emsRefreshed = true; @@ -1238,6 +1240,20 @@ void ems_setWarmWaterActivated(bool activated) { EMS_TxQueue.push(EMS_TxTelegram); } +void ems_setWarmWaterModeComfort(bool comfort) { + myDebug("Setting boiler warm water to comfort mode %s\n", comfort ? "Comfort" : "Eco"); + + _EMS_TxTelegram EMS_TxTelegram = EMS_TX_TELEGRAM_NEW; // create new Tx + + EMS_TxTelegram.action = EMS_TX_TELEGRAM_WRITE; + EMS_TxTelegram.dest = EMS_ID_BOILER; + EMS_TxTelegram.type = EMS_TYPE_UBAParameterWW; + EMS_TxTelegram.offset = EMS_OFFSET_UBAParameterWW_wwComfort; + EMS_TxTelegram.length = EMS_MIN_TELEGRAM_LENGTH; + EMS_TxTelegram.type_validate = EMS_ID_NONE; // don't validate + EMS_TxTelegram.dataValue = (comfort ? EMS_VALUE_UBAParameterWW_wwComfort_Comfort : EMS_VALUE_UBAParameterWW_wwComfort_Eco); // 0x00 is on, 0xD8 is off + EMS_TxQueue.push(EMS_TxTelegram); +} /** * Activate / De-activate the Warm Tap Water * true = on, false = off diff --git a/src/ems.h b/src/ems.h index f28ac3904..066fff172 100644 --- a/src/ems.h +++ b/src/ems.h @@ -44,6 +44,10 @@ #define EMS_OFFSET_UBAParameterWW_wwtemp 2 // WW Temperature #define EMS_OFFSET_UBAParameterWW_wwactivated 1 // WW Activated +#define EMS_OFFSET_UBAParameterWW_wwComfort 9 // WW is in comfort or eco mode +#define EMS_VALUE_UBAParameterWW_wwComfort_Comfort 0x00 // the value for comfort +#define EMS_VALUE_UBAParameterWW_wwComfort_Eco 0xD8 // the value for eco + /* * Thermostat... */ @@ -160,6 +164,7 @@ typedef struct { // UBAParameterWW uint8_t wWSelTemp; // Warm Water selected temperature uint8_t wWCircPump; // Warm Water circulation pump Available uint8_t wWDesiredTemp; // Warm Water desired temperature + uint8_t wWComfort; // Warm water comfort or ECO mode // UBAMonitorFast uint8_t selFlowTemp; // Selected flow temperature @@ -253,6 +258,7 @@ void ems_setThermostatTemp(float temp); void ems_setThermostatMode(uint8_t mode); void ems_setWarmWaterTemp(uint8_t temperature); void ems_setWarmWaterActivated(bool activated); +void ems_setWarmWaterModeComfort(bool comfort); void ems_setWarmTapWaterActivated(bool activated); void ems_setExperimental(uint8_t value); void ems_setPoll(bool b);