mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
separate thermostat mode manual/auto with day/night - https://github.com/proddy/EMS-ESP/issues/224
This commit is contained in:
@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- `system` shows local time instead of UTC
|
||||
- fixed version numbers of libraries in `platformio.ini`
|
||||
- Normalized Heating modes to `off`, `manual`, `auto`, `night` and `day` to keep generic and not Home Assistant specific (like `heat`)
|
||||
- Keeping Thermostat day/night modes separate from off/auto/manual, and setting this for the Junkers FR50
|
||||
|
||||
### Removed
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ static const command_t project_cmds[] PROGMEM = {
|
||||
{false, "send XX ...", "send raw telegram data to EMS bus (XX are hex values)"},
|
||||
{false, "thermostat read <type ID>", "send read request to the thermostat for heating circuit hc 1-4"},
|
||||
{false, "thermostat temp [hc] <degrees>", "set current thermostat temperature"},
|
||||
{false, "thermostat mode [hc] <mode>", "set mode (0=low/night, 1=manual/day, 2=auto) for heating circuit hc 1-4"},
|
||||
{false, "thermostat mode [hc] <mode>", "set mode (0=off, 1=manual, 2=auto) for heating circuit hc 1-4"},
|
||||
{false, "thermostat scan <type ID>", "probe thermostat on all type id responses"},
|
||||
{false, "boiler read <type ID>", "send read request to boiler"},
|
||||
{false, "boiler wwtemp <degrees>", "set boiler warm water temperature"},
|
||||
@@ -153,7 +153,7 @@ void myDebugLog(const char * s) {
|
||||
}
|
||||
}
|
||||
|
||||
// figures out the thermostat mode depending on the thermostat type
|
||||
// figures out the thermostat mode (manual/auto) depending on the thermostat type
|
||||
// returns {EMS_THERMOSTAT_MODE_UNKNOWN, EMS_THERMOSTAT_MODE_OFF, EMS_THERMOSTAT_MODE_MANUAL, EMS_THERMOSTAT_MODE_AUTO, EMS_THERMOSTAT_MODE_NIGHT, EMS_THERMOSTAT_MODE_DAY}
|
||||
// hc_num is 1 to 4
|
||||
_EMS_THERMOSTAT_MODE _getThermostatMode(uint8_t hc_num) {
|
||||
@@ -176,28 +176,44 @@ _EMS_THERMOSTAT_MODE _getThermostatMode(uint8_t hc_num) {
|
||||
} else if (mode == 1) {
|
||||
thermoMode = EMS_THERMOSTAT_MODE_AUTO;
|
||||
}
|
||||
} else if (model == EMS_MODEL_FW100 || model == EMS_MODEL_FW120) {
|
||||
}
|
||||
|
||||
return thermoMode;
|
||||
}
|
||||
|
||||
// figures out the thermostat day/night mode depending on the thermostat type
|
||||
// returns {EMS_THERMOSTAT_MODE_UNKNOWN, EMS_THERMOSTAT_MODE_OFF, EMS_THERMOSTAT_MODE_MANUAL, EMS_THERMOSTAT_MODE_AUTO, EMS_THERMOSTAT_MODE_NIGHT, EMS_THERMOSTAT_MODE_DAY}
|
||||
// hc_num is 1 to 4
|
||||
_EMS_THERMOSTAT_MODE _getThermostatDayMode(uint8_t hc_num) {
|
||||
_EMS_THERMOSTAT_MODE thermoMode = EMS_THERMOSTAT_MODE_UNKNOWN;
|
||||
uint8_t model = ems_getThermostatModel();
|
||||
|
||||
uint8_t mode = EMS_Thermostat.hc[hc_num - 1].day_mode;
|
||||
|
||||
if (model == EMS_MODEL_FW100 || model == EMS_MODEL_FW120 || model == EMS_MODEL_FR10 || model == EMS_MODEL_FR100 || model == EMS_MODEL_FR50) {
|
||||
if (mode == 3) {
|
||||
thermoMode = EMS_THERMOSTAT_MODE_DAY;
|
||||
} else if (mode == 2) {
|
||||
thermoMode = EMS_THERMOSTAT_MODE_NIGHT;
|
||||
} else if (mode == 1) {
|
||||
thermoMode = EMS_THERMOSTAT_MODE_OFF;
|
||||
}
|
||||
} else { // default for all other thermostats
|
||||
} else if (model == EMS_MODEL_RC35 || model == EMS_MODEL_ES73) {
|
||||
if (mode == 0) {
|
||||
thermoMode = EMS_THERMOSTAT_MODE_NIGHT;
|
||||
} else if (mode == 1) {
|
||||
thermoMode = EMS_THERMOSTAT_MODE_DAY;
|
||||
}
|
||||
} else if (model == EMS_MODEL_RC100 || model == EMS_MODEL_RC300) {
|
||||
if (mode == 0) {
|
||||
thermoMode = EMS_THERMOSTAT_MODE_NIGHT;
|
||||
} else if (mode == 1) {
|
||||
thermoMode = EMS_THERMOSTAT_MODE_DAY;
|
||||
} else if (mode == 2) {
|
||||
thermoMode = EMS_THERMOSTAT_MODE_AUTO;
|
||||
}
|
||||
}
|
||||
|
||||
return thermoMode;
|
||||
}
|
||||
|
||||
// Show command - display stats on an 's' command
|
||||
// Info - display stats on an 'info' command
|
||||
void showInfo() {
|
||||
// General stats from EMS bus
|
||||
|
||||
@@ -427,20 +443,23 @@ void showInfo() {
|
||||
_renderIntValue(" Vacation temperature", "C", EMS_Thermostat.hc[hc_num - 1].holidaytemp, 2); // convert to a single byte * 2
|
||||
}
|
||||
|
||||
// Render Termostat Mode, if we have a mode
|
||||
_EMS_THERMOSTAT_MODE thermoMode = _getThermostatMode(hc_num);
|
||||
// Render Thermostat Mode
|
||||
_EMS_THERMOSTAT_MODE thermoMode;
|
||||
thermoMode = _getThermostatMode(hc_num);
|
||||
if (thermoMode == EMS_THERMOSTAT_MODE_OFF) {
|
||||
myDebug_P(PSTR(" Mode is set to off"));
|
||||
} else if (thermoMode == EMS_THERMOSTAT_MODE_MANUAL) {
|
||||
myDebug_P(PSTR(" Mode is set to manual"));
|
||||
} else if (thermoMode == EMS_THERMOSTAT_MODE_AUTO) {
|
||||
myDebug_P(PSTR(" Mode is set to auto"));
|
||||
} else if (thermoMode == EMS_THERMOSTAT_MODE_NIGHT) {
|
||||
myDebug_P(PSTR(" Mode is set to night"));
|
||||
}
|
||||
|
||||
// Render Thermostat Day Mode
|
||||
thermoMode = _getThermostatDayMode(hc_num);
|
||||
if (thermoMode == EMS_THERMOSTAT_MODE_NIGHT) {
|
||||
myDebug_P(PSTR(" Day Mode is set to night"));
|
||||
} else if (thermoMode == EMS_THERMOSTAT_MODE_DAY) {
|
||||
myDebug_P(PSTR(" Mode is set to day"));
|
||||
} else {
|
||||
myDebug_P(PSTR(" Mode is unknown"));
|
||||
myDebug_P(PSTR(" Day Mode is set to day"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -722,21 +741,14 @@ void publishValues(bool force) {
|
||||
dataThermostat[THERMOSTAT_CIRCUITCALCTEMP] = thermostat->circuitcalctemp;
|
||||
}
|
||||
|
||||
// Thermostat Mode
|
||||
_EMS_THERMOSTAT_MODE thermoMode = _getThermostatMode(hc_v);
|
||||
|
||||
// Termostat Mode
|
||||
if (thermoMode == EMS_THERMOSTAT_MODE_OFF) {
|
||||
dataThermostat[THERMOSTAT_MODE] = "off";
|
||||
} else if (thermoMode == EMS_THERMOSTAT_MODE_MANUAL) {
|
||||
dataThermostat[THERMOSTAT_MODE] = "manual";
|
||||
} else if (thermoMode == EMS_THERMOSTAT_MODE_AUTO) {
|
||||
dataThermostat[THERMOSTAT_MODE] = "auto";
|
||||
} else if (thermoMode == EMS_THERMOSTAT_MODE_NIGHT) {
|
||||
dataThermostat[THERMOSTAT_MODE] = "off"; // for night
|
||||
} else if (thermoMode == EMS_THERMOSTAT_MODE_DAY) {
|
||||
dataThermostat[THERMOSTAT_MODE] = "manual"; // for day
|
||||
} else {
|
||||
dataThermostat[THERMOSTAT_MODE] = "auto"; // default to auto so HA doesn't complain
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1810,7 +1822,7 @@ void WebCallback(JsonObject root) {
|
||||
thermostat["tc"] = (float)EMS_Thermostat.hc[hc_num - 1].curr_roomTemp / 10;
|
||||
}
|
||||
|
||||
// Render Termostat Mode, if we have a mode
|
||||
// Render Thermostat Mode
|
||||
_EMS_THERMOSTAT_MODE thermoMode = _getThermostatMode(hc_num);
|
||||
if (thermoMode == EMS_THERMOSTAT_MODE_OFF) {
|
||||
thermostat["tmode"] = "off";
|
||||
@@ -1818,10 +1830,6 @@ void WebCallback(JsonObject root) {
|
||||
thermostat["tmode"] = "manual";
|
||||
} else if (thermoMode == EMS_THERMOSTAT_MODE_AUTO) {
|
||||
thermostat["tmode"] = "auto";
|
||||
} else if (thermoMode == EMS_THERMOSTAT_MODE_NIGHT) {
|
||||
thermostat["tmode"] = "night";
|
||||
} else if (thermoMode == EMS_THERMOSTAT_MODE_DAY) {
|
||||
thermostat["tmode"] = "day";
|
||||
}
|
||||
} else {
|
||||
thermostat["ok"] = false;
|
||||
|
||||
21
src/ems.cpp
21
src/ems.cpp
@@ -93,7 +93,7 @@ void _process_RCPLUSStatusMessage(_EMS_RxTelegram * EMS_RxTelegram);
|
||||
void _process_RCPLUSSetMessage(_EMS_RxTelegram * EMS_RxTelegram);
|
||||
void _process_RCPLUSStatusMode(_EMS_RxTelegram * EMS_RxTelegram);
|
||||
|
||||
// Junkers FR10 & FW100
|
||||
// Junkers FR10, FR50, FW100
|
||||
void _process_JunkersStatusMessage(_EMS_RxTelegram * EMS_RxTelegram);
|
||||
|
||||
// Mixers MM100
|
||||
@@ -258,7 +258,7 @@ void ems_init() {
|
||||
for (uint8_t i = 0; i < EMS_THERMOSTAT_MAXHC; i++) {
|
||||
EMS_Thermostat.hc[i].hc = i + 1;
|
||||
EMS_Thermostat.hc[i].active = false;
|
||||
EMS_Thermostat.hc[i].mode = EMS_VALUE_INT_NOTSET; // night, day, auto
|
||||
EMS_Thermostat.hc[i].mode = EMS_VALUE_INT_NOTSET;
|
||||
EMS_Thermostat.hc[i].day_mode = EMS_VALUE_INT_NOTSET;
|
||||
EMS_Thermostat.hc[i].summer_mode = EMS_VALUE_INT_NOTSET;
|
||||
EMS_Thermostat.hc[i].holiday_mode = EMS_VALUE_INT_NOTSET;
|
||||
@@ -1576,7 +1576,7 @@ void _process_RCPLUSStatusMode(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||
}
|
||||
|
||||
/**
|
||||
* FR10 Junkers - type x006F
|
||||
* FR10/FR50/FR100 Junkers - type x006F
|
||||
*/
|
||||
void _process_JunkersStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||
if (EMS_RxTelegram->offset == 0 && EMS_RxTelegram->data_length > 1) {
|
||||
@@ -1588,8 +1588,11 @@ void _process_JunkersStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||
|
||||
EMS_Thermostat.hc[hc].curr_roomTemp = _toShort(EMS_OFFSET_JunkersStatusMessage_curr); // value is * 10
|
||||
EMS_Thermostat.hc[hc].setpoint_roomTemp = _toShort(EMS_OFFSET_JunkersStatusMessage_setpoint); // value is * 10
|
||||
EMS_Thermostat.hc[hc].mode = _toByte(EMS_OFFSET_JunkersStatusMessage_mode);
|
||||
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
||||
|
||||
EMS_Thermostat.hc[hc].day_mode = _toByte(EMS_OFFSET_JunkersStatusMessage_daymode); // 3 = day, 2 = night
|
||||
EMS_Thermostat.hc[hc].mode = _toByte(EMS_OFFSET_JunkersStatusMessage_mode); // 1 = manual, 2 = auto
|
||||
|
||||
EMS_Sys_Status.emsRefreshed = true; // triggers a send the values back via MQTT
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2935,7 +2938,7 @@ void ems_setThermostatTemp(float temperature, uint8_t hc_num, uint8_t temptype)
|
||||
|
||||
/**
|
||||
* Set the thermostat working mode
|
||||
* (0=low/night, 1=manual/day, 2=auto/clock), 0xA8 on a RC20 and 0xA7 on RC30
|
||||
* 0xA8 on a RC20 and 0xA7 on RC30
|
||||
* 0x01B9 for EMS+ 300/1000/3000, Auto=0xFF Manual=0x00. See https://github.com/proddy/EMS-ESP/wiki/RC3xx-Thermostats
|
||||
* hc_num is 1 to 4
|
||||
*/
|
||||
@@ -2970,17 +2973,13 @@ void ems_setThermostatMode(uint8_t mode, uint8_t hc_num) {
|
||||
set_mode = mode;
|
||||
}
|
||||
|
||||
// 0=off, 1=manual, 2=auto, 3=night, 4=day
|
||||
// 0=off, 1=manual, 2=auto
|
||||
if (mode == 0) {
|
||||
myDebug_P(PSTR("Setting thermostat mode to off for heating circuit %d"), hc_num);
|
||||
} else if (set_mode == 1) {
|
||||
myDebug_P(PSTR("Setting thermostat mode to manual for heating circuit %d"), hc_num);
|
||||
} else if (set_mode == 2) {
|
||||
myDebug_P(PSTR("Setting thermostat mode to auto for heating circuit %d"), hc_num);
|
||||
} else if (set_mode == 3) {
|
||||
myDebug_P(PSTR("Setting thermostat mode to night for heating circuit %d"), hc_num);
|
||||
} else if (set_mode == 4) {
|
||||
myDebug_P(PSTR("Setting thermostat mode to day for heating circuit %d"), hc_num);
|
||||
}
|
||||
|
||||
_EMS_TxTelegram EMS_TxTelegram = EMS_TX_TELEGRAM_NEW; // create new Tx
|
||||
|
||||
@@ -139,9 +139,10 @@
|
||||
#define EMS_OFFSET_RCPLUSSet_temp_setpoint 8 // temp setpoint, when changing of templevel (in auto) value is reset and set to FF
|
||||
#define EMS_OFFSET_RCPLUSSet_manual_setpoint 10 // manual setpoint
|
||||
|
||||
// Junkers FR10, FW100 (EMS Plus)
|
||||
// Junkers FR10, FR50, FW100 (EMS Plus)
|
||||
#define EMS_TYPE_JunkersStatusMessage 0x6F // is an automatic thermostat broadcast giving us temps
|
||||
#define EMS_OFFSET_JunkersStatusMessage_mode 0 // current mode
|
||||
#define EMS_OFFSET_JunkersStatusMessage_daymode 0 // 3 = day, 2 = night
|
||||
#define EMS_OFFSET_JunkersStatusMessage_mode 1 // current mode, 1 = manual, 2 = auto
|
||||
#define EMS_OFFSET_JunkersStatusMessage_setpoint 2 // setpoint temp
|
||||
#define EMS_OFFSET_JunkersStatusMessage_curr 4 // current temp
|
||||
|
||||
@@ -175,7 +176,7 @@ typedef enum {
|
||||
EMS_MODEL_EASY,
|
||||
EMS_MODEL_RC300,
|
||||
EMS_MODEL_CW100,
|
||||
EMS_MODEL_1010,
|
||||
EMS_MODEL_RC100,
|
||||
EMS_MODEL_OT,
|
||||
EMS_MODEL_FW100,
|
||||
EMS_MODEL_FR10,
|
||||
@@ -290,7 +291,7 @@ const _Thermostat_Device Thermostat_Devices[] = {
|
||||
{EMS_MODEL_RC30, 78, 0x10, "RC30/Moduline 400", EMS_THERMOSTAT_WRITE_YES},
|
||||
{EMS_MODEL_RC35, 86, 0x10, "RC35", EMS_THERMOSTAT_WRITE_YES},
|
||||
{EMS_MODEL_RC300, 158, 0x10, "RC300/RC310/Moduline 3000/Bosch CW400", EMS_THERMOSTAT_WRITE_YES},
|
||||
{EMS_MODEL_1010, 165, 0x18, "RC100/Moduline 1010", EMS_THERMOSTAT_WRITE_NO},
|
||||
{EMS_MODEL_RC100, 165, 0x18, "RC100/Moduline 1010", EMS_THERMOSTAT_WRITE_NO},
|
||||
|
||||
// Sieger
|
||||
{EMS_MODEL_ES73, 76, 0x10, "Sieger ES73", EMS_THERMOSTAT_WRITE_YES},
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define APP_VERSION "1.9.4b6"
|
||||
#define APP_VERSION "1.9.4b7"
|
||||
|
||||
Reference in New Issue
Block a user