diff --git a/CHANGELOG.md b/CHANGELOG.md index 14d16f93b..6d31960b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [1.7.0 dev] 2019-03- +## [1.7.0 dev] 2019-04-07 ### Added @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - EMS+ support (thanks @GlennArens, @gl3nni3) - MQTT 'restart' topic to reboot ESP (thanks @balk77) - Support for multiple thermostat heating circuits like the HC1/HC2 on a RC35, also via MQTT (thanks @lobocobra) +- `boiler flowtemp` command to set the flow temperature [(issue 59)](https://github.com/proddy/EMS-ESP/issues/59) ## [1.6.0] 2019-03-24 diff --git a/lib/MyESP/MyESP.h b/lib/MyESP/MyESP.h index bc7e44669..6c4de8bf4 100644 --- a/lib/MyESP/MyESP.h +++ b/lib/MyESP/MyESP.h @@ -32,7 +32,6 @@ void custom_crash_callback(struct rst_info *, uint32_t, uint32_t); #define ets_vsnprintf vsnprintf // added for ESP32 #define OTA_PORT 8266 #else -//#include #include #define OTA_PORT 3232 #endif diff --git a/src/ems-esp.cpp b/src/ems-esp.cpp index 169eda506..cd473c644 100644 --- a/src/ems-esp.cpp +++ b/src/ems-esp.cpp @@ -118,6 +118,7 @@ command_t PROGMEM project_cmds[] = { {false, "boiler read ", "send read request to boiler"}, {false, "boiler wwtemp ", "set boiler warm water temperature"}, {false, "boiler tapwater ", "set boiler warm tap water on/off"}, + {false, "boiler flowtemp ", "set boiler flow temperature"}, {false, "boiler comfort ", "set boiler warm water comfort setting"} }; @@ -1202,6 +1203,9 @@ void TelnetCommandCallback(uint8_t wc, const char * commandLine) { ems_setWarmTapWaterActivated(false); ok = true; } + } else if (strcmp(second_cmd, "flowtemp") == 0) { + ems_setFlowTemp(_readIntNumber()); + ok = true; } } @@ -1286,7 +1290,7 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) { float f = strtof((char *)message, 0); char s[10] = {0}; myDebug("MQTT topic: new thermostat night temperature value %s", _float_to_char(s, f)); - ems_setThermostatTemp(f,1); + ems_setThermostatTemp(f, 1); } // set daytemp value @@ -1294,7 +1298,7 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) { float f = strtof((char *)message, 0); char s[10] = {0}; myDebug("MQTT topic: new thermostat day temperature value %s", _float_to_char(s, f)); - ems_setThermostatTemp(f,2); + ems_setThermostatTemp(f, 2); } // set holiday value @@ -1302,8 +1306,8 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) { float f = strtof((char *)message, 0); char s[10] = {0}; myDebug("MQTT topic: new thermostat holiday temperature value %s", _float_to_char(s, f)); - ems_setThermostatTemp(f,3); - } + ems_setThermostatTemp(f, 3); + } // wwActivated if (strcmp(topic, TOPIC_BOILER_WWACTIVATED) == 0) { diff --git a/src/ems.cpp b/src/ems.cpp index 673ccc346..1894fa383 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -1265,16 +1265,23 @@ void _process_SM10Monitor(uint8_t src, uint8_t * data, uint8_t length) { * UBASetPoint 0x1A */ void _process_SetPoints(uint8_t src, uint8_t * data, uint8_t length) { - /* + if (EMS_Sys_Status.emsLogging == EMS_SYS_LOGGING_VERBOSE) { if (length != 0) { - uint8_t setpoint = data[0]; - uint8_t hk_power = data[1]; - uint8_t ww_power = data[2]; - myDebug(" SetPoint=%d, hk_power=%d, ww_power=%d", setpoint, hk_power, ww_power); + uint8_t setpoint = data[0]; // flow temp is * 2 + uint8_t ww_power = data[2]; // power in % + + char s[5]; + char s2[5]; + strlcpy(s, itoa(setpoint >> 1, s2, 10), 5); + strlcat(s, ".", sizeof(s)); + strlcat(s, ((setpoint & 0x01) ? "5" : "0"), 5); + + myDebug(" Boiler flow temp %s C, Warm Water power %d %", s, ww_power); + } } - */ + } /** @@ -1972,6 +1979,34 @@ void ems_setWarmWaterTemp(uint8_t temperature) { EMS_TxQueue.push(EMS_TxTelegram); } +/** + * Set the boiler flow temp + */ +void ems_setFlowTemp(uint8_t temperature) { + + myDebug("Setting boiler flow temperature to %d C", temperature); + + _EMS_TxTelegram EMS_TxTelegram = EMS_TX_TELEGRAM_NEW; // create new Tx + EMS_TxTelegram.timestamp = millis(); // set timestamp + EMS_Sys_Status.txRetryCount = 0; // reset retry counter + + EMS_TxTelegram.action = EMS_TX_TELEGRAM_WRITE; + EMS_TxTelegram.dest = EMS_Boiler.type_id; + EMS_TxTelegram.type = EMS_TYPE_UBASetPoints; + EMS_TxTelegram.offset = EMS_OFFSET_UBASetPoints_flowtemp; + EMS_TxTelegram.length = EMS_MIN_TELEGRAM_LENGTH; + EMS_TxTelegram.dataValue = temperature; // value to compare against. must be a single int + + EMS_TxTelegram.type_validate = EMS_TYPE_UBASetPoints; // validate + EMS_TxTelegram.comparisonOffset = EMS_OFFSET_UBASetPoints_flowtemp; + EMS_TxTelegram.comparisonValue = temperature; + EMS_TxTelegram.comparisonPostRead = EMS_TYPE_UBASetPoints; + EMS_TxTelegram.forceRefresh = false; + + EMS_TxQueue.push(EMS_TxTelegram); + +} + /** * Set the warm water mode to comfort to Eco/Comfort * 1 = Hot, 2 = Eco, 3 = Intelligent diff --git a/src/ems.h b/src/ems.h index 7533e7af3..55d40f399 100644 --- a/src/ems.h +++ b/src/ems.h @@ -282,6 +282,7 @@ void ems_setThermostatTemp(float temperature, uint8_t temptype = 0); void ems_setThermostatMode(uint8_t mode); void ems_setThermostatHC(uint8_t hc); void ems_setWarmWaterTemp(uint8_t temperature); +void ems_setFlowTemp(uint8_t temperature); void ems_setWarmWaterActivated(bool activated); void ems_setWarmTapWaterActivated(bool activated); void ems_setPoll(bool b); diff --git a/src/ems_devices.h b/src/ems_devices.h index 79d7eb69d..efea6f0fd 100644 --- a/src/ems_devices.h +++ b/src/ems_devices.h @@ -39,6 +39,8 @@ #define EMS_VALUE_UBAParameterWW_wwComfort_Eco 0xD8 // the value for eco #define EMS_VALUE_UBAParameterWW_wwComfort_Intelligent 0xEC // the value for intelligent +#define EMS_OFFSET_UBASetPoints_flowtemp 0 // flow temp + // Other #define EMS_TYPE_SM10Monitor 0x97 // SM10Monitor diff --git a/src/version.h b/src/version.h index c5146089c..4d2ac25a2 100644 --- a/src/version.h +++ b/src/version.h @@ -6,5 +6,5 @@ #pragma once #define APP_NAME "EMS-ESP" -#define APP_VERSION "1.7.0b3" +#define APP_VERSION "1.7.0b4" #define APP_HOSTNAME "ems-esp"