From 9d3426877d2d0c849a8933fd7e15f1c9944b3388 Mon Sep 17 00:00:00 2001 From: tp1de Date: Tue, 24 May 2022 16:53:01 +0200 Subject: [PATCH] reducemode1, reducetemp and noreducetemp for RC310 --- src/devices/thermostat.cpp | 36 ++++++++++++++++++++++++++++++++++++ src/devices/thermostat.h | 3 +++ src/locale_EN.h | 2 ++ 3 files changed, 41 insertions(+) diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 7be718f9b..e9d68fcee 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -959,6 +959,10 @@ void Thermostat::process_RC300Set(std::shared_ptr telegram) { has_update(telegram, hc->manualtemp, 10); // is * 2 has_enumupdate(telegram, hc->program, 11, 1); // timer program 1 or 2 + + has_enumupdate(telegram, hc->reducemode1, 5, 1); // 1-outdoor temp threshold, 2-room temp threshold, 3-reduced mode + has_update(telegram, hc->reducetemp, 9); + has_update(telegram, hc->noreducetemp, 12); } // types 0x2AF ff @@ -2399,6 +2403,27 @@ bool Thermostat::set_reducemode(const char * value, const int8_t id) { return true; } +// sets the thermostat reducemode1 for RC310 +bool Thermostat::set_reducemode1(const char * value, const int8_t id) { + uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; + std::shared_ptr hc = heating_circuit(hc_num); + if (hc == nullptr) { + return false; + } + + uint8_t set = 0xFF; + if (model() == EMS_DEVICE_FLAG_RC300 || model() == EMS_DEVICE_FLAG_RC100) { + if (Helpers::value2enum(value, set, FL_(enum_reducemode1))) { + write_command(set_typeids[hc->hc()], 5, set + 1, set_typeids[hc->hc()]); + } + } + + if (set == 0xFF) { + return false; + } + return true; +} + // sets the thermostat reducemode for RC35 vacations bool Thermostat::set_vacreducemode(const char * value, const int8_t id) { uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id; @@ -2894,6 +2919,14 @@ bool Thermostat::set_temperature(const float temperature, const uint8_t mode, co offset = 0; factor = 1; break; + case HeatingCircuit::Mode::NOREDUCE: + offset = 12; + factor = 1; + break; + case HeatingCircuit::Mode::REDUCE: + offset = 9; + factor = 1; + break; default: // HeatingCircuit::Mode::AUTO: uint8_t mode_ = hc->get_mode(); @@ -3849,6 +3882,9 @@ void Thermostat::register_device_values_hc(std::shared_ptrtempautotemp, DeviceValueType::INT, FL_(div2), FL_(tempautotemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_tempautotemp), -1, 30); register_device_value(tag, &hc->fastHeatup, DeviceValueType::UINT, nullptr, FL_(fastheatup), DeviceValueUOM::PERCENT, MAKE_CF_CB(set_fastheatup)); + register_device_value(tag, &hc->reducemode1, DeviceValueType::ENUM, FL_(enum_reducemode1), FL_(reducemode1), DeviceValueUOM::NONE, MAKE_CF_CB(set_reducemode1)); + register_device_value(tag, &hc->noreducetemp, DeviceValueType::INT, nullptr, FL_(noreducetemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_noreducetemp)); + register_device_value(tag, &hc->reducetemp, DeviceValueType::INT, nullptr, FL_(reducetemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_reducetemp)); break; case EMS_DEVICE_FLAG_CRF: register_device_value(tag, &hc->mode, DeviceValueType::ENUM, FL_(enum_mode5), FL_(mode), DeviceValueUOM::NONE); diff --git a/src/devices/thermostat.h b/src/devices/thermostat.h index 2fde27634..fa214cf24 100644 --- a/src/devices/thermostat.h +++ b/src/devices/thermostat.h @@ -63,6 +63,7 @@ class Thermostat : public EMSdevice { uint8_t minflowtemp; uint8_t maxflowtemp; uint8_t reducemode; + uint8_t reducemode1; // for RC310 uint8_t nofrostmode; uint8_t program; uint8_t controlmode; @@ -71,6 +72,7 @@ class Thermostat : public EMSdevice { uint8_t party; int8_t noreducetemp; // signed -20°C to +10°C int8_t reducetemp; + int8_t reducetemp1; int8_t vacreducetemp; uint8_t vacreducemode; uint8_t wwprio; @@ -420,6 +422,7 @@ class Thermostat : public EMSdevice { bool set_minflowtemp(const char * value, const int8_t id); bool set_maxflowtemp(const char * value, const int8_t id); bool set_reducemode(const char * value, const int8_t id); + bool set_reducemode1(const char * value, const int8_t id); // for RC310 bool set_switchtime1(const char * value, const int8_t id); bool set_switchtime2(const char * value, const int8_t id); bool set_program(const char * value, const int8_t id); diff --git a/src/locale_EN.h b/src/locale_EN.h index 5ddf6dc1e..a375976cc 100644 --- a/src/locale_EN.h +++ b/src/locale_EN.h @@ -383,6 +383,7 @@ MAKE_PSTR_LIST(enum_modetype4, F_(nofrost), F_(eco), F_(heat)) MAKE_PSTR_LIST(enum_modetype5, F_(off), F_(on)) MAKE_PSTR_LIST(enum_reducemode, F_(nofrost), F_(reduce), F_(room), F_(outdoor)) +MAKE_PSTR_LIST(enum_reducemode1, F_(outdoor), F_(room), F_(reduce)) // RC310 values: 1-3 MAKE_PSTR_LIST(enum_nofrostmode, F_(off), F_(room), F_(outdoor)) MAKE_PSTR_LIST(enum_controlmode, F_(off), F_(optimized), F_(simple), F_(mpc), F_(room), F_(power), F_(constant)) @@ -659,6 +660,7 @@ MAKE_PSTR_LIST(summermode, F("summermode"), F("summer mode")) MAKE_PSTR_LIST(holidaymode, F("holidaymode"), F("holiday mode")) MAKE_PSTR_LIST(flowtempoffset, F("flowtempoffset"), F("flow temperature offset for mixer")) MAKE_PSTR_LIST(reducemode, F("reducemode"), F("reduce mode")) +MAKE_PSTR_LIST(reducemode1, F("reducemode1"), F("reduce/setback mode")) // RC310 MAKE_PSTR_LIST(noreducetemp, F("noreducetemp"), F("no reduce below temperature")) MAKE_PSTR_LIST(reducetemp, F("reducetemp"), F("off/reduce switch temperature")) MAKE_PSTR_LIST(vacreducetemp, F("vacreducetemp"), F("vacations off/reduce switch temperature"))