Merge branch 'v2' into v2

This commit is contained in:
Proddy
2020-06-17 17:28:09 +02:00
committed by GitHub
9 changed files with 159 additions and 56 deletions

View File

@@ -351,7 +351,7 @@ void Boiler::show_values(uuid::console::Shell & shell) {
buffer[1] = '\0';
strlcpy(s, buffer, 7);
strlcat(s, "x3min", 7);
print_value(shell, 2, F("Warm Water circulation pump freq"), FPSTR(s)); // TODO check
print_value(shell, 2, F("Warm Water circulation pump freq"), s);
}
print_value(shell, 2, F("Warm Water circulation active"), wWCirc_, nullptr, EMS_VALUE_BOOL);
@@ -395,7 +395,7 @@ void Boiler::show_values(uuid::console::Shell & shell) {
if (Helpers::hasValue(serviceCode_)) {
shell.printfln(F(" System service code: %s (%d)"), serviceCodeChar_, serviceCode_);
} else if (serviceCodeChar_[0] != '\0') {
print_value(shell, 2, F("System service code"), FPSTR(serviceCodeChar_)); // TODO check
print_value(shell, 2, F("System service code"), serviceCodeChar_);
}
// UBAParameters

View File

@@ -678,11 +678,13 @@ std::shared_ptr<Thermostat::HeatingCircuit> Thermostat::heating_circuit(std::sha
// create a new heating circuit object
heating_circuits_.emplace_back(new HeatingCircuit(hc_num, monitor_typeids[hc_num - 1], set_typeids[hc_num - 1]));
std::sort(heating_circuits_.begin(), heating_circuits_.end()); // sort based on hc number
// set the flag saying we want its data during the next auto fetch
toggle_fetch(monitor_typeids[hc_num - 1], true);
toggle_fetch(set_typeids[hc_num - 1], true);
return heating_circuits_.back();
return heating_circuits_.back(); // even after sorting, this should still point back to the newly created HC
}
// decodes the thermostat mode for the heating circuit based on the thermostat type
@@ -881,6 +883,8 @@ void Thermostat::show_values(uuid::console::Shell & shell) {
}
}
// std::sort(heating_circuits_.begin(), heating_circuits_.end()); // sort based on hc number. This has moved to the heating_circuit() function
for (const auto & hc : heating_circuits_) {
shell.printfln(F(" Heating Circuit %d:"), hc->hc_num());
@@ -1033,17 +1037,35 @@ void Thermostat::process_JunkersMonitor(std::shared_ptr<const Telegram> telegram
// type 0x02A5 - data from the Nefit RC1010/3000 thermostat (0x18) and RC300/310s on 0x10
void Thermostat::process_RC300Monitor(std::shared_ptr<const Telegram> telegram) {
// can't remember why this is here?
if (telegram->message_data[2] == 0x00) {
return;
}
std::shared_ptr<Thermostat::HeatingCircuit> hc = heating_circuit(telegram);
telegram->read_value(hc->curr_roomTemp, 0); // is * 10
// if current room temp starts with 0x90 it's usually trouble
if (telegram->message_data[0] != 0x90) {
telegram->read_value(hc->curr_roomTemp, 0); // is * 10
}
telegram->read_value(hc->mode_type, 10, 1);
telegram->read_value(hc->mode, 10, 0); // bit 1, mode (auto=1 or manual=0)
// setpoint is in offset 3 and also 7. We're sticking to 3 for now.
// also ignore if its 0 - see https://github.com/proddy/EMS-ESP/issues/256#issuecomment-585171426
telegram->read_value8(hc->setpoint_roomTemp, 3); // is * 2, force as single byte
// if manual, take the current setpoint temp at pos 6
// if auto, take the next setpoint temp at pos 7
// pos 3 is the current target temp and sometimes can be 0
// see https://github.com/proddy/EMS-ESP/issues/256#issuecomment-585171426
uint8_t pos;
if (hc->mode == 0) { // manual
pos = 6;
} else if (hc->mode == 1) { // auto
pos = 7;
} else {
pos = 3;
}
telegram->read_value8(hc->setpoint_roomTemp, pos); // is * 2, force as single byte
}
// type 0x02B9 EMS+ for reading from RC300/RC310 thermostat

View File

@@ -62,7 +62,6 @@ class Thermostat : public EMSdevice {
uint8_t designtemp = EMS_VALUE_UINT_NOTSET; // heatingcurve design temp at MinExtTemp
int8_t offsettemp = EMS_VALUE_INT_NOTSET; // heatingcurve offest temp at roomtemp signed!
uint8_t hc_num() const {
return hc_num_;
}
@@ -80,13 +79,17 @@ class Thermostat : public EMSdevice {
enum Mode : uint8_t { UNKNOWN, OFF, MANUAL, AUTO, DAY, NIGHT, HEAT, NOFROST, ECO, HOLIDAY, COMFORT, OFFSET, DESIGN, SUMMER };
// for sorting
friend inline bool operator<(const std::shared_ptr<HeatingCircuit> & lhs, const std::shared_ptr<HeatingCircuit> & rhs) {
return (lhs->hc_num_ < rhs->hc_num_);
}
private:
uint8_t hc_num_;
uint16_t monitor_typeid_;
uint16_t set_typeid_;
};
std::string mode_tostring(uint8_t mode) const;
virtual void show_values(uuid::console::Shell & shell);