Skip to content

Commit

Permalink
add RC100H remoteseltemp and temp correction
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDvP committed Aug 9, 2022
1 parent f96b13c commit a087974
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/devices/thermostat.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -693,15 +694,15 @@ void Thermostat::process_RC20Remote(std::shared_ptr<const Telegram> 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<const Telegram> telegram) {
void Thermostat::process_RemoteTemp(std::shared_ptr<const Telegram> telegram) {
std::shared_ptr<Thermostat::HeatingCircuit> 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, ..)
Expand All @@ -715,6 +716,11 @@ void Thermostat::process_RemoteHumidity(std::shared_ptr<const Telegram> 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<const Telegram> telegram) {
has_update(telegram, ibaCalIntTemperature_, 0);
}

// type 0x0165, ff
void Thermostat::process_JunkersSet(std::shared_ptr<const Telegram> telegram) {
std::shared_ptr<Thermostat::HeatingCircuit> hc = heating_circuit(telegram);
Expand Down Expand Up @@ -1019,6 +1025,7 @@ void Thermostat::process_RC300Set(std::shared_ptr<const Telegram> 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
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -3959,11 +3975,13 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
// heating circuit
uint8_t tag = DeviceValueTAG::TAG_HC1 + hc->hc();

// 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;
}

Expand Down Expand Up @@ -4035,6 +4053,8 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
register_device_value(tag, &hc->program, 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,
Expand Down
4 changes: 4 additions & 0 deletions src/devices/thermostat.h
Expand Up @@ -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;
Expand Down Expand Up @@ -135,6 +136,7 @@ class Thermostat : public EMSdevice {
ON,
DAYLOW,
DAYMID,
REMOTESELTEMP,
UNKNOWN

};
Expand Down Expand Up @@ -384,6 +386,7 @@ class Thermostat : public EMSdevice {
void process_JunkersSetMixer(std::shared_ptr<const Telegram> telegram);
void process_RemoteTemp(std::shared_ptr<const Telegram> telegram);
void process_RemoteHumidity(std::shared_ptr<const Telegram> telegram);
void process_RemoteCorrection(std::shared_ptr<const Telegram> telegram);

// internal helper functions
bool set_mode_n(const uint8_t mode, const uint8_t hc_num);
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/locale_EN.h
Expand Up @@ -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"))
Expand Down

0 comments on commit a087974

Please sign in to comment.