diff --git a/src/boiler.cpp b/src/boiler.cpp index 9a1b6e4e0..16a630238 100644 --- a/src/boiler.cpp +++ b/src/boiler.cpp @@ -428,11 +428,9 @@ void Boiler::show_values(uuid::console::Shell & shell) { if (hpSpeed_ != EMS_VALUE_UINT_NOTSET) { print_value(shell, F("Heat Pump speed"), F_(percent), Helpers::render_value(buffer, hpSpeed_, 1)); } - - shell.println(); } -/** +/* * Check if hot tap water or heating is active * If a value has changed, post it immediately to MQTT so we get real time data */ @@ -510,7 +508,7 @@ void Boiler::process_UBAMonitorFast(std::shared_ptr telegram) { check_active(); } -/** +/* * UBATotalUptime - type 0x14 - total uptime * received only after requested (not broadcasted) */ @@ -518,7 +516,7 @@ void Boiler::process_UBATotalUptime(std::shared_ptr telegram) { telegram->read_value(UBAuptime_, 0); } -/** +/* * UBAParameters - type 0x16 */ void Boiler::process_UBAParameters(std::shared_ptr telegram) { @@ -527,7 +525,7 @@ void Boiler::process_UBAParameters(std::shared_ptr telegram) { telegram->read_value(pump_mod_min_, 10); } -/** +/* * UBAMonitorWW - type 0x34 - warm water monitor. 19 bytes long * received every 10 seconds */ @@ -545,7 +543,7 @@ void Boiler::process_UBAMonitorWW(std::shared_ptr telegram) { telegram->read_value(wWTemperatureOK_, 5, 5); } -/** +/* * UBAMonitorFastPlus - type 0xE4 - central heating monitor EMS+ */ void Boiler::process_UBAMonitorFastPlus(std::shared_ptr telegram) { @@ -570,7 +568,7 @@ void Boiler::process_UBAMonitorFastPlus(std::shared_ptr telegram check_active(); } -/** +/* * UBAMonitorSlow - type 0x19 - central heating monitor part 2 (27 bytes long) * received every 60 seconds * e.g. 08 00 19 00 80 00 02 41 80 00 00 00 00 00 03 91 7B 05 B8 40 00 00 00 04 92 AD 00 5E EE 80 00 @@ -588,7 +586,7 @@ void Boiler::process_UBAMonitorSlow(std::shared_ptr telegram) { telegram->read_value(heatWorkMin_, 19); } -/** +/* * UBAMonitorSlowPlus - type 0xE5 - central heating monitor EMS+ */ void Boiler::process_UBAMonitorSlowPlus(std::shared_ptr telegram) { @@ -635,7 +633,7 @@ void Boiler::process_UBADHWStatus(std::shared_ptr telegram) { telegram->read_value(wWDisinfectTemp_, 9); } -/** +/* * UBAOutdoorTemp - type 0xD1 - external temperature EMS+ */ void Boiler::process_UBAOutdoorTemp(std::shared_ptr telegram) { diff --git a/src/device_library.h b/src/device_library.h index 96ded014f..62126d0f3 100644 --- a/src/device_library.h +++ b/src/device_library.h @@ -45,7 +45,7 @@ {101, DeviceType::SOLAR, F("ISM1"), DeviceFlags::EMS_DEVICE_FLAG_SM100}, {162, DeviceType::SOLAR, F("SM50"), DeviceFlags::EMS_DEVICE_FLAG_SM100}, -// Mixing Modules - 0x20 / 0x21 +// Mixing Modules - 0x20-0x27 for HC, 0x28-0x29 for WWC {160, DeviceType::MIXING, F("MM100"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS}, {161, DeviceType::MIXING, F("MM200"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS}, { 69, DeviceType::MIXING, F("MM10"), DeviceFlags::EMS_DEVICE_FLAG_MM10}, diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 3eb9f539e..3064bdf32 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -194,6 +194,8 @@ void EMSESP::show_values(uuid::console::Shell & shell) { shell.println(); } } + + shell.println(); } // publish all values from each EMS device to MQTT @@ -301,7 +303,7 @@ std::string EMSESP::pretty_telegram(std::shared_ptr telegram) { return str; } -/** +/* * Type 0x07 - UBADevices - shows us the connected EMS devices * e.g. 08 00 07 00 0B 80 00 00 00 00 00 00 00 00 00 00 00 * Junkers has 15 bytes of data diff --git a/src/heatpump.cpp b/src/heatpump.cpp index cb628bf01..ab46b23e0 100644 --- a/src/heatpump.cpp +++ b/src/heatpump.cpp @@ -52,8 +52,6 @@ void Heatpump::add_context_menu() { // display all values into the shell console void Heatpump::show_values(uuid::console::Shell & shell) { EMSdevice::show_values(shell); // always call this to show header - - shell.println(); } // publish values via MQTT diff --git a/src/mixing.cpp b/src/mixing.cpp index b8b5280e5..22aa24277 100644 --- a/src/mixing.cpp +++ b/src/mixing.cpp @@ -18,8 +18,6 @@ #include "mixing.h" -// MAKE_PSTR_WORD(mixing) - namespace emsesp { REGISTER_FACTORY(Mixing, EMSdevice::DeviceType::MIXING); @@ -55,15 +53,22 @@ void Mixing::add_context_menu() { void Mixing::show_values(uuid::console::Shell & shell) { EMSdevice::show_values(shell); // always call this to show header + if (type_ == Type::NONE) { + return; // don't have any values yet + } + char buffer[10]; // used for formatting - shell.printfln(F(" Circuit #: %d"), hc_); + if (type_ == Type::WWC) { + shell.printfln(F(" Warm Water Circuit #: %d"), hc_); + + } else { + shell.printfln(F(" Heating Circuit #: %d"), hc_); + } print_value(shell, F("Current flow temperature"), F_(degrees), Helpers::render_value(buffer, flowTemp_, 10)); print_value(shell, F("Setpoint flow temperature"), F_(degrees), Helpers::render_value(buffer, flowSetTemp_, 1)); print_value(shell, F("Current pump modulation"), Helpers::render_value(buffer, pumpMod_, 1)); - print_value(shell, F("Current valve status"), Helpers::render_value(buffer, valveStatus_, 1)); - - shell.println(); + print_value(shell, F("Current valve status"), Helpers::render_value(buffer, status_, 1)); } // publish values via MQTT @@ -71,6 +76,18 @@ void Mixing::show_values(uuid::console::Shell & shell) { void Mixing::publish_values() { DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_SMALL); + switch (type_) { + case Type::HC: + doc["type"] = F("hc"); + break; + case Type::WWC: + doc["type"] = F("wwc"); + break; + case Type::NONE: + default: + return; + } + if (flowTemp_ != EMS_VALUE_USHORT_NOTSET) { doc["flowTemp"] = (float)flowTemp_ / 10; } @@ -79,12 +96,12 @@ void Mixing::publish_values() { doc["pumpMod"] = pumpMod_; } - if (valveStatus_ != EMS_VALUE_UINT_NOTSET) { - doc["valveStatus_"] = valveStatus_; + if (status_ != EMS_VALUE_UINT_NOTSET) { + doc["status"] = status_; } if (flowSetTemp_ != EMS_VALUE_UINT_NOTSET) { - doc["flowSetTemp_"] = flowSetTemp_; + doc["flowSetTemp"] = flowSetTemp_; } #ifdef EMSESP_DEBUG @@ -107,27 +124,34 @@ bool Mixing::updated_values() { void Mixing::console_commands() { } -// 0x02D7, 0x02D8 etc... +// heating circuits 0x02D7, 0x02D8 etc... void Mixing::process_MMPLUSStatusMessage_HC(std::shared_ptr telegram) { - hc_ = 0x02D8 - telegram->type_id; // determine which circuit this is - telegram->read_value(flowTemp_, 3); // isd * 10 + type_ = Type::HC; + hc_ = telegram->type_id - 0x02D7 + 1; // determine which circuit this is + telegram->read_value(flowTemp_, 3); // is * 10 telegram->read_value(pumpMod_, 5); - telegram->read_value(valveStatus_, 2); + telegram->read_value(status_, 2); // valve status } -// Mixing module warm water loading - 0x0331, 0x0332 +// Mixing module warm water loading/DHW - 0x0331, 0x0332 +// e.g. A9 00 FF 00 02 32 02 6C 00 3C 00 3C 3C 46 02 03 03 00 3C // on 0x28 +// A8 00 FF 00 02 31 02 35 00 3C 00 3C 3C 46 02 03 03 00 3C // in 0x29 void Mixing::process_MMPLUSStatusMessage_WWC(std::shared_ptr telegram) { - hc_ = 0x0332 - telegram->type_id; // determine which circuit this is. There are max 2. - telegram->read_value(flowTemp_, 0); // isd * 10 + type_ = Type::WWC; + hc_ = telegram->type_id - 0x0331 + 1; // determine which circuit this is. There are max 2. + telegram->read_value(flowTemp_, 0); // is * 10 telegram->read_value(pumpMod_, 2); - telegram->read_value(valveStatus_, 11); + telegram->read_value(status_, 11); // temp status } +// Mixing on a MM10 - 0xAB +// We assume MM10 is on HC2 and WM10 is using HC1 - https://github.com/proddy/EMS-ESP/issues/270 void Mixing::process_MMStatusMessage(std::shared_ptr telegram) { - hc_ = 1; // fixed - telegram->read_value(flowTemp_, 1); // isd * 10 + type_ = Type::HC; + hc_ = 1; // fixed to circuit 1 + telegram->read_value(flowTemp_, 1); // is * 10 telegram->read_value(pumpMod_, 3); - telegram->read_value(valveStatus_, 0); + telegram->read_value(flowSetTemp_, 0); } } // namespace emsesp \ No newline at end of file diff --git a/src/mixing.h b/src/mixing.h index ef1b8b8c4..d81443b7f 100644 --- a/src/mixing.h +++ b/src/mixing.h @@ -50,12 +50,19 @@ class Mixing : public EMSdevice { void process_MMPLUSStatusMessage_WWC(std::shared_ptr telegram); void process_MMStatusMessage(std::shared_ptr telegram); + enum class Type { + NONE, + HC, // heating circuit + WWC // warm water circuit + }; + private: uint16_t hc_ = EMS_VALUE_USHORT_NOTSET; uint16_t flowTemp_ = EMS_VALUE_USHORT_NOTSET; uint8_t pumpMod_ = EMS_VALUE_UINT_NOTSET; - uint8_t valveStatus_ = EMS_VALUE_UINT_NOTSET; + uint8_t status_ = EMS_VALUE_UINT_NOTSET; uint8_t flowSetTemp_ = EMS_VALUE_UINT_NOTSET; + Type type_ = Type::NONE; }; } // namespace emsesp diff --git a/src/solar.cpp b/src/solar.cpp index 768569563..8111daa05 100644 --- a/src/solar.cpp +++ b/src/solar.cpp @@ -18,7 +18,6 @@ #include "solar.h" -// MAKE_PSTR_WORD(solar) MAKE_PSTR(kwh, "kWh") MAKE_PSTR(wh, "Wh") @@ -69,8 +68,6 @@ void Solar::show_values(uuid::console::Shell & shell) { print_value(shell, F("Energy last hour"), F_(wh), Helpers::render_value(buffer, energyLastHour_, 10)); print_value(shell, F("Energy today"), F_(wh), Helpers::render_value(buffer, energyToday_, 0)); // no division print_value(shell, F("Energy total"), F_(kwh), Helpers::render_value(buffer, energyTotal_, 10)); - - shell.println(); } // publish values via MQTT diff --git a/src/test/test_data.h b/src/test/test_data.h index 93c46fe38..6daee3a20 100644 --- a/src/test/test_data.h +++ b/src/test/test_data.h @@ -339,6 +339,32 @@ void EMSESP::run_test(uuid::console::Shell & shell, const std::string & command) return; } + if (command == "mixing") { + shell.printfln(F("Mixing Solar")); + + rxservice_.ems_mask(EMSbus::EMS_MASK_BUDERUS); + + std::string version("1.2.3"); + add_device(0x28, 160, version, EMSdevice::Brand::BUDERUS); // MM100, WWC + add_device(0x29, 161, version, EMSdevice::Brand::BUDERUS); // MM200, WWC + + rxservice_.loop(); + + // WWC1 on 0x29 + uint8_t m1[] = {0xA9, 0x00, 0xFF, 0x00, 0x02, 0x32, 0x02, 0x6C, 0x00, 0x3C, 0x00, 0x3C, 0x3C, 0x46, 0x02, 0x03, 0x03, 0x00, 0x3C, 0x57}; + rxservice_.add(m1, sizeof(m1)); + rxservice_.loop(); + + // WWC2 on 0x28 + uint8_t m2[] = {0xA8, 0x00, 0xFF, 0x00, 0x02, 0x31, 0x02, 0x35, 0x00, 0x3C, 0x00, 0x3C, 0x3C, 0x46, 0x02, 0x03, 0x03, 0x00, 0x3C, 0x71}; + rxservice_.add(m2, sizeof(m2)); + rxservice_.loop(); + + shell.loop_all(); + + return; + } + shell.printfln(F("[Test] Unknown test command")); } diff --git a/src/thermostat.cpp b/src/thermostat.cpp index 8b5813246..bcd2026ff 100644 --- a/src/thermostat.cpp +++ b/src/thermostat.cpp @@ -676,8 +676,6 @@ void Thermostat::show_values(uuid::console::Shell & shell) { shell.printfln(F(" Building: heavy")); } } - - shell.println(); } } diff --git a/src/version.h b/src/version.h index 41d67fa13..675485602 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "2.0.0a2" +#define EMSESP_APP_VERSION "2.0.0a3"