From a087974acb3b278322360e32c5e35725ad917bca Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Tue, 9 Aug 2022 08:36:46 +0200 Subject: [PATCH] add RC100H remoteseltemp and temp correction --- src/devices/thermostat.cpp | 26 +++++++++++++++++++++++--- src/devices/thermostat.h | 4 ++++ src/locale_EN.h | 1 + 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 7f1ecd6a3..bfb129142 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -32,6 +32,7 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i if (device_id >= 0x38 && device_id <= 0x3F) { // RC100H remote register_telegram_type(0x042B, F("RemoteTemp"), false, MAKE_PF_CB(process_RemoteTemp)); register_telegram_type(0x047B, F("RemoteHumidity"), false, MAKE_PF_CB(process_RemoteHumidity)); + register_telegram_type(0x0273, F("RemoteCorrection"), true, MAKE_PF_CB(process_RemoteCorrection)); return; // no values to add } // common telegram handlers @@ -693,15 +694,15 @@ void Thermostat::process_RC20Remote(std::shared_ptr telegram) { } has_update(telegram, hc->remotetemp, 0); } + // 0x42B - for reading the roomtemperature from the RC100H remote thermostat (0x38, 0x39, ..) // e.g. "38 10 FF 00 03 2B 00 D1 08 2A 01" - void Thermostat::process_RemoteTemp(std::shared_ptr telegram) { +void Thermostat::process_RemoteTemp(std::shared_ptr telegram) { std::shared_ptr hc = heating_circuit(telegram); if (hc == nullptr) { return; } has_update(telegram, hc->remotetemp, 0); - } // 0x47B - for reading humidity from the RC100H remote thermostat (0x38, 0x39, ..) @@ -715,6 +716,11 @@ void Thermostat::process_RemoteHumidity(std::shared_ptr telegram has_update(telegram, hc->humidity, 1); } +// 0x273 - for reading temperaturcorrection from the RC100H remote thermostat (0x38, 0x39, ..) +void Thermostat::process_RemoteCorrection(std::shared_ptr telegram) { + has_update(telegram, ibaCalIntTemperature_, 0); +} + // type 0x0165, ff void Thermostat::process_JunkersSet(std::shared_ptr telegram) { std::shared_ptr hc = heating_circuit(telegram); @@ -1019,6 +1025,7 @@ void Thermostat::process_RC300Set(std::shared_ptr telegram) { has_enumupdate(telegram, hc->reducemode, 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); + has_update(telegram, hc->remoteseltemp, 17); // see https://github.com/emsesp/EMS-ESP32/issues/590 } // types 0x2AF ff @@ -1630,6 +1637,8 @@ bool Thermostat::set_calinttemp(const char * value, const int8_t id) { write_command(0xB0, 0, t, 0xB0); } else if (model() == EMS_DEVICE_FLAG_RC30) { write_command(EMS_TYPE_RC30Settings, 1, t, EMS_TYPE_RC30Settings); + } else if (model() == EMS_DEVICE_FLAG_RC100H) { + write_command(0x273, 0, t, 0x273); } else { write_command(EMS_TYPE_IBASettings, 2, t, EMS_TYPE_IBASettings); } @@ -2983,6 +2992,9 @@ bool Thermostat::set_temperature(const float temperature, const uint8_t mode, co factor = 1; // to write 0xFF } break; + case HeatingCircuit::Mode::REMOTESELTEMP: + offset = 0x11; + break; case HeatingCircuit::Mode::COMFORT: offset = 0x02; // comfort offset level 2 break; @@ -3367,6 +3379,10 @@ bool Thermostat::set_roominfluence(const char * value, const int8_t id) { return set_temperature_value(value, id, HeatingCircuit::Mode::ROOMINFLUENCE, true); } +bool Thermostat::set_remoteseltemp(const char * value, const int8_t id) { + return set_temperature_value(value, id, HeatingCircuit::Mode::REMOTESELTEMP); +} + // register main device values, top level for all thermostats (excluding heating circuits) // as these are done in void Thermostat::register_device_values_hc() void Thermostat::register_device_values() { @@ -3959,11 +3975,13 @@ void Thermostat::register_device_values_hc(std::shared_ptrhc(); - // RC300 remote with humidity + // RC300 remote with humidity, this is also EMS_DEVICE_FLAG_RC100 for set_calinttemp if (device_id() >= 0x38 && device_id() <= 0x3F) { register_device_value(tag, &hc->remotetemp, DeviceValueType::SHORT, FL_(div10), FL_(remotetemp), DeviceValueUOM::DEGREES); register_device_value(tag, &hc->dewtemperature, DeviceValueType::INT, nullptr, FL_(dewTemperature), DeviceValueUOM::DEGREES); register_device_value(tag, &hc->humidity, DeviceValueType::INT, nullptr, FL_(airHumidity), DeviceValueUOM::PERCENT); + register_device_value( + tag, &ibaCalIntTemperature_, DeviceValueType::INT, FL_(div10), FL_(ibaCalIntTemperature), DeviceValueUOM::DEGREES_R, MAKE_CF_CB(set_calinttemp)); return; } @@ -4035,6 +4053,8 @@ void Thermostat::register_device_values_hc(std::shared_ptrprogram, DeviceValueType::ENUM, FL_(enum_progMode), FL_(program), DeviceValueUOM::NONE, MAKE_CF_CB(set_program)); register_device_value( tag, &hc->tempautotemp, DeviceValueType::INT, FL_(div2), FL_(tempautotemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_tempautotemp), -1, 30); + register_device_value( + tag, &hc->remoteseltemp, DeviceValueType::INT, FL_(div2), FL_(remoteseltemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_remoteseltemp), -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->switchonoptimization, diff --git a/src/devices/thermostat.h b/src/devices/thermostat.h index acb3ea52b..7a3db0425 100644 --- a/src/devices/thermostat.h +++ b/src/devices/thermostat.h @@ -38,6 +38,7 @@ class Thermostat : public EMSdevice { int16_t roomTemp; int16_t remotetemp; // for readback uint8_t tempautotemp; + int8_t remoteseltemp; uint8_t mode; uint8_t modetype; uint8_t summermode; @@ -135,6 +136,7 @@ class Thermostat : public EMSdevice { ON, DAYLOW, DAYMID, + REMOTESELTEMP, UNKNOWN }; @@ -384,6 +386,7 @@ class Thermostat : public EMSdevice { void process_JunkersSetMixer(std::shared_ptr telegram); void process_RemoteTemp(std::shared_ptr telegram); void process_RemoteHumidity(std::shared_ptr telegram); + void process_RemoteCorrection(std::shared_ptr telegram); // internal helper functions bool set_mode_n(const uint8_t mode, const uint8_t hc_num); @@ -437,6 +440,7 @@ class Thermostat : public EMSdevice { bool set_wwprio(const char * value, const int8_t id); bool set_fastheatup(const char * value, const int8_t id); bool set_switchonoptimization(const char * value, const int8_t id); + bool set_remoteseltemp(const char * value, const int8_t id); // set functions - these don't use the id/hc, the parameters are ignored bool set_wwmode(const char * value, const int8_t id); diff --git a/src/locale_EN.h b/src/locale_EN.h index 2037dc022..24fc163ff 100644 --- a/src/locale_EN.h +++ b/src/locale_EN.h @@ -677,6 +677,7 @@ MAKE_PSTR_LIST(nighttemp2, F("nighttemp"), F("night temperature T1")) MAKE_PSTR_LIST(ecotemp, F("ecotemp"), F("eco temperature")) MAKE_PSTR_LIST(manualtemp, F("manualtemp"), F("manual temperature")) MAKE_PSTR_LIST(tempautotemp, F("tempautotemp"), F("temporary set temperature automode")) +MAKE_PSTR_LIST(remoteseltemp, F("remoteseltemp"), F("temporary set temperature from remote")) MAKE_PSTR_LIST(comforttemp, F("comforttemp"), F("comfort temperature")) MAKE_PSTR_LIST(summertemp, F("summertemp"), F("summer temperature")) MAKE_PSTR_LIST(designtemp, F("designtemp"), F("design temperature"))