Skip to content

Commit

Permalink
add reduce threshold emsesp#2288, absent mode emsesp#1957 (emsesp#2287)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDvP committed Dec 13, 2024
1 parent 502096d commit 0cc9ac4
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG_LATEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
32 changes: 32 additions & 0 deletions src/devices/thermostat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -1013,6 +1014,11 @@ void Thermostat::process_PVSettings(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, pvLowerCool_, 5);
}

// 0x16E Absent settings - hc or dhw or devcie_data? #1957
void Thermostat::process_Absent(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, absent_, 0);
}

void Thermostat::process_JunkersSetMixer(std::shared_ptr<const Telegram> telegram) {
auto hc = heating_circuit(telegram);
if (hc == nullptr) {
Expand Down Expand Up @@ -1126,6 +1132,7 @@ void Thermostat::process_RC300Set(std::shared_ptr<const Telegram> 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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -4612,6 +4643,7 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
DeviceValueUOM::NONE,
MAKE_CF_CB(set_switchProgMode));

register_device_value(tag, &hc->redThreshold, 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);
Expand Down
5 changes: 5 additions & 0 deletions src/devices/thermostat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -446,6 +448,7 @@ class Thermostat : public EMSdevice {
void process_JunkersRemoteMonitor(std::shared_ptr<const Telegram> telegram);
void process_HybridSettings(std::shared_ptr<const Telegram> telegram);
void process_PVSettings(std::shared_ptr<const Telegram> telegram);
void process_Absent(std::shared_ptr<const Telegram> telegram);
void process_JunkersSetMixer(std::shared_ptr<const Telegram> telegram);
void process_JunkersWW(std::shared_ptr<const Telegram> telegram);
void process_RemoteTemp(std::shared_ptr<const Telegram> telegram);
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/locale_translations.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.7.2-dev.4"
#define EMSESP_APP_VERSION "3.7.2-dev.5"

0 comments on commit 0cc9ac4

Please sign in to comment.