2.0.0b11 - with flow/max/min boiler temps - #59

This commit is contained in:
proddy
2020-07-31 16:08:58 +02:00
parent 09895bb461
commit 163fbba917
4 changed files with 111 additions and 11 deletions

View File

@@ -100,6 +100,9 @@ boiler
wwonetime <on | off>
wwtemp <degrees>
read <type ID>
temp <degrees>
maxpower <%>
minpower <%>
thermostat
set

View File

@@ -28,6 +28,9 @@ MAKE_PSTR_WORD(comfort)
MAKE_PSTR_WORD(eco)
MAKE_PSTR_WORD(intelligent)
MAKE_PSTR_WORD(hot)
MAKE_PSTR_WORD(maxpower)
MAKE_PSTR_WORD(minpower)
MAKE_PSTR_WORD(temp)
MAKE_PSTR(comfort_mandatory, "<hot | eco | intelligent>")
@@ -133,6 +136,33 @@ void Boiler::boiler_cmd(const char * message) {
}
return;
}
// boiler temp setting
if (strcmp(command, "temp") == 0) {
uint8_t t = doc["data"];
if (t) {
set_temp(t);
}
return;
}
// boiler max power setting
if (strcmp(command, "maxpower") == 0) {
uint8_t p = doc["data"];
if (p) {
set_max_power(p);
}
return;
}
// boiler min power setting
if (strcmp(command, "minpower") == 0) {
uint8_t p = doc["data"];
if (p) {
set_min_power(p);
}
return;
}
}
void Boiler::boiler_cmd_wwactivated(const char * message) {
@@ -186,7 +216,7 @@ void Boiler::device_info(JsonArray & root) {
// publish values via MQTT
void Boiler::publish_values() {
const size_t capacity = JSON_OBJECT_SIZE(47); // must recalculate if more objects addded https://arduinojson.org/v6/assistant/
const size_t capacity = JSON_OBJECT_SIZE(50); // must recalculate if more objects addded https://arduinojson.org/v6/assistant/
DynamicJsonDocument doc(capacity);
char s[10]; // for formatting strings
@@ -337,6 +367,16 @@ void Boiler::publish_values() {
doc["heatWorkMin"] = heatWorkMin_;
}
if (Helpers::hasValue(temp_)) {
doc["heatWorkMin"] = temp_;
}
if (Helpers::hasValue(maxpower_)) {
doc["heatWorkMin"] = maxpower_;
}
if (Helpers::hasValue(setpointpower_)) {
doc["heatWorkMin"] = setpointpower_;
}
if (Helpers::hasValue(serviceCode_)) {
doc["serviceCode"] = serviceCodeChar_;
doc["serviceCodeNumber"] = serviceCode_;
@@ -435,6 +475,11 @@ void Boiler::show_values(uuid::console::Shell & shell) {
print_value(shell, 2, F("Boiler circuit pump modulation max power"), pump_mod_max_, F_(percent));
print_value(shell, 2, F("Boiler circuit pump modulation min power"), pump_mod_min_, F_(percent));
// UBASetPoint - these may differ from the above
print_value(shell, 2, F("Boiler temp"), temp_, F_(degrees));
print_value(shell, 2, F("Max output power"), maxpower_, F_(percent));
print_value(shell, 2, F("Set power"), setpointpower_, F_(percent));
// UBAMonitorSlow
if (Helpers::hasValue(extTemp_)) {
print_value(shell, 2, F("Outside temperature"), extTemp_, F_(degrees), 10);
@@ -670,16 +715,16 @@ void Boiler::process_UBAOutdoorTemp(std::shared_ptr<const Telegram> telegram) {
telegram->read_value(extTemp_, 0);
}
// UBASetPoint 0x1A
void Boiler::process_UBASetPoints(std::shared_ptr<const Telegram> telegram) {
telegram->read_value(temp_, 0); // boiler flow temp
telegram->read_value(maxpower_, 1); // max output power in %
telegram->read_value(setpointpower_, 14); // ww pump speed/power?
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
// UBASetPoint 0x1A
// not yet implemented
void Boiler::process_UBASetPoints(std::shared_ptr<const Telegram> telegram) {
// uint8_t setpoint = telegram->message_data[0]; // boiler flow temp
// uint8_t ww_power = telegram->message_data[2]; // power in %
}
// 0x35
// not yet implemented
void Boiler::process_UBAFlags(std::shared_ptr<const Telegram> telegram) {
@@ -721,6 +766,24 @@ void Boiler::set_flow_temp(const uint8_t temperature) {
write_command(EMS_TYPE_UBASetPoints, 0, temperature);
}
// set heating temp
void Boiler::set_temp(const uint8_t temperature) {
LOG_INFO(F("Setting boiler temperature to %d C"), temperature);
write_command(EMS_TYPE_UBAParameters, 1, temperature);
}
// set min boiler output
void Boiler::set_min_power(const uint8_t power) {
LOG_INFO(F("Setting boiler min power to "), power);
write_command(EMS_TYPE_UBAParameters, 3, power);
}
// set max temp
void Boiler::set_max_power(const uint8_t power) {
LOG_INFO(F("Setting boiler max power to %d C"), power);
write_command(EMS_TYPE_UBAParameters, 2, power);
}
// 1=hot, 2=eco, 3=intelligent
// note some boilers do not have this setting, than it's done by thermostat
// on a RC35 it's by EMSESP::send_write_request(0x37, 0x10, 2, &set, 1, 0); (set is 1,2,3)
@@ -825,6 +888,30 @@ void Boiler::console_commands(Shell & shell, unsigned int context) {
set_flow_temp(Helpers::atoint(arguments.front().c_str()));
});
EMSESPShell::commands->add_command(ShellContext::BOILER,
CommandFlags::ADMIN,
flash_string_vector{F_(temp)},
flash_string_vector{F_(degrees_mandatory)},
[=](Shell & shell __attribute__((unused)), const std::vector<std::string> & arguments) {
set_temp(Helpers::atoint(arguments.front().c_str()));
});
EMSESPShell::commands->add_command(ShellContext::BOILER,
CommandFlags::ADMIN,
flash_string_vector{F_(maxpower)},
flash_string_vector{F_(n_mandatory)},
[=](Shell & shell __attribute__((unused)), const std::vector<std::string> & arguments) {
set_max_power(Helpers::atoint(arguments.front().c_str()));
});
EMSESPShell::commands->add_command(ShellContext::BOILER,
CommandFlags::ADMIN,
flash_string_vector{F_(minpower)},
flash_string_vector{F_(n_mandatory)},
[=](Shell & shell __attribute__((unused)), const std::vector<std::string> & arguments) {
set_min_power(Helpers::atoint(arguments.front().c_str()));
});
EMSESPShell::commands->add_command(
ShellContext::BOILER,
CommandFlags::ADMIN,

View File

@@ -55,6 +55,7 @@ class Boiler : public EMSdevice {
static constexpr uint8_t EMS_TYPE_UBAFunctionTest = 0x1D;
static constexpr uint8_t EMS_TYPE_UBAFlags = 0x35;
static constexpr uint8_t EMS_TYPE_UBASetPoints = 0x1A;
static constexpr uint8_t EMS_TYPE_UBAParameters = 0x16;
static constexpr uint8_t EMS_BOILER_SELFLOWTEMP_HEATING = 20; // was originally 70, changed to 30 for issue #193, then to 20 with issue #344
@@ -121,10 +122,15 @@ class Boiler : public EMSdevice {
uint8_t pump_mod_max_ = EMS_VALUE_UINT_NOTSET; // Boiler circuit pump modulation max. power %
uint8_t pump_mod_min_ = EMS_VALUE_UINT_NOTSET; // Boiler circuit pump modulation min. power
// UBASetPoint
uint8_t temp_ = EMS_VALUE_UINT_NOTSET; // boiler flow temp
uint8_t maxpower_ = EMS_VALUE_UINT_NOTSET; // max output power in %
uint8_t setpointpower_ = EMS_VALUE_UINT_NOTSET; // ww pump speed/power?
// other internal calculated params
uint8_t tap_water_active_ = EMS_VALUE_BOOL_NOTSET; // Hot tap water is on/off
uint8_t heating_active_ = EMS_VALUE_BOOL_NOTSET; // Central heating is on/off
uint8_t pumpMod2_ = EMS_VALUE_UINT_NOTSET; // heatpump modulation from 0xE3 (heatpumps)
uint8_t pumpMod2_ = EMS_VALUE_UINT_NOTSET; // heatpump modulation from 0xE3 (heatpumps)
void process_UBAParameterWW(std::shared_ptr<const Telegram> telegram);
void process_UBAMonitorFast(std::shared_ptr<const Telegram> telegram);
@@ -155,6 +161,10 @@ class Boiler : public EMSdevice {
void set_tapwarmwater_activated(const bool activated);
void set_warmwater_onetime(const bool activated);
void set_warmwater_circulation(const bool activated);
void set_temp(const uint8_t temperature);
void set_min_power(const uint8_t power);
void set_max_power(const uint8_t power);
// mqtt callbacks
void boiler_cmd(const char * message);

View File

@@ -1 +1 @@
#define EMSESP_APP_VERSION "2.0.0b10"
#define EMSESP_APP_VERSION "2.0.0b11"