From c62502052d0d24ab636fd6855f1ce2d9d547ffb1 Mon Sep 17 00:00:00 2001 From: Christian Weithe Date: Mon, 28 Oct 2019 19:26:29 +0100 Subject: [PATCH] RC20RF tap water one time loading function --- src/ems-esp.cpp | 16 +++++++++++++++- src/ems.cpp | 22 ++++++++++++++++++++++ src/ems.h | 1 + src/ems_devices.h | 2 ++ src/my_config.h | 1 + 5 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/ems-esp.cpp b/src/ems-esp.cpp index c259f1a68..44ffee0de 100644 --- a/src/ems-esp.cpp +++ b/src/ems-esp.cpp @@ -592,6 +592,9 @@ void publishValues(bool force) { if (EMS_Boiler.wWActivated != EMS_VALUE_INT_NOTSET) rootBoiler["wWActivated"] = _bool_to_char(s, EMS_Boiler.wWActivated); + + if (EMS_Boiler.wWActivated != EMS_VALUE_INT_NOTSET) + rootBoiler["wWOnetime"] = _bool_to_char(s, EMS_Boiler.wWOneTime); if (EMS_Boiler.burnGas != EMS_VALUE_INT_NOTSET) rootBoiler["burnGas"] = _bool_to_char(s, EMS_Boiler.burnGas); @@ -1506,8 +1509,9 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) { // this is used for example for comfort, flowtemp myESP.mqttSubscribe(TOPIC_BOILER_CMD); - // these two need to be unqiue topics + // these three need to be unqiue topics myESP.mqttSubscribe(TOPIC_BOILER_CMD_WWACTIVATED); + myESP.mqttSubscribe(TOPIC_BOILER_CMD_WWONETIME); myESP.mqttSubscribe(TOPIC_BOILER_CMD_WWTEMP); // generic incoming MQTT command for EMS-ESP @@ -1621,6 +1625,16 @@ void MQTTCallback(unsigned int type, const char * topic, const char * message) { return; } + // wwOneTime + if (strcmp(topic, TOPIC_BOILER_CMD_WWONETIME) == 0) { + if (message[0] == '1' || strcmp(message, "on") == 0) { + ems_setWarmWaterOnetime(true); + } else if (message[0] == '0' || strcmp(message, "off") == 0) { + ems_setWarmWaterOnetime(false); + } + return; + } + // boiler wwtemp changes if (strcmp(topic, TOPIC_BOILER_CMD_WWTEMP) == 0) { uint8_t t = atoi((char *)message); diff --git a/src/ems.cpp b/src/ems.cpp index 02c4945ee..8dc5771c3 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -1292,6 +1292,28 @@ void _process_UBAMonitorWWMessage(_EMS_RxTelegram * EMS_RxTelegram) { EMS_Boiler.wWCurFlow = _toByte(9); } +/** + * Activate / De-activate One Time warm water 0x35 + * true = on, false = off + */ +void ems_setWarmWaterOnetime(bool activated) { + myDebug_P(PSTR("Setting boiler warm water OneTime loading %s"), activated ? "on" : "off"); + + _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.device_id; + EMS_TxTelegram.type = EMS_TYPE_UBAFlags; + EMS_TxTelegram.offset = EMS_OFFSET_UBAParameterWW_wwOneTime; + EMS_TxTelegram.length = EMS_MIN_TELEGRAM_LENGTH; + EMS_TxTelegram.type_validate = EMS_ID_NONE; // don't validate + EMS_TxTelegram.dataValue = (activated ? 0x22 : 0x02); // 0x22 is on, 0x02 is off for RC20RF + + EMS_TxQueue.push(EMS_TxTelegram); +} + /** * UBAMonitorFast - type 0x18 - central heating monitor part 1 (25 bytes long) * received every 10 seconds diff --git a/src/ems.h b/src/ems.h index 8572655fb..59a9bcb7e 100644 --- a/src/ems.h +++ b/src/ems.h @@ -408,6 +408,7 @@ void ems_setThermostatMode(uint8_t mode, uint8_t hc); void ems_setWarmWaterTemp(uint8_t temperature); void ems_setFlowTemp(uint8_t temperature); void ems_setWarmWaterActivated(bool activated); +void ems_setWarmWaterOnetime(bool activated); void ems_setWarmTapWaterActivated(bool activated); void ems_setPoll(bool b); void ems_setLogging(_EMS_SYS_LOGGING loglevel, bool silent = false); diff --git a/src/ems_devices.h b/src/ems_devices.h index 49a075d26..7c1fb5fa8 100644 --- a/src/ems_devices.h +++ b/src/ems_devices.h @@ -26,6 +26,7 @@ #define EMS_TYPE_UBAMaintenanceStatusMessage 0x1C // is an automatic monitor broadcast #define EMS_TYPE_UBAParameterWW 0x33 #define EMS_TYPE_UBATotalUptimeMessage 0x14 +#define EMS_TYPE_UBAFlags 0x35 #define EMS_TYPE_UBAMaintenanceSettingsMessage 0x15 #define EMS_TYPE_UBAParametersMessage 0x16 #define EMS_TYPE_UBASetPoints 0x1A @@ -33,6 +34,7 @@ #define EMS_OFFSET_UBAParameterWW_wwtemp 2 // WW Temperature #define EMS_OFFSET_UBAParameterWW_wwactivated 1 // WW Activated +#define EMS_OFFSET_UBAParameterWW_wwOneTime 5 // WW OneTime loading #define EMS_OFFSET_UBAParameterWW_wwComfort 9 // WW is in comfort or eco mode #define EMS_VALUE_UBAParameterWW_wwComfort_Hot 0x00 // the value for hot #define EMS_VALUE_UBAParameterWW_wwComfort_Eco 0xD8 // the value for eco diff --git a/src/my_config.h b/src/my_config.h index dfcd59578..a36662d9d 100644 --- a/src/my_config.h +++ b/src/my_config.h @@ -44,6 +44,7 @@ #define TOPIC_BOILER_CMD "boiler_cmd" // for receiving boiler commands via MQTT #define TOPIC_BOILER_CMD_WWACTIVATED "boiler_cmd_wwactivated" // change water on/off +#define TOPIC_BOILER_CMD_WWONETIME "boiler_cmd_wwonetime" // warm warter one time loading #define TOPIC_BOILER_CMD_WWTEMP "boiler_cmd_wwtemp" // wwtemp changes via MQTT #define TOPIC_BOILER_CMD_COMFORT "comfort" // ww comfort setting via MQTT #define TOPIC_BOILER_CMD_FLOWTEMP "flowtemp" // flowtemp value via MQTT