From 0cc9ac4dd88bb523d8b326c58546db18bff44a3f Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Fri, 13 Dec 2024 10:14:44 +0100 Subject: [PATCH] add reduce threshold #2288, absent mode #1957 (#2287) --- CHANGELOG_LATEST.md | 2 ++ src/devices/thermostat.cpp | 32 ++++++++++++++++++++++++++++++++ src/devices/thermostat.h | 5 +++++ src/locale_translations.h | 2 ++ src/version.h | 2 +- 5 files changed, 42 insertions(+), 1 deletion(-) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 370f69511..2f7e6acc3 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -11,6 +11,8 @@ For more details go to [docs.emsesp.org](https://docs.emsesp.org/). - read 0x02A5 for thermostat CT200 [#2277](https://github.com/emsesp/EMS-ESP32/issues/2277) - Add "duplicate" option to Custom Entities [#2266](https://github.com/emsesp/EMS-ESP32/discussion/2266) - Mask bits for bool custom entities +- thermostat `reduce threshold` [#2288](https://github.com/emsesp/EMS-ESP32/issues/2288) +- thermostat `absent` [#1957](https://github.com/emsesp/EMS-ESP32/issues/1957) ## Fixed diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index b233911f9..e0cfba793 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -176,6 +176,7 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i register_telegram_type(0xBB, "HybridSettings", true, MAKE_PF_CB(process_HybridSettings)); register_telegram_type(0x23E, "PVSettings", true, MAKE_PF_CB(process_PVSettings)); register_telegram_type(0x269, "RC300Holiday1", true, MAKE_PF_CB(process_RC300Holiday)); + register_telegram_type(0x16E, "Absent", true, MAKE_PF_CB(process_Absent)); // JUNKERS/HT3 } else if (model == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) { @@ -1013,6 +1014,11 @@ void Thermostat::process_PVSettings(std::shared_ptr telegram) { has_update(telegram, pvLowerCool_, 5); } +// 0x16E Absent settings - hc or dhw or devcie_data? #1957 +void Thermostat::process_Absent(std::shared_ptr telegram) { + has_update(telegram, absent_, 0); +} + void Thermostat::process_JunkersSetMixer(std::shared_ptr telegram) { auto hc = heating_circuit(telegram); if (hc == nullptr) { @@ -1126,6 +1132,7 @@ void Thermostat::process_RC300Set(std::shared_ptr telegram) { has_update(telegram, hc->noreducetemp, 12); has_update(telegram, hc->remoteseltemp, 17); // see https://github.com/emsesp/EMS-ESP32/issues/590 has_enumupdate(telegram, hc->switchProgMode, 19, 1); // 1-level, 2-absolute + has_update(telegram, hc->redThreshold, 20); has_update(telegram, hc->boost, 23); has_update(telegram, hc->boosttime, 24); has_update(telegram, hc->cooling, 28); @@ -2700,6 +2707,29 @@ bool Thermostat::set_party(const char * value, const int8_t id) { return true; } +bool Thermostat::set_absent(const char * value, const int8_t id) { + bool b; + if (Helpers::value2bool(value, b)) { + write_command(0x16E, 0, b ? 0xFF : 0, 0x16E); + return true; + } + return false; +} + +bool Thermostat::set_redthreshold(const char * value, const int8_t id) { + auto hc = heating_circuit(id); + if (hc == nullptr) { + return false; + } + float t; + if (Helpers::value2temperature(value, t)) { + write_command(set_typeids[hc->hc()], 20, (int8_t)(t * 2), set_typeids[hc->hc()]); + return true; + } + return false; +} + + // set date&time as string dd.mm.yyyy-hh:mm:ss-dw-dst or "NTP" for setting to internet-time // dw - day of week (0..6), dst- summertime (0/1) // id is ignored @@ -4175,6 +4205,7 @@ void Thermostat::register_device_values() { DeviceValueTAG::TAG_DEVICE_DATA, &pvRaiseHeat_, DeviceValueType::INT8, FL_(pvRaiseHeat), DeviceValueUOM::K, MAKE_CF_CB(set_pvRaiseHeat), 0, 5); register_device_value( DeviceValueTAG::TAG_DEVICE_DATA, &pvLowerCool_, DeviceValueType::INT8, FL_(pvLowerCool), DeviceValueUOM::K, MAKE_CF_CB(set_pvLowerCool), -5, 0); + register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &absent_, DeviceValueType::BOOL, FL_(absent), DeviceValueUOM::NONE, MAKE_CF_CB(set_absent)); break; case EMSdevice::EMS_DEVICE_FLAG_RC10: register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, @@ -4612,6 +4643,7 @@ void Thermostat::register_device_values_hc(std::shared_ptrredThreshold, DeviceValueType::INT8, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(redthreshold), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_redthreshold)); break; case EMSdevice::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 0b01687a9..6cf92b82b 100644 --- a/src/devices/thermostat.h +++ b/src/devices/thermostat.h @@ -87,6 +87,7 @@ class Thermostat : public EMSdevice { uint8_t switchonoptimization; uint8_t statusbyte; // from RC300monitor uint8_t switchProgMode; + int8_t redThreshold; // RC 10 uint8_t reducehours; // night reduce duration uint16_t reduceminutes; // remaining minutes to night->day @@ -278,6 +279,7 @@ class Thermostat : public EMSdevice { uint8_t battery_; char vacation[8][22]; // RC30, R3000 only, only one hc + uint8_t absent_; // HybridHP uint8_t hybridStrategy_; // co2 = 1, cost = 2, temperature = 3, mix = 4 @@ -446,6 +448,7 @@ class Thermostat : public EMSdevice { void process_JunkersRemoteMonitor(std::shared_ptr telegram); void process_HybridSettings(std::shared_ptr telegram); void process_PVSettings(std::shared_ptr telegram); + void process_Absent(std::shared_ptr telegram); void process_JunkersSetMixer(std::shared_ptr telegram); void process_JunkersWW(std::shared_ptr telegram); void process_RemoteTemp(std::shared_ptr telegram); @@ -656,6 +659,8 @@ class Thermostat : public EMSdevice { bool set_coolondelay(const char * value, const int8_t id); bool set_cooloffdelay(const char * value, const int8_t id); bool set_switchProgMode(const char * value, const int8_t id); + bool set_absent(const char * value, const int8_t id); + bool set_redthreshold(const char * value, const int8_t id); }; } // namespace emsesp diff --git a/src/locale_translations.h b/src/locale_translations.h index 01cc33d5f..2d4d38052 100644 --- a/src/locale_translations.h +++ b/src/locale_translations.h @@ -759,6 +759,8 @@ MAKE_TRANSLATION(vacations5, "vacations5", "vacation dates 5", "Urlaubstage 5", MAKE_TRANSLATION(vacations6, "vacations6", "vacation dates 6", "Urlaubstage 6", "Vakantiedagen 6", "Semesterdatum 6", "urlop 6", "feriedager 6", "dates vacances 6", "izin günleri 6", "date vacanze 6", "termíny dovolenky 6", "data prázdnin 6") MAKE_TRANSLATION(vacations7, "vacations7", "vacation dates 7", "Urlaubstage 7", "Vakantiedagen 7", "Semesterdatum 7", "urlop 7", "feriedager 7", "dates vacances 7", "izin günleri 7", "date vacanze 7", "termíny dovolenky 7", "data prázdnin 7") MAKE_TRANSLATION(vacations8, "vacations8", "vacation dates 8", "Urlaubstage 8", "Vakantiedagen 8", "Semesterdatum 8", "urlop 8", "feriedager 8", "dates vacances 8", "izin günleri 8", "date vacanze 8", "termíny dovolenky 8", "data prázdnin 8") +MAKE_TRANSLATION(absent, "absent", "absent", "Abwesend", "", "", "", "", "", "", "", "", "") // TODO translate +MAKE_TRANSLATION(redthreshold, "redthreshold", "reduction threshold", "Absenkschwelle", "", "", "", "", "", "", "", "", "") // TODO translate MAKE_TRANSLATION(hpmode, "hpmode", "HP Mode", "WP-Modus", "Modus warmtepomp", "", "tryb pracy pompy ciepła", "", "", "yüksek güç modu", "Modalità Termopompa", "Režim TČ", "režim tepelného čerpadla") // TODO translate MAKE_TRANSLATION(dewoffset, "dewoffset", "dew point offset", "Taupunktdifferenz", "Offset dauwpunt", "", "przesunięcie punktu rosy", "", "", "çiğ noktası göreli", "differenza del punto di rugiada", "posun rosného bodu", "offset rosného bodu") // TODO translate diff --git a/src/version.h b/src/version.h index 075b79798..4d2245b33 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.7.2-dev.4" \ No newline at end of file +#define EMSESP_APP_VERSION "3.7.2-dev.5" \ No newline at end of file