From cec8ced7ac9deaa0a08bc26ef8db66da3c996007 Mon Sep 17 00:00:00 2001 From: Christian Weithe Date: Thu, 10 Jan 2019 22:26:33 +0100 Subject: [PATCH 1/3] - RC35: sets day/night/auto mode via mqtt command - RC35: sets setpoint temperature in type 0x3D depends on current night/day mode --- src/ems-esp.ino | 8 +++++--- src/ems.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ems-esp.ino b/src/ems-esp.ino index 4ed652b3..bf09ad0b 100644 --- a/src/ems-esp.ino +++ b/src/ems-esp.ino @@ -1,6 +1,6 @@ /* * EMS-ESP - * + * * Paul Derbyshire - https://github.com/proddy/EMS-ESP * * See ChangeLog.md for history @@ -737,8 +737,10 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) { myDebug("MQTT topic: thermostat mode value %s", message); if (strcmp((char *)message, "auto") == 0) { ems_setThermostatMode(2); - } else if (strcmp((char *)message, "manual") == 0) { + } else if (strcmp((char *)message, "day") == 0) { ems_setThermostatMode(1); + } else if (strcmp((char *)message, "night") == 0) { + ems_setThermostatMode(0); } } @@ -863,7 +865,7 @@ void _showerColdShotStop() { } } -/* +/* * Shower Logic */ void showerCheck() { diff --git a/src/ems.h b/src/ems.h index b7a74f91..f251c5e7 100644 --- a/src/ems.h +++ b/src/ems.h @@ -212,6 +212,7 @@ typedef struct { float setpoint_roomTemp; // current set temp float curr_roomTemp; // current room temp uint8_t mode; // 0=low, 1=manual, 2=auto + bool day_mode; // 0=night, 1=day uint8_t hour; uint8_t minute; uint8_t second; From 7d0f3a458ca7ba0276018a60212e5b63bac5881e Mon Sep 17 00:00:00 2001 From: Christian Weithe Date: Thu, 10 Jan 2019 22:29:12 +0100 Subject: [PATCH 2/3] - RC35: sets setpoint temperature in type 0x3D depends on current --- src/ems.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ems.cpp b/src/ems.cpp index f934b4e6..c25f6023 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -1,8 +1,8 @@ /** * ems.cpp - * + * * handles all the processing of the EMS messages - * + * * Paul Derbyshire - https://github.com/proddy/EMS-ESP */ @@ -50,7 +50,7 @@ void _process_RC35StatusMessage(uint8_t * data, uint8_t length); // Easy void _process_EasyStatusMessage(uint8_t * data, uint8_t length); -/* +/* * Recognized EMS types and the functions they call to process the telegrams */ const _EMS_Type EMS_Types[] = { @@ -165,6 +165,7 @@ void ems_init(uint8_t boiler_modelid, uint8_t thermostat_modelid) { EMS_Thermostat.month = 0; EMS_Thermostat.year = 0; EMS_Thermostat.mode = 255; // dummy value + EMS_Thermostat.day_mode = 255; // dummy value EMS_Thermostat.type_id = EMS_ID_NONE; EMS_Thermostat.read_supported = false; @@ -326,7 +327,7 @@ uint8_t _crcCalculator(uint8_t * data, uint8_t len) { return crc; } -/** +/** * function to turn a telegram int (2 bytes) to a float. The source is *10 * negative values are stored as 1-compliment (https://medium.com/@LeeJulija/how-integers-are-stored-in-memory-using-twos-complement-5ba04d61a56c) */ @@ -971,7 +972,7 @@ void _process_RC30StatusMessage(uint8_t * data, uint8_t length) { void _process_RC35StatusMessage(uint8_t * data, uint8_t length) { EMS_Thermostat.setpoint_roomTemp = ((float)data[EMS_TYPE_RC35StatusMessage_setpoint]) / (float)2; EMS_Thermostat.curr_roomTemp = _toFloat(EMS_TYPE_RC35StatusMessage_curr, data); - + EMS_Thermostat.day_mode = bitRead(data[EMS_OFFSET_RC35Get_mode_day], 1); //get day mode flag EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back to Home Assistant via MQTT } @@ -1563,7 +1564,12 @@ void ems_setThermostatTemp(float temperature) { EMS_TxTelegram.comparisonPostRead = EMS_TYPE_RC30StatusMessage; } else if ((model_id == EMS_MODEL_RC35) || (model_id == EMS_MODEL_ES73)) { EMS_TxTelegram.type = EMS_TYPE_RC35Set; - EMS_TxTelegram.offset = EMS_OFFSET_RC35Set_temp_day; // day mode only for now + if (EMS_Thermostat.day_mode == 0){ + EMS_TxTelegram.offset = EMS_OFFSET_RC35Set_temp_night; + } else if (EMS_Thermostat.day_mode == 1){ + EMS_TxTelegram.offset = EMS_OFFSET_RC35Set_temp_day; + } + EMS_TxTelegram.comparisonPostRead = EMS_TYPE_RC35StatusMessage; } From 5cda8a54440a57f2fee614c1117271fd0178c003 Mon Sep 17 00:00:00 2001 From: Christian Weithe Date: Thu, 10 Jan 2019 22:29:45 +0100 Subject: [PATCH 3/3] - RC35: sets setpoint temperature in type 0x3D depends on current --- src/ems_devices.h | 7 ++++--- src/my_config.h | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ems_devices.h b/src/ems_devices.h index bf57f5b1..192d8018 100644 --- a/src/ems_devices.h +++ b/src/ems_devices.h @@ -7,7 +7,7 @@ #include "ems.h" -/* +/* * Boiler... */ #define EMS_TYPE_UBAMonitorFast 0x18 // is an automatic monitor broadcast @@ -27,7 +27,7 @@ #define EMS_VALUE_UBAParameterWW_wwComfort_Comfort 0x00 // the value for comfort #define EMS_VALUE_UBAParameterWW_wwComfort_Eco 0xD8 // the value for eco -/* +/* * Thermostat... */ @@ -59,6 +59,7 @@ #define EMS_OFFSET_RC35Set_mode 7 // position of thermostat mode #define EMS_OFFSET_RC35Set_temp_day 2 // position of thermostat setpoint temperature for day time #define EMS_OFFSET_RC35Set_temp_night 1 // position of thermostat setpoint temperature for night time +#define EMS_OFFSET_RC35Get_mode_day 1 // position of thermostat day mode // Easy specific #define EMS_TYPE_EasyStatusMessage 0x0A // reading values on an Easy Thermostat @@ -117,7 +118,7 @@ const _Model_Type Model_Types[] = { {EMS_MODEL_EASY, 202, 0x18, "TC100 (e.g. Nefit Easy or CT100)"} }; -/* +/* * Known thermostat types and their abilities */ const _Thermostat_Type Thermostat_Types[] = { diff --git a/src/my_config.h b/src/my_config.h index 4b16287f..c77b3f18 100644 --- a/src/my_config.h +++ b/src/my_config.h @@ -1,8 +1,8 @@ /* * my_config.h - * + * * All configurations and customization's go here - * + * * Paul Derbyshire - https://github.com/proddy/EMS-ESP */