Merge pull request #33 from SpaceTeddy/master

RC35: MQTT day/night/auto mode; sets setpoint temperature in type 0x3D depends on current night/day Mode
This commit is contained in:
Proddy
2019-01-12 14:47:15 +01:00
committed by GitHub
5 changed files with 24 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
/* /*
* EMS-ESP * EMS-ESP
* *
* Paul Derbyshire - https://github.com/proddy/EMS-ESP * Paul Derbyshire - https://github.com/proddy/EMS-ESP
* *
* See ChangeLog.md for history * See ChangeLog.md for history
@@ -782,8 +782,10 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) {
myDebug("MQTT topic: thermostat mode value %s", message); myDebug("MQTT topic: thermostat mode value %s", message);
if (strcmp((char *)message, "auto") == 0) { if (strcmp((char *)message, "auto") == 0) {
ems_setThermostatMode(2); ems_setThermostatMode(2);
} else if (strcmp((char *)message, "manual") == 0) { } else if (strcmp((char *)message, "day") == 0) {
ems_setThermostatMode(1); ems_setThermostatMode(1);
} else if (strcmp((char *)message, "night") == 0) {
ems_setThermostatMode(0);
} }
} }
@@ -912,7 +914,7 @@ void _showerColdShotStop() {
} }
} }
/* /*
* Shower Logic * Shower Logic
*/ */
void showerCheck() { void showerCheck() {

View File

@@ -1,8 +1,8 @@
/** /**
* ems.cpp * ems.cpp
* *
* handles all the processing of the EMS messages * handles all the processing of the EMS messages
* *
* Paul Derbyshire - https://github.com/proddy/EMS-ESP * Paul Derbyshire - https://github.com/proddy/EMS-ESP
*/ */
@@ -50,7 +50,7 @@ void _process_RC35StatusMessage(uint8_t * data, uint8_t length);
// Easy // Easy
void _process_EasyStatusMessage(uint8_t * data, uint8_t length); void _process_EasyStatusMessage(uint8_t * data, uint8_t length);
/* /*
* Recognized EMS types and the functions they call to process the telegrams * Recognized EMS types and the functions they call to process the telegrams
*/ */
const _EMS_Type EMS_Types[] = { 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.month = 0;
EMS_Thermostat.year = 0; EMS_Thermostat.year = 0;
EMS_Thermostat.mode = 255; // dummy value EMS_Thermostat.mode = 255; // dummy value
EMS_Thermostat.day_mode = 255; // dummy value
EMS_Thermostat.type_id = EMS_ID_NONE; EMS_Thermostat.type_id = EMS_ID_NONE;
EMS_Thermostat.read_supported = false; EMS_Thermostat.read_supported = false;
@@ -329,7 +330,7 @@ uint8_t _crcCalculator(uint8_t * data, uint8_t len) {
return crc; return crc;
} }
/** /**
* function to turn a telegram int (2 bytes) to a float. The source is *10 * 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) * negative values are stored as 1-compliment (https://medium.com/@LeeJulija/how-integers-are-stored-in-memory-using-twos-complement-5ba04d61a56c)
*/ */
@@ -974,7 +975,7 @@ void _process_RC30StatusMessage(uint8_t * data, uint8_t length) {
void _process_RC35StatusMessage(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.setpoint_roomTemp = ((float)data[EMS_TYPE_RC35StatusMessage_setpoint]) / (float)2;
EMS_Thermostat.curr_roomTemp = _toFloat(EMS_TYPE_RC35StatusMessage_curr, data); 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 EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back to Home Assistant via MQTT
} }
@@ -1566,7 +1567,12 @@ void ems_setThermostatTemp(float temperature) {
EMS_TxTelegram.comparisonPostRead = EMS_TYPE_RC30StatusMessage; EMS_TxTelegram.comparisonPostRead = EMS_TYPE_RC30StatusMessage;
} else if ((model_id == EMS_MODEL_RC35) || (model_id == EMS_MODEL_ES73)) { } else if ((model_id == EMS_MODEL_RC35) || (model_id == EMS_MODEL_ES73)) {
EMS_TxTelegram.type = EMS_TYPE_RC35Set; 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; EMS_TxTelegram.comparisonPostRead = EMS_TYPE_RC35StatusMessage;
} }

View File

@@ -212,6 +212,7 @@ typedef struct {
float setpoint_roomTemp; // current set temp float setpoint_roomTemp; // current set temp
float curr_roomTemp; // current room temp float curr_roomTemp; // current room temp
uint8_t mode; // 0=low, 1=manual, 2=auto uint8_t mode; // 0=low, 1=manual, 2=auto
bool day_mode; // 0=night, 1=day
uint8_t hour; uint8_t hour;
uint8_t minute; uint8_t minute;
uint8_t second; uint8_t second;

View File

@@ -7,7 +7,7 @@
#include "ems.h" #include "ems.h"
/* /*
* Boiler... * Boiler...
*/ */
#define EMS_TYPE_UBAMonitorFast 0x18 // is an automatic monitor broadcast #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_Comfort 0x00 // the value for comfort
#define EMS_VALUE_UBAParameterWW_wwComfort_Eco 0xD8 // the value for eco #define EMS_VALUE_UBAParameterWW_wwComfort_Eco 0xD8 // the value for eco
/* /*
* Thermostat... * Thermostat...
*/ */
@@ -59,6 +59,7 @@
#define EMS_OFFSET_RC35Set_mode 7 // position of thermostat mode #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_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_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 // Easy specific
#define EMS_TYPE_EasyStatusMessage 0x0A // reading values on an Easy Thermostat #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)"} {EMS_MODEL_EASY, 202, 0x18, "TC100 (e.g. Nefit Easy or CT100)"}
}; };
/* /*
* Known thermostat types and their abilities * Known thermostat types and their abilities
*/ */
const _Thermostat_Type Thermostat_Types[] = { const _Thermostat_Type Thermostat_Types[] = {

View File

@@ -1,8 +1,8 @@
/* /*
* my_config.h * my_config.h
* *
* All configurations and customization's go here * All configurations and customization's go here
* *
* Paul Derbyshire - https://github.com/proddy/EMS-ESP * Paul Derbyshire - https://github.com/proddy/EMS-ESP
*/ */