Skip to content

Commit

Permalink
map RC100H values to device and tag hc
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDvP committed Aug 11, 2022
1 parent b499d90 commit bf1ce51
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 40 deletions.
50 changes: 18 additions & 32 deletions src/devices/thermostat.cpp
Expand Up @@ -33,8 +33,7 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
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));
monitor_typeids = {};
set_typeids = {};
register_device_values(); // register device values for common values (not heating circuit)
return; // no values to add
}
// common telegram handlers
Expand Down Expand Up @@ -302,12 +301,6 @@ std::shared_ptr<Thermostat::HeatingCircuit> Thermostat::heating_circuit(std::sha
toggle_ = true;
}

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

// not found, search device-id types for remote thermostats
if (hc_num == 0 && telegram->dest >= 0x20 && telegram->dest <= 0x27) {
hc_num = telegram->dest - 0x20;
Expand Down Expand Up @@ -701,27 +694,18 @@ void Thermostat::process_RC20Remote(std::shared_ptr<const Telegram> telegram) {
// 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) {
std::shared_ptr<Thermostat::HeatingCircuit> hc = heating_circuit(telegram);
if (hc == nullptr) {
return;
}
has_update(telegram, hc->remotetemp, 0);
has_update(telegram, tempsensor1_, 0);
}

// 0x47B - for reading humidity from the RC100H remote 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);
has_update(telegram, dewtemperature_, 0);
has_update(telegram, humidity_, 1);
}

// 0x273 - for reading temperaturcorrection from the RC100H remote thermostat (0x38, 0x39, ..)
void Thermostat::process_RemoteCorrection(std::shared_ptr<const Telegram> telegram) {
heating_circuit(telegram); // create hc if it does not exist yet
has_update(telegram, ibaCalIntTemperature_, 0);
}

Expand Down Expand Up @@ -3390,6 +3374,18 @@ bool Thermostat::set_remoteseltemp(const char * value, const int8_t id) {
// 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() {
// RC100H remote with humidity, this is also EMS_DEVICE_FLAG_RC100 for set_calinttemp
if (device_id() >= 0x38 && device_id() <= 0x3F) {
// each device controls only one hc, so we tag the values
uint8_t tag = DeviceValueTAG::TAG_HC1 + device_id() - 0x38;
register_device_value(tag, &tempsensor1_, DeviceValueType::SHORT, FL_(div10), FL_(remotetemp), DeviceValueUOM::DEGREES);
register_device_value(tag, &dewtemperature_, DeviceValueType::INT, nullptr, FL_(dewTemperature), DeviceValueUOM::DEGREES);
register_device_value(tag, &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;
}

// Common for all thermostats
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &errorCode_, DeviceValueType::STRING, nullptr, FL_(errorCode), DeviceValueUOM::NONE);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &lastCode_, DeviceValueType::STRING, nullptr, FL_(lastCode), DeviceValueUOM::NONE);
Expand Down Expand Up @@ -3785,8 +3781,8 @@ void Thermostat::register_device_values() {
FL_(ibaMinExtTemperature),
DeviceValueUOM::DEGREES,
MAKE_CF_CB(set_minexttemp));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &tempsensor1_, DeviceValueType::USHORT, FL_(div10), FL_(tempsensor1), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &tempsensor2_, DeviceValueType::USHORT, FL_(div10), FL_(tempsensor2), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &tempsensor1_, DeviceValueType::SHORT, FL_(div10), FL_(tempsensor1), DeviceValueUOM::DEGREES);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &tempsensor2_, DeviceValueType::SHORT, FL_(div10), FL_(tempsensor2), DeviceValueUOM::DEGREES);
register_device_value(
DeviceValueTAG::TAG_DEVICE_DATA, &ibaDamping_, DeviceValueType::BOOL, nullptr, FL_(damping), DeviceValueUOM::NONE, MAKE_CF_CB(set_damping));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &dampedoutdoortemp_, DeviceValueType::INT, nullptr, FL_(dampedoutdoortemp), DeviceValueUOM::DEGREES);
Expand Down Expand Up @@ -3979,16 +3975,6 @@ 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, 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::UINT, nullptr, FL_(dewTemperature), DeviceValueUOM::DEGREES);
register_device_value(tag, &hc->humidity, DeviceValueType::UINT, 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;
}

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

// RC 10
uint8_t reducehours; // night reduce duration
Expand Down Expand Up @@ -197,12 +195,14 @@ class Thermostat : public EMSdevice {
uint8_t offtemp_; // Set Temperature when mode is Off / 10 (e.g.: 0x0F = 7.5 degrees Celsius)
uint8_t mixingvalves_; // Number of Mixing Valves: (0x00=0, 0x01=1, 0x02=2)

int8_t dampedoutdoortemp_;
uint16_t tempsensor1_;
uint16_t tempsensor2_;
int16_t dampedoutdoortemp2_;
uint8_t floordrystatus_;
uint8_t floordrytemp_;
int8_t dampedoutdoortemp_;
int16_t tempsensor1_;
int16_t tempsensor2_;
int16_t dampedoutdoortemp2_;
uint8_t floordrystatus_;
uint8_t floordrytemp_;
uint8_t dewtemperature_;
uint8_t humidity_;

uint8_t wwExtra1_; // wwExtra active for wwSystem 1
uint8_t wwExtra2_;
Expand Down

0 comments on commit bf1ce51

Please sign in to comment.