Skip to content

Commit

Permalink
product_id 200 as thermostat RC100H, #590
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDvP committed Aug 2, 2022
1 parent 8ee70a1 commit f79258f
Show file tree
Hide file tree
Showing 7 changed files with 575 additions and 472 deletions.
978 changes: 514 additions & 464 deletions interface/package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions interface/package.json
Expand Up @@ -4,14 +4,14 @@
"private": true,
"proxy": "http://localhost:3080",
"dependencies": {
"@emotion/react": "^11.9.3",
"@emotion/styled": "^11.9.3",
"@emotion/react": "^11.10.0",
"@emotion/styled": "^11.10.0",
"@msgpack/msgpack": "^2.7.2",
"@mui/icons-material": "^5.8.4",
"@mui/material": "^5.9.2",
"@mui/material": "^5.9.3",
"@table-library/react-table-library": "4.0.10",
"@types/lodash": "^4.14.182",
"@types/node": "^18.6.2",
"@types/node": "^18.6.3",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
"@types/react-router-dom": "^5.3.3",
Expand Down
10 changes: 7 additions & 3 deletions src/device_library.h
Expand Up @@ -112,6 +112,9 @@
{191, DeviceType::THERMOSTAT, F("FR120"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model
{192, DeviceType::THERMOSTAT, F("FW120"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS},

// Thermostat remote - 0x38
{200, DeviceType::THERMOSTAT, F("RC100H"), DeviceFlags::EMS_DEVICE_FLAG_RC100H},

// Solar Modules - 0x30 (for solar), 0x2A, 0x41 (for ww)
{ 73, DeviceType::SOLAR, F("SM10"), DeviceFlags::EMS_DEVICE_FLAG_SM10},
{101, DeviceType::SOLAR, F("ISM1"), DeviceFlags::EMS_DEVICE_FLAG_ISM},
Expand All @@ -129,11 +132,12 @@
{161, DeviceType::MIXER, F("MM200"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS},
{204, DeviceType::MIXER, F("MP100"), DeviceFlags::EMS_DEVICE_FLAG_MP}, // pool

// Heat Pumps - 0x38
{200, DeviceType::HEATPUMP, F("HP Module"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
{248, DeviceType::HEATPUMP, F("Hybrid Manager HM200"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
// Heat Pumps - 0x38?
{252, DeviceType::HEATPUMP, F("HP Module"), DeviceFlags::EMS_DEVICE_FLAG_NONE},

// Heat Pumps - 0x53
{248, DeviceType::HEATPUMP, F("Hybrid Manager HM200"), DeviceFlags::EMS_DEVICE_FLAG_NONE},

// Connect devices - 0x02
{171, DeviceType::CONNECT, F("OpenTherm Converter"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
{205, DeviceType::CONNECT, F("Moduline Easy Connect"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
Expand Down
43 changes: 42 additions & 1 deletion src/devices/thermostat.cpp
Expand Up @@ -28,6 +28,12 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
: EMSdevice(device_type, device_id, product_id, version, name, flags, brand) {
uint8_t model = this->model();

// remote thermostats with humidity
if (device_id >= 0x38 && device_id <= 0x3F) { // RC100H remote
register_telegram_type(0x042B, F("RemoteTemp"), true, MAKE_PF_CB(process_RemoteTemp));
register_telegram_type(0x047B, F("RemoteHumidity"), true, MAKE_PF_CB(process_RemoteHumidity));
return; // no values to add
}
// common telegram handlers
register_telegram_type(EMS_TYPE_RCOutdoorTemp, F("RCOutdoorTemp"), false, MAKE_PF_CB(process_RCOutdoorTemp));
register_telegram_type(EMS_TYPE_RCTime, F("RCTime"), false, MAKE_PF_CB(process_RCTime));
Expand Down Expand Up @@ -288,11 +294,17 @@ std::shared_ptr<Thermostat::HeatingCircuit> Thermostat::heating_circuit(std::sha
}

// not found, search device-id types for remote thermostats
if (telegram->src >= 0x18 && telegram->src <= 0x1B) {
if (telegram->src >= 0x18 && telegram->src <= 0x1F) {
hc_num = telegram->src - 0x17;
toggle_ = true;
}

// not found, search device-id types for remote thermostats
if (telegram->src >= 0x38 && telegram->src <= 0x3F) {
hc_num = telegram->src - 0x37;
toggle_ = true;
}

// not found, search device-id types for remote thermostats
if (telegram->dest >= 0x20 && telegram->dest <= 0x27) {
hc_num = telegram->dest - 0x20;
Expand Down Expand Up @@ -681,6 +693,27 @@ void Thermostat::process_RC20Remote(std::shared_ptr<const Telegram> telegram) {
}
has_update(telegram, hc->remotetemp, 0);
}
// 0x42B - for reading the roomtemperature from the RC20/ES72 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) {
std::shared_ptr<Thermostat::HeatingCircuit> hc = heating_circuit(telegram);
if (hc == nullptr) {
return;
}
has_update(telegram, hc->remotetemp, 0);

}

// 0x47B - for reading the roomtemperature from the RC20/ES72 thermostat (0x38, 0x39, ..)
// e.g. "38 10 FF 00 03 7B 08 24 00 4B"
void Thermostat::process_RemoteHumidity(std::shared_ptr<const Telegram> telegram) {
std::shared_ptr<Thermostat::HeatingCircuit> hc = heating_circuit(telegram);
if (hc == nullptr) {
return;
}
has_update(telegram, hc->dewtemperature, 0);
has_update(telegram, hc->humidity, 1);
}

// type 0x0165, ff
void Thermostat::process_JunkersSet(std::shared_ptr<const Telegram> telegram) {
Expand Down Expand Up @@ -3926,6 +3959,14 @@ 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
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);
return;
}

// different logic on how temperature values are stored, depending on model
const __FlashStringHelper * const * seltemp_divider;
const __FlashStringHelper * const * roomtemp_divider;
Expand Down
4 changes: 4 additions & 0 deletions src/devices/thermostat.h
Expand Up @@ -83,6 +83,8 @@ class Thermostat : public EMSdevice {
uint8_t climate;
uint8_t switchonoptimization;
uint8_t statusbyte; // from RC300monitor
int8_t humidity;
int8_t dewtemperature;

// RC 10
uint8_t reducehours; // night reduce duration
Expand Down Expand Up @@ -380,6 +382,8 @@ class Thermostat : public EMSdevice {
void process_JunkersRemoteMonitor(std::shared_ptr<const Telegram> telegram);
void process_JunkersHybridSettings(std::shared_ptr<const Telegram> telegram);
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);

// internal helper functions
bool set_mode_n(const uint8_t mode, const uint8_t hc_num);
Expand Down
1 change: 1 addition & 0 deletions src/emsdevice.h
Expand Up @@ -355,6 +355,7 @@ class EMSdevice {
static constexpr uint8_t EMS_DEVICE_FLAG_RC100 = 10;
static constexpr uint8_t EMS_DEVICE_FLAG_JUNKERS = 11;
static constexpr uint8_t EMS_DEVICE_FLAG_CRF = 12; // CRF200 only monitor
static constexpr uint8_t EMS_DEVICE_FLAG_RC100H = 13; // with humidity

uint8_t count_entities();
bool has_entities() const;
Expand Down
3 changes: 3 additions & 0 deletions src/emsesp.cpp
Expand Up @@ -931,6 +931,9 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const
// first check to see if we already have it, if so update the record
for (const auto & emsdevice : emsdevices) {
if (emsdevice && emsdevice->is_device_id(device_id)) {
if (product_id == 0) { // update only with valid product_id
return true;
}
LOG_DEBUG(F("Updating details for already active deviceID 0x%02X"), device_id);
emsdevice->product_id(product_id);
emsdevice->version(version);
Expand Down

0 comments on commit f79258f

Please sign in to comment.