Merge pull request #486 from MichaelDvP/dev

Mixing MM100 fix pump/status, MM10 add valveStatus (-100%..100%)
This commit is contained in:
Proddy
2020-09-09 11:47:29 +02:00
committed by GitHub
2 changed files with 23 additions and 26 deletions

View File

@@ -68,14 +68,14 @@ void Mixing::device_info_web(JsonArray & root) {
if (type_ == Type::WWC) { if (type_ == Type::WWC) {
render_value_json(root, "", F("Warm Water Circuit"), hc_, nullptr); render_value_json(root, "", F("Warm Water Circuit"), hc_, nullptr);
render_value_json(root, "", F("Current warm water temperature"), flowTemp_, F_(degrees), 10); render_value_json(root, "", F("Current warm water temperature"), flowTemp_, F_(degrees), 10);
render_value_json(root, "", F("Current pump status"), pumpMod_, nullptr); render_value_json(root, "", F("Current pump status"), pump_, nullptr);
render_value_json(root, "", F("Current temperature status"), status_, nullptr); render_value_json(root, "", F("Current temperature status"), status_, nullptr);
} else { } else {
render_value_json(root, "", F("Heating Circuit"), hc_, nullptr); render_value_json(root, "", F("Heating Circuit"), hc_, nullptr);
render_value_json(root, "", F("Current flow temperature"), flowTemp_, F_(degrees), 10); render_value_json(root, "", F("Current flow temperature"), flowTemp_, F_(degrees), 10);
render_value_json(root, "", F("Setpoint flow temperature"), flowSetTemp_, F_(degrees)); render_value_json(root, "", F("Setpoint flow temperature"), flowSetTemp_, F_(degrees));
render_value_json(root, "", F("Current pump modulation"), pumpMod_, F_(percent)); render_value_json(root, "", F("Current pump status"), pump_, nullptr, EMS_VALUE_BOOL);
render_value_json(root, "", F("Current valve status"), status_, nullptr); render_value_json(root, "", F("Current valve status"), status_, F_(percent));
} }
} }
@@ -103,14 +103,14 @@ void Mixing::show_values(uuid::console::Shell & shell) {
if (type_ == Type::WWC) { if (type_ == Type::WWC) {
print_value(shell, 2, F("Warm Water Circuit"), hc_, nullptr); print_value(shell, 2, F("Warm Water Circuit"), hc_, nullptr);
print_value(shell, 4, F("Current warm water temperature"), flowTemp_, F_(degrees), 10); print_value(shell, 4, F("Current warm water temperature"), flowTemp_, F_(degrees), 10);
print_value(shell, 4, F("Current pump status"), pumpMod_, nullptr); print_value(shell, 4, F("Current pump status"), pump_, nullptr);
print_value(shell, 4, F("Current temperature status"), status_, nullptr); print_value(shell, 4, F("Current temperature status"), status_, nullptr);
} else { } else {
print_value(shell, 2, F("Heating Circuit"), hc_, nullptr); print_value(shell, 2, F("Heating Circuit"), hc_, nullptr);
print_value(shell, 4, F("Current flow temperature"), flowTemp_, F_(degrees), 10); print_value(shell, 4, F("Current flow temperature"), flowTemp_, F_(degrees), 10);
print_value(shell, 4, F("Setpoint flow temperature"), flowSetTemp_, F_(degrees)); print_value(shell, 4, F("Setpoint flow temperature"), flowSetTemp_, F_(degrees));
print_value(shell, 4, F("Current pump modulation"), pumpMod_, F_(percent)); print_value(shell, 4, F("Current pump status"), pump_, nullptr, EMS_VALUE_BOOL);
print_value(shell, 4, F("Current valve status"), status_, nullptr); print_value(shell, 4, F("Current valve status"), status_, F_(percent));
} }
@@ -121,6 +121,7 @@ void Mixing::show_values(uuid::console::Shell & shell) {
// ideally we should group up all the mixing units together into a nested JSON but for now we'll send them individually // ideally we should group up all the mixing units together into a nested JSON but for now we'll send them individually
void Mixing::publish_values() { void Mixing::publish_values() {
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_SMALL> doc; StaticJsonDocument<EMSESP_MAX_JSON_SIZE_SMALL> doc;
char s[5]; // for formatting strings
switch (type_) { switch (type_) {
case Type::HC: case Type::HC:
@@ -128,23 +129,23 @@ void Mixing::publish_values() {
if (Helpers::hasValue(flowTemp_)) { if (Helpers::hasValue(flowTemp_)) {
doc["flowTemp"] = (float)flowTemp_ / 10; doc["flowTemp"] = (float)flowTemp_ / 10;
} }
if (Helpers::hasValue(pumpMod_)) {
doc["pumpMod"] = pumpMod_;
}
if (Helpers::hasValue(status_)) {
doc["status"] = status_;
}
if (Helpers::hasValue(flowSetTemp_)) { if (Helpers::hasValue(flowSetTemp_)) {
doc["flowSetTemp"] = flowSetTemp_; doc["flowSetTemp"] = flowSetTemp_;
} }
if (Helpers::hasValue(pump_)) {
doc["pumpStatus"] = Helpers::render_value(s, pump_, EMS_VALUE_BOOL);
}
if (Helpers::hasValue(status_)) {
doc["valveStatus"] = status_;
}
break; break;
case Type::WWC: case Type::WWC:
doc["type"] = "wwc"; doc["type"] = "wwc";
if (Helpers::hasValue(flowTemp_)) { if (Helpers::hasValue(flowTemp_)) {
doc["wwTemp"] = (float)flowTemp_ / 10; doc["wwTemp"] = (float)flowTemp_ / 10;
} }
if (Helpers::hasValue(pumpMod_)) { if (Helpers::hasValue(pump_)) {
doc["pumpStatus"] = pumpMod_; doc["pumpStatus"] = pump_;
} }
if (Helpers::hasValue(status_)) { if (Helpers::hasValue(status_)) {
doc["tempStatus"] = status_; doc["tempStatus"] = status_;
@@ -156,7 +157,6 @@ void Mixing::publish_values() {
} }
char topic[30]; char topic[30];
char s[3]; // for formatting strings
strlcpy(topic, "mixing_data", 30); strlcpy(topic, "mixing_data", 30);
strlcat(topic, Helpers::itoa(s, get_device_id() - 0x20 + 1), 30); // append hc to topic strlcat(topic, Helpers::itoa(s, get_device_id() - 0x20 + 1), 30); // append hc to topic
Mqtt::publish(topic, doc); Mqtt::publish(topic, doc);
@@ -170,8 +170,8 @@ void Mixing::process_MMPLUSStatusMessage_HC(std::shared_ptr<const Telegram> tele
hc_ = telegram->type_id - 0x02D7 + 1; // determine which circuit this is hc_ = telegram->type_id - 0x02D7 + 1; // determine which circuit this is
changed_ |= telegram->read_value(flowTemp_, 3); // is * 10 changed_ |= telegram->read_value(flowTemp_, 3); // is * 10
changed_ |= telegram->read_value(flowSetTemp_, 5); changed_ |= telegram->read_value(flowSetTemp_, 5);
changed_ |= telegram->read_value(pumpMod_, 2); changed_ |= telegram->read_value(pump_, 0);
changed_ |= telegram->read_value(status_, 1); // valve status changed_ |= telegram->read_value(status_, 2); // valve status
} }
// Mixing module warm water loading/DHW - 0x0331, 0x0332 // Mixing module warm water loading/DHW - 0x0331, 0x0332
@@ -181,7 +181,7 @@ void Mixing::process_MMPLUSStatusMessage_WWC(std::shared_ptr<const Telegram> tel
type_ = Type::WWC; type_ = Type::WWC;
hc_ = telegram->type_id - 0x0331 + 1; // determine which circuit this is. There are max 2. hc_ = telegram->type_id - 0x0331 + 1; // determine which circuit this is. There are max 2.
changed_ |= telegram->read_value(flowTemp_, 0); // is * 10 changed_ |= telegram->read_value(flowTemp_, 0); // is * 10
changed_ |= telegram->read_value(pumpMod_, 2); changed_ |= telegram->read_value(pump_, 2);
changed_ |= telegram->read_value(status_, 11); // temp status changed_ |= telegram->read_value(status_, 11); // temp status
} }
@@ -201,11 +201,7 @@ void Mixing::process_IPMStatusMessage(std::shared_ptr<const Telegram> telegram)
changed_ |= telegram->read_value(flowSetTemp_, 5); changed_ |= telegram->read_value(flowSetTemp_, 5);
changed_ |= telegram->read_value(status_, 2); // valve status changed_ |= telegram->read_value(status_, 2); // valve status
} }
uint8_t pump = 0xFF; changed_ |= telegram->read_bitvalue(pump_, 1, 0); // pump is also in unmixed circuits
changed_ |= telegram->read_bitvalue(pump, 1, 0); // pump is also in unmixed circuits
if (pump != 0xFF) {
pumpMod_ = 100 * pump;
}
} }
// Mixing on a MM10 - 0xAB // Mixing on a MM10 - 0xAB
@@ -219,8 +215,9 @@ void Mixing::process_MMStatusMessage(std::shared_ptr<const Telegram> telegram) {
// see https://github.com/proddy/EMS-ESP/issues/270 and https://github.com/proddy/EMS-ESP/issues/386#issuecomment-629610918 // see https://github.com/proddy/EMS-ESP/issues/270 and https://github.com/proddy/EMS-ESP/issues/386#issuecomment-629610918
hc_ = get_device_id() - 0x20 + 1; hc_ = get_device_id() - 0x20 + 1;
changed_ |= telegram->read_value(flowTemp_, 1); // is * 10 changed_ |= telegram->read_value(flowTemp_, 1); // is * 10
changed_ |= telegram->read_value(pumpMod_, 3); changed_ |= telegram->read_value(pump_, 3);
changed_ |= telegram->read_value(flowSetTemp_, 0); changed_ |= telegram->read_value(flowSetTemp_, 0);
changed_ |= telegram->read_value(status_, 4); // valve status -100 to 100
} }
#pragma GCC diagnostic push #pragma GCC diagnostic push

View File

@@ -62,8 +62,8 @@ class Mixing : public EMSdevice {
private: private:
uint16_t hc_ = EMS_VALUE_USHORT_NOTSET; uint16_t hc_ = EMS_VALUE_USHORT_NOTSET;
uint16_t flowTemp_ = EMS_VALUE_USHORT_NOTSET; uint16_t flowTemp_ = EMS_VALUE_USHORT_NOTSET;
uint8_t pumpMod_ = EMS_VALUE_UINT_NOTSET; uint8_t pump_ = EMS_VALUE_UINT_NOTSET;
uint8_t status_ = EMS_VALUE_UINT_NOTSET; int8_t status_ = EMS_VALUE_UINT_NOTSET;
uint8_t flowSetTemp_ = EMS_VALUE_UINT_NOTSET; uint8_t flowSetTemp_ = EMS_VALUE_UINT_NOTSET;
Type type_ = Type::NONE; Type type_ = Type::NONE;
bool changed_ = false; bool changed_ = false;