Skip to content

Commit

Permalink
wwprio for RC310 thermostat
Browse files Browse the repository at this point in the history
  • Loading branch information
tp1de committed May 27, 2022
1 parent 53d3bda commit 622a5db
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 5 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG_LATEST.md
Expand Up @@ -4,9 +4,10 @@

### Added

- Added switchonoptimization for RC310
- Added wwprio for RC310 heating circuits
- Added switchonoptimization for RC310 heating circuits
- Added enum_controlmode for RC310 (new enum list)
- Added nofrostmode, reducemode, reducetemp & noreducetemp for RC310
- Added nofrostmode, reducemode, reducetemp & noreducetemp for RC310
- Added emergencyops and emergencytemp, wwmaxtemp, wwflowtempoffset and wwcomfort1 for RC310
- WebUI optimizations, updated look&feel and better performance [#124](https://github.com/emsesp/EMS-ESP32/issues/124)
- Auto refresh of WebUI after successful firmware upload [#178](https://github.com/emsesp/EMS-ESP32/issues/178)
Expand Down
44 changes: 42 additions & 2 deletions src/devices/thermostat.cpp
Expand Up @@ -135,6 +135,7 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
} else if ((model == EMSdevice::EMS_DEVICE_FLAG_RC300) || (model == EMSdevice::EMS_DEVICE_FLAG_RC100)) {
monitor_typeids = {0x02A5, 0x02A6, 0x02A7, 0x02A8, 0x02A9, 0x02AA, 0x02AB, 0x02AC};
set_typeids = {0x02B9, 0x02BA, 0x02BB, 0x02BC, 0x02BD, 0x02BE, 0x02BF, 0x02C0};
set2_typeids = {0x02CC, 0x02CE, 0x02D0, 0x02D2}; // max. 4 heating circuits supported ny RC310
summer_typeids = {0x02AF, 0x02B0, 0x02B1, 0x02B2, 0x02B3, 0x02B4, 0x02B5, 0x02B6};
curve_typeids = {0x029B, 0x029C, 0x029D, 0x029E, 0x029F, 0x02A0, 0x02A1, 0x02A2};
summer2_typeids = {0x0471, 0x0472, 0x0473, 0x0474, 0x0475, 0x0476, 0x0477, 0x0478};
Expand All @@ -145,6 +146,9 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
register_telegram_type(curve_typeids[i], F("RC300Curves"), false, MAKE_PF_CB(process_RC300Curve));
register_telegram_type(summer2_typeids[i], F("RC300Summer2"), false, MAKE_PF_CB(process_RC300Summer2));
}
for (uint8_t i = 0; i < set2_typeids.size(); i++) {
register_telegram_type(set2_typeids[i], F("RC300Set2"), false, MAKE_PF_CB(process_RC300Set2));
}
register_telegram_type(0x2F5, F("RC300WWmode"), true, MAKE_PF_CB(process_RC300WWmode));
register_telegram_type(0x31B, F("RC300WWtemp"), true, MAKE_PF_CB(process_RC300WWtemp));
register_telegram_type(0x31D, F("RC300WWmode2"), false, MAKE_PF_CB(process_RC300WWmode2));
Expand Down Expand Up @@ -253,6 +257,16 @@ std::shared_ptr<Thermostat::HeatingCircuit> Thermostat::heating_circuit(std::sha
}
}

// not found, search set2 types
if (hc_num == 0) {
for (uint8_t i = 0; i < set2_typeids.size(); i++) {
if (set2_typeids[i] == telegram->type_id) {
hc_num = i + 1;
break;
}
}
}

// not found, search summer message types
if (hc_num == 0) {
for (uint8_t i = 0; i < summer_typeids.size(); i++) {
Expand Down Expand Up @@ -365,6 +379,9 @@ std::shared_ptr<Thermostat::HeatingCircuit> Thermostat::heating_circuit(std::sha
if (set_typeids.size()) {
toggle_fetch(set_typeids[hc_num - 1], toggle_);
}
if (set2_typeids.size()) {
toggle_fetch(set2_typeids[hc_num - 1], toggle_);
}
if (summer_typeids.size()) {
toggle_fetch(summer_typeids[hc_num - 1], toggle_);
}
Expand Down Expand Up @@ -1069,6 +1086,19 @@ void Thermostat::process_RC300Settings(std::shared_ptr<const Telegram> telegram)
has_update(telegram, ibaMinExtTemperature_, 10);
}

// 0x2CC - e.g. wwprio for RC310 hcx parameter
void Thermostat::process_RC300Set2(std::shared_ptr<const Telegram> telegram) {
// typeids are not in a raw. hc:0x2CC, hc2: 0x2CE for RC310
// telegram is either offset 3 with data lenght of 1 and values 0/1 (radiators) - 10 0B FF 03 01 CC 01 F6
// or offset 0 with data lenght of 6 bytes - offset 3 values are 0x00 or 0xFF - 10 0B FF 00 01 CE FF 13 0A FF 1E 00 20

std::shared_ptr<Thermostat::HeatingCircuit> hc = heating_circuit(telegram);
if (hc == nullptr) {
return;
}
has_update(telegram, hc->wwprio, 3);
}

// 0x267 RC300 floordrying
void Thermostat::process_RC300Floordry(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, floordrystatus_, 0);
Expand Down Expand Up @@ -1794,12 +1824,17 @@ bool Thermostat::set_wwprio(const char * value, const int8_t id) {
if (!Helpers::value2bool(value, b)) {
return false;
}

write_command(set_typeids[hc->hc()], 21, b ? 0xFF : 0x00, set_typeids[hc->hc()]);
if ((model() == EMS_DEVICE_FLAG_RC300)) {
write_command(set2_typeids[hc->hc()], 3, b ? 0xFF : 0x00, set2_typeids[hc->hc()]);
}
else {
write_command(set_typeids[hc->hc()], 21, b ? 0xFF : 0x00, set_typeids[hc->hc()]);
}

return true;
}


// sets the thermostat ww circulation working mode, where mode is a string
bool Thermostat::set_wwcircmode(const char * value, const int8_t id) {
uint8_t set = 0xFF;
Expand Down Expand Up @@ -2936,10 +2971,14 @@ bool Thermostat::set_temperature(const float temperature, const uint8_t mode, co
factor = 1;
break;
case HeatingCircuit::Mode::NOREDUCE:
set_typeid = set_typeids[hc->hc()];
validate_typeid = set_typeid;
offset = 12;
factor = 1;
break;
case HeatingCircuit::Mode::REDUCE:
set_typeid = set_typeids[hc->hc()];
validate_typeid = set_typeid;
offset = 9;
factor = 1;
break;
Expand Down Expand Up @@ -3904,6 +3943,7 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
register_device_value(tag, &hc->reducemode, DeviceValueType::ENUM, FL_(enum_reducemode1), FL_(reducemode), DeviceValueUOM::NONE, MAKE_CF_CB(set_reducemode));
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));
register_device_value(tag, &hc->wwprio, DeviceValueType::BOOL, nullptr, FL_(wwprio), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwprio));
break;
case EMS_DEVICE_FLAG_CRF:
register_device_value(tag, &hc->mode, DeviceValueType::ENUM, FL_(enum_mode5), FL_(mode), DeviceValueUOM::NONE);
Expand Down
2 changes: 2 additions & 0 deletions src/devices/thermostat.h
Expand Up @@ -161,6 +161,7 @@ class Thermostat : public EMSdevice {
// each thermostat has a list of heating controller type IDs for reading and writing
std::vector<uint16_t> monitor_typeids;
std::vector<uint16_t> set_typeids;
std::vector<uint16_t> set2_typeids;
std::vector<uint16_t> timer_typeids;
std::vector<uint16_t> timer2_typeids;
std::vector<uint16_t> summer_typeids;
Expand Down Expand Up @@ -358,6 +359,7 @@ class Thermostat : public EMSdevice {
void process_CRFMonitor(std::shared_ptr<const Telegram> telegram);
void process_RC300Monitor(std::shared_ptr<const Telegram> telegram);
void process_RC300Set(std::shared_ptr<const Telegram> telegram);
void process_RC300Set2(std::shared_ptr<const Telegram> telegram);
void process_RC300Summer(std::shared_ptr<const Telegram> telegram);
void process_RC300Summer2(std::shared_ptr<const Telegram> telegram);
void process_RC300WWmode(std::shared_ptr<const Telegram> telegram);
Expand Down
4 changes: 3 additions & 1 deletion src/emsesp.cpp
Expand Up @@ -183,9 +183,11 @@ uint8_t EMSESP::check_master_device(const uint8_t device_id, const uint16_t type
uint16_t curve_ids[] = {0x029B, 0x029C, 0x029D, 0x029E, 0x029F, 0x02A0, 0x02A1, 0x02A2};
uint16_t summer2_ids[] = {0x0471, 0x0472, 0x0473, 0x0474, 0x0475, 0x0476, 0x0477, 0x0478};
uint16_t master_ids[] = {0x02F5, 0x031B, 0x031D, 0x031E, 0x023A, 0x0267, 0x0240};
uint16_t set2_ids[] = {0x02CC, 0x02CE, 0x02D0, 0x02D2};
// look for heating circuits
for (uint8_t i = 0; i < sizeof(mon_ids) / 2; i++) {
if (type_id == mon_ids[i] || type_id == set_ids[i] || type_id == summer_ids[i] || type_id == curve_ids[i] || type_id == summer2_ids[i]) {
if (type_id == mon_ids[i] || type_id == set_ids[i] || type_id == summer_ids[i]
|| type_id == curve_ids[i] || type_id == summer2_ids[i] || type_id == set2_ids[i]) {
if (read) {
// receiving telegrams and map all to master thermostat at 0x18 (src manipulated)
return 0x18;
Expand Down

0 comments on commit 622a5db

Please sign in to comment.