From 1c6464a4f3aa455ae3fd5033c7002c73209f1f83 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Mon, 16 Sep 2024 13:47:52 +0200 Subject: [PATCH] pc0, pc1 flow, add uom l/h, fix #2001 --- interface/src/app/main/types.ts | 6 ++-- src/devices/boiler.cpp | 57 +++++++++++++++++++++++++++++++-- src/devices/boiler.h | 30 +++++++++++------ src/emsdevicevalue.cpp | 2 +- src/emsdevicevalue.h | 3 +- src/locale_common.h | 1 + src/locale_translations.h | 6 ++++ src/mqtt.cpp | 1 + 8 files changed, 89 insertions(+), 17 deletions(-) diff --git a/interface/src/app/main/types.ts b/interface/src/app/main/types.ts index 093b55a9d..faaa8757d 100644 --- a/interface/src/app/main/types.ts +++ b/interface/src/app/main/types.ts @@ -182,7 +182,8 @@ export enum DeviceValueUOM { KMIN, K, VOLTS, - MBAR + MBAR, + LH } export const DeviceValueUOM_s = [ @@ -210,7 +211,8 @@ export const DeviceValueUOM_s = [ 'K*min', 'K', 'V', - 'mbar' + 'mbar', + 'l/h' ]; export enum AnalogType { diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index b12079a1a..72dc39a69 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -89,6 +89,9 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const register_telegram_type(0x4AF, "HPMeters", true, MAKE_PF_CB(process_HpMeters)); register_telegram_type(0x2CC, "HPPressure", true, MAKE_PF_CB(process_HpPressure)); register_telegram_type(0x4A5, "HPFan", true, MAKE_PF_CB(process_HpFan)); + register_telegram_type(0x4AA, "HPPower2", true, MAKE_PF_CB(process_HpPower2)); + register_telegram_type(0x4A7, "HPPowerLimit", true, MAKE_PF_CB(process_HpPowerLimit)); + register_telegram_type(0x2D6, "HPPump2", true, MAKE_PF_CB(process_HpPump2)); } // some gas boilers, see #1701 @@ -827,6 +830,18 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const FL_(hpShutdown), DeviceValueUOM::NONE, MAKE_CF_CB(set_shutdown)); + register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &hpCurrPower_, DeviceValueType::UINT16, FL_(hpCurrPower), DeviceValueUOM::W); + register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, + &hpPowerLimit_, + DeviceValueType::UINT16, + FL_(hpPowerLimit), + DeviceValueUOM::W, + MAKE_CF_CB(set_hpPowerLimit)); + register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &pc0Flow_, DeviceValueType::INT16, FL_(pc0Flow), DeviceValueUOM::LH); + register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &pc1Flow_, DeviceValueType::INT16, FL_(pc1Flow), DeviceValueUOM::LH); + register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &pc1On_, DeviceValueType::BOOL, FL_(pc1On), DeviceValueUOM::NONE); + register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &pc1Rate_, DeviceValueType::UINT8, FL_(pc1Rate), DeviceValueUOM::PERCENT); + // heatpump DHW settings register_device_value(DeviceValueTAG::TAG_DHW1, &wwAlternatingOper_, @@ -1382,6 +1397,8 @@ void Boiler::process_UBAMonitorFastPlus(std::shared_ptr telegram if (Helpers::hasValue(exhaustTemp1_)) { has_update(exhaustTemp_, exhaustTemp1_); } + has_update(telegram, pc0Flow_, 36); // see https://github.com/emsesp/EMS-ESP32/issues/2001 + // read 3 char service code / installation status as appears on the display if ((telegram->message_length > 3) && (telegram->offset == 0)) { char serviceCode[4] = {0}; @@ -1919,6 +1936,7 @@ void Boiler::process_HpSilentMode(std::shared_ptr telegram) { void Boiler::process_HpValve(std::shared_ptr telegram) { // has_bitupdate(telegram, auxHeaterStatus_, 0, 2); has_update(telegram, auxHeatMixValve_, 7); + has_update(telegram, pc1Rate_, 13); // percent } // Boiler(0x08) -B-> All(0x00), ?(0x048B), data: 00 00 0A 1E 4E 00 1E 01 2C 00 01 64 55 05 12 50 50 50 00 00 1E 01 2C 00 @@ -1929,6 +1947,12 @@ void Boiler::process_HpPumps(std::shared_ptr telegram) { has_update(telegram, hpPumpMode_, 18); } +// 0x02D6, https://github.com/emsesp/EMS-ESP32/issues/2001 +void Boiler::process_HpPump2(std::shared_ptr telegram) { + has_update(telegram, pc1On_, 0); + has_update(telegram, pc1Flow_, 9); +} + // Boiler(0x08) -> All(0x00), ?(0x0491), data: 03 01 00 00 00 02 64 00 00 14 01 2C 00 0A 00 1E 00 1E 00 00 1E 0A 1E 05 05 void Boiler::process_HpAdditionalHeater(std::shared_ptr telegram) { has_update(telegram, manDefrost_, 0); // off/on @@ -2006,6 +2030,16 @@ void Boiler::process_HpFan(std::shared_ptr telegram) { has_update(telegram, fan_, 9); } +// 0x4AA +void Boiler::process_HpPower2(std::shared_ptr telegram) { + has_update(telegram, hpCurrPower_, 0); +} + +// 0x4A7 +void Boiler::process_HpPowerLimit(std::shared_ptr telegram) { + has_update(telegram, hpPowerLimit_, 0); +} + // Boiler(0x08) -B-> All(0x00), ?(0x2E), data: 00 00 1C CE 00 00 05 E8 00 00 00 18 00 00 00 02 void Boiler::process_Meters(std::shared_ptr telegram) { has_update(telegram, gasMeterHeat_, 0); @@ -2439,9 +2473,16 @@ bool Boiler::set_max_pump(const char * value, const int8_t id) { bool Boiler::set_pumpMode(const char * value, const int8_t id) { uint8_t v; - if (Helpers::value2enum(value, v, FL_(enum_pumpMode))) { - write_command(EMS_TYPE_UBAParameters, 11, v, EMS_TYPE_UBAParameters); - return true; + if (is_received(EMS_TYPE_UBAParametersPlus)) { + if (Helpers::value2enum(value, v, FL_(enum_pumpCharacter))) { + write_command(EMS_TYPE_UBAParametersPlus, 15, v, EMS_TYPE_UBAParametersPlus); + return true; + } + } else { + if (Helpers::value2enum(value, v, FL_(enum_pumpMode))) { + write_command(EMS_TYPE_UBAParameters, 11, v, EMS_TYPE_UBAParameters); + return true; + } } return false; } @@ -3072,6 +3113,16 @@ bool Boiler::set_hpDiffPress(const char * value, const int8_t id) { return false; } +bool Boiler::set_hpPowerLimit(const char * value, const int8_t id) { + int v; + if (Helpers::value2number(value, v)) { + uint8_t data[2] = {(uint8_t)(v >> 8), (uint8_t)v}; + write_command(0x4A7, 0, data, 2, 0x4A7); + return true; + } + return false; +} + bool Boiler::set_vp_cooling(const char * value, const int8_t id) { bool v; if (Helpers::value2bool(value, v)) { diff --git a/src/devices/boiler.h b/src/devices/boiler.h index 8d6e26f1e..3a276985f 100644 --- a/src/devices/boiler.h +++ b/src/devices/boiler.h @@ -287,16 +287,22 @@ class Boiler : public EMSdevice { uint8_t wwEcoStopTemp_; uint8_t wwEcoPlusStopTemp_; - uint8_t vp_cooling_; - uint8_t heatCable_; - uint8_t VC0valve_; - uint8_t primePump_; - uint8_t primePumpMod_; - uint8_t hp3wayValve_; - uint8_t hp4wayValve_; - uint8_t elHeatStep1_; - uint8_t elHeatStep2_; - uint8_t elHeatStep3_; + uint8_t vp_cooling_; + uint8_t heatCable_; + uint8_t VC0valve_; + uint8_t primePump_; + uint8_t primePumpMod_; + uint8_t hp3wayValve_; + uint8_t hp4wayValve_; + uint8_t elHeatStep1_; + uint8_t elHeatStep2_; + uint8_t elHeatStep3_; + uint16_t hpPowerLimit_; + uint16_t hpCurrPower_; + int16_t pc0Flow_; + int16_t pc1Flow_; + uint8_t pc1Rate_; + uint8_t pc1On_; // HIU // uint16_t cwFlowRate_; // cold water flow rate *10 @@ -364,6 +370,7 @@ class Boiler : public EMSdevice { void process_HpAdditionalHeater(std::shared_ptr telegram); void process_HpValve(std::shared_ptr telegram); void process_HpPumps(std::shared_ptr telegram); + void process_HpPump2(std::shared_ptr telegram); void process_HpDhwSettings(std::shared_ptr telegram); void process_HpSettings2(std::shared_ptr telegram); void process_HpSettings3(std::shared_ptr telegram); @@ -371,6 +378,8 @@ class Boiler : public EMSdevice { void process_HpMeters(std::shared_ptr telegram); void process_WeatherComp(std::shared_ptr telegram); void process_HpFan(std::shared_ptr telegram); + void process_HpPower2(std::shared_ptr telegram); + void process_HpPowerLimit(std::shared_ptr telegram); void process_Meters(std::shared_ptr telegram); void process_Energy(std::shared_ptr telegram); @@ -468,6 +477,7 @@ class Boiler : public EMSdevice { bool set_hpPumpMode(const char * value, const int8_t id); bool set_hpMaxPower(const char * value, const int8_t id); bool set_hpDiffPress(const char * value, const int8_t id); + bool set_hpPowerLimit(const char * value, const int8_t id); bool set_auxLimit(const char * value, const int8_t id); inline bool set_auxMaxLimit(const char * value, const int8_t id) { diff --git a/src/emsdevicevalue.cpp b/src/emsdevicevalue.cpp index 97bff85f7..40f398c62 100644 --- a/src/emsdevicevalue.cpp +++ b/src/emsdevicevalue.cpp @@ -110,7 +110,7 @@ const char * DeviceValue::DeviceValueUOM_s[] = { F_(uom_blank), // 0 F_(uom_degrees), F_(uom_degrees), F_(uom_percent), F_(uom_lmin), F_(uom_kwh), F_(uom_wh), FL_(hours)[0], FL_(minutes)[0], F_(uom_ua), F_(uom_bar), F_(uom_kw), F_(uom_w), F_(uom_kb), FL_(seconds)[0], F_(uom_dbm), F_(uom_fahrenheit), F_(uom_mv), F_(uom_sqm), - F_(uom_m3), F_(uom_l), F_(uom_kmin), F_(uom_k), F_(uom_volts), F_(uom_mbar), F_(uom_blank) + F_(uom_m3), F_(uom_l), F_(uom_kmin), F_(uom_k), F_(uom_volts), F_(uom_mbar), F_(uom_lh), F_(uom_blank) }; diff --git a/src/emsdevicevalue.h b/src/emsdevicevalue.h index 0a8ee1587..48b8dcf24 100644 --- a/src/emsdevicevalue.h +++ b/src/emsdevicevalue.h @@ -73,7 +73,8 @@ class DeviceValue { K, // 22 - K VOLTS, // 23 - V MBAR, // 24 - mbar - CONNECTIVITY // 25 - used in HA + LH, // 25 - l/h + CONNECTIVITY // 26 - used in HA }; // TAG mapping - maps to DeviceValueTAG_s in emsdevice.cpp diff --git a/src/locale_common.h b/src/locale_common.h index 26ce372b5..97fb49ff0 100644 --- a/src/locale_common.h +++ b/src/locale_common.h @@ -258,6 +258,7 @@ MAKE_WORD_CUSTOM(uom_kmin, "K*min") MAKE_WORD_CUSTOM(uom_k, "K") MAKE_WORD_CUSTOM(uom_volts, "V") MAKE_WORD_CUSTOM(uom_mbar, "mbar") +MAKE_WORD_CUSTOM(uom_lh, "l/h") // MQTT topics and prefixes MAKE_WORD_CUSTOM(heating_active, "heating_active") diff --git a/src/locale_translations.h b/src/locale_translations.h index da0c78d35..bca2fd02a 100644 --- a/src/locale_translations.h +++ b/src/locale_translations.h @@ -493,6 +493,10 @@ MAKE_TRANSLATION(heatoffdelay, "heatoffdelay", "heat-off delay", "Heizausschaltv MAKE_TRANSLATION(hpSetDiffPress, "hpsetdiffpress", "set differental pressure", "Pumpensolldruck", "", "", "różnica ciśnień", "", "", "", "", "nastaviť diferenčný tlak") // TODO translate MAKE_TRANSLATION(hpFan, "fan", "fan", "Lüfter", "", "", "wentylator", "", "", "", "", "ventilátor") // TODO translate MAKE_TRANSLATION(hpShutdown, "shutdown", "shutdown", "Abschalten", "", "", "wyłączenie", "", "", "", "", "vypnutie") // TODO translate +MAKE_TRANSLATION(pc0Flow, "pc0flow", "Flow PC0", "Durchfluss PC0", "", "", "", "", "", "", "", "") // TODO translate +MAKE_TRANSLATION(pc1Flow, "pc1flow", "Flow PC1", "Durchfluss PC1", "", "", "", "", "", "", "", "") // TODO translate +MAKE_TRANSLATION(pc1On, "pc1on", "PC1", "PC1", "", "", "", "", "", "", "", "") // TODO translate +MAKE_TRANSLATION(pc1Rate, "pc1rate", "PC1 rate", "PC1 Rate", "", "", "", "", "", "", "", "") // TODO translate // hybrid heatpump MAKE_TRANSLATION(hybridStrategy, "hybridstrategy", "hybrid control strategy", "Hybrid-Steuerungsstrategie", "Hybride strategie", "Hybrid kontrollstrategi", "strategia sterowania hybrydowego", "hybrid kontrollstrategi", "stratégie contrôle hybride", "hibrit kontrol stratejisi", "strategia comtrollo ibrido", "hybridná stratégia riadenia") @@ -568,6 +572,8 @@ MAKE_TRANSLATION(meterCool, "metercool", "meter cooling", "Messung: Kühlen", "" MAKE_TRANSLATION(meterWw, "meter", "meter", "Messung", "", "", "licznik", "", "", "", "", "počítadlo") // TODO translate MAKE_TRANSLATION(gasMeterHeat, "gasmeterheat", "gas meter heating", "Gaszähler: Heizen", "", "", "licznik gazu na ogrzewanie", "", "", "", "", "počítadlo plynu kúrenia") // TODO translate MAKE_TRANSLATION(gasMeterWw, "gasmeter", "gas meter", "Gaszähler", "", "", "licznik gazu", "", "", "", "", "počítadlo plynu") // TODO translate +MAKE_TRANSLATION(hpCurrPower, "hpcurrpower", "compressor current power", "akt. Kompressorleistung", "", "", "", "", "", "", "", "") // TODO translate +MAKE_TRANSLATION(hpPowerLimit, "hppowerlimit", "power limit", "Leistungsgrenze", "", "", "", "", "", "", "", "") // TODO translate // HIU MAKE_TRANSLATION(netFlowTemp, "netflowtemp", "heat network flow temp", "Systemvorlauftemperatur", "Netto aanvoertemperatuur", "", "temp. zasilania sieci cieplnej", "", "", "ısıtma şebekesi akış derecesi", "temperatura di mandata della rete di riscaldamento", "teplota prívodu tepelnej siete") // TODO translate diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 20f0af0b3..be5ab3c04 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -1186,6 +1186,7 @@ void Mqtt::add_ha_uom(JsonObject doc, const uint8_t type, const uint8_t uom, con doc["ic"] = F_(iconkb); break; case DeviceValueUOM::LMIN: + case DeviceValueUOM::LH: doc["ic"] = F_(iconlmin); doc[sc_ha] = F_(measurement); break;