mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
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:
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
src/ems.cpp
10
src/ems.cpp
@@ -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;
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user