From ec1b0b364189ac3d545f382d77a4487e2d7b88e9 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Mon, 11 Apr 2022 15:03:07 +0200 Subject: [PATCH] add IPM ww-parameters to mixer --- src/devices/mixer.cpp | 105 ++++++++++++++++++++++++++++++++++-------- src/devices/mixer.h | 12 +++-- src/locale_DE.h | 18 ++++++++ 3 files changed, 114 insertions(+), 21 deletions(-) diff --git a/src/devices/mixer.cpp b/src/devices/mixer.cpp index 3db9cdfb7..794fac20a 100644 --- a/src/devices/mixer.cpp +++ b/src/devices/mixer.cpp @@ -100,8 +100,9 @@ Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c // HT3 if (flags == EMSdevice::EMS_DEVICE_FLAG_IPM) { if (device_id >= 0x40) { // special DHW pos 10 - register_telegram_type(0x34, F("UBAMonitorWW"), false, MAKE_PF_CB(process_MonitorWW)); - register_telegram_type(0x1E, F("HydrTemp"), false, MAKE_PF_CB(process_HydrTemp)); + register_telegram_type(0x34, F("UBAMonitorWW"), false, MAKE_PF_CB(process_IPMMonitorWW)); + register_telegram_type(0x1E, F("HydrTemp"), false, MAKE_PF_CB(process_IPMHydrTemp)); + register_telegram_type(0x33, F("UBAParameterWW"), true, MAKE_PF_CB(process_IPMParameterWW)); // register_telegram_type(0x10D, F("wwNTCStatus"), false, MAKE_PF_CB(process_wwNTCStatus)); type_ = Type::WWC; hc_ = device_id - 0x40 + 1; @@ -110,7 +111,26 @@ Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c register_device_value(tag, &wwCurTemp_1_, DeviceValueType::USHORT, FL_(div10), FL_(wwCurTemp), DeviceValueUOM::DEGREES); register_device_value(tag, &wwCurTemp_2_, DeviceValueType::USHORT, FL_(div10), FL_(wwCurTemp2), DeviceValueUOM::DEGREES); register_device_value(tag, &HydrTemp_, DeviceValueType::USHORT, FL_(div10), FL_(hydrTemp), DeviceValueUOM::DEGREES); - register_device_value(tag, &pumpStatus_, DeviceValueType::BOOL, nullptr, FL_(pumpStatus), DeviceValueUOM::NONE, MAKE_CF_CB(set_pump)); + register_device_value(tag, &pumpStatus_, DeviceValueType::BOOL, nullptr, FL_(pumpStatus), DeviceValueUOM::NONE); + register_device_value( + tag, &wwFlowTempOffset_, DeviceValueType::UINT, nullptr, FL_(wwFlowTempOffset), DeviceValueUOM::DEGREES_R, MAKE_CF_CB(set_wwFlowTempOffset)); + register_device_value(tag, &wwHystOn_, DeviceValueType::INT, nullptr, FL_(wwHystOn), DeviceValueUOM::DEGREES_R, MAKE_CF_CB(set_wwHystOn)); + register_device_value(tag, &wwHystOff_, DeviceValueType::INT, nullptr, FL_(wwHystOff), DeviceValueUOM::DEGREES_R, MAKE_CF_CB(set_wwHystOff)); + register_device_value(tag, + &wwDisinfectionTemp_, + DeviceValueType::UINT, + nullptr, + FL_(wwDisinfectionTemp), + DeviceValueUOM::DEGREES, + MAKE_CF_CB(set_wwDisinfectionTemp)); + register_device_value(DeviceValueTAG::TAG_DEVICE_DATA_WW, + &wwCircPump_, + DeviceValueType::BOOL, + nullptr, + FL_(wwCircPump), + DeviceValueUOM::NONE, + MAKE_CF_CB(set_wwCircPump)); + register_device_value(tag, &wwCircMode_, DeviceValueType::ENUM, FL_(enum_wwCircMode), FL_(wwCircMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwCircMode)); } else { register_telegram_type(0x010C, F("IPMStatusMessage"), false, MAKE_PF_CB(process_IPMStatusMessage)); register_telegram_type(0x011E, F("IPMTempMessage"), false, MAKE_PF_CB(process_IPMTempMessage)); @@ -217,23 +237,35 @@ void Mixer::process_MMPLUSConfigMessage_WWC(std::shared_ptr tele has_update(telegram, wwMaxTemp_, 10); } -// 0x34 only8 bytes long +// 0x34 only 8 bytes long // Mixer(0x41) -> All(0x00), UBAMonitorWW(0x34), data: 37 02 1E 02 1E 00 00 00 00 -void Mixer::process_MonitorWW(std::shared_ptr telegram) { +void Mixer::process_IPMMonitorWW(std::shared_ptr telegram) { has_update(telegram, wwSelTemp_, 0); has_update(telegram, wwCurTemp_1_, 1); has_update(telegram, wwCurTemp_2_, 3); - has_bitupdate(telegram, pumpStatus_, 5, 0); // not sure thisisthe right value + has_bitupdate(telegram, pumpStatus_, 5, 3); } +// Mixer(0x41) -> Me(0x0B), UBAParameterWW(0x33), data: 08 FF 46 FB FF 28 FF 07 46 00 FF 00 +void Mixer::process_IPMParameterWW(std::shared_ptr telegram) { + // has_update(telegram, wwActivated_, 1); // 0xFF means on + // has_update(telegram, wwSelTemp_, 2); + has_update(telegram, wwHystOn_, 3); // Hyst on (default -5) + has_update(telegram, wwHystOff_, 4); // Hyst off (default -1) + has_update(telegram, wwFlowTempOffset_, 5); // default 40 + has_update(telegram, wwCircPump_, 6); // 0xFF means on + has_update(telegram, wwCircMode_, 7); // 1=1x3min 6=6x3min 7=continuous + has_update(telegram, wwDisinfectionTemp_, 8); + // has_bitupdate(telegram, wwChargeType_, 10, 0); // 0 = charge pump, 0xff = 3-way valve +} + + // 0x1E, only16 bit temperature // Mixer(0x41) -> Boiler(0x08), HydrTemp(0x1E), data: 01 D8 -void Mixer::process_HydrTemp(std::shared_ptr telegram) { +void Mixer::process_IPMHydrTemp(std::shared_ptr telegram) { has_update(telegram, HydrTemp_, 0); } - - #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" @@ -281,7 +313,6 @@ bool Mixer::set_wwSelTemp(const char * value, const int8_t id) { return true; } - bool Mixer::set_flowSetTemp(const char * value, const int8_t id) { int v; if (!Helpers::value2number(value, v)) { @@ -390,34 +421,72 @@ bool Mixer::set_wwRequiredTemp(const char * value, const int8_t id) { } bool Mixer::set_wwDisinfectionTemp(const char * value, const int8_t id) { - uint8_t wwc = device_id() - 0x28; - float v = 0; + float v = 0; if (!Helpers::value2temperature(value, v)) { return false; } - write_command(0x313 + wwc, 9, (uint8_t)v, 0x313 + wwc); + if (flags() == EMSdevice::EMS_DEVICE_FLAG_IPM) { + write_command(0x33, 8, (uint8_t)v, 0x33); + } else { + uint8_t wwc = device_id() - 0x28; + write_command(0x313 + wwc, 9, (uint8_t)v, 0x313 + wwc); + } return true; } bool Mixer::set_wwCircPump(const char * value, const int8_t id) { - uint8_t wwc = device_id() - 0x28; - bool v = false; + bool v = false; if (!Helpers::value2bool(value, v)) { return false; } - write_command(0x33B + wwc, 0, v ? 0x01 : 0x00, 0x33B + wwc); + if (flags() == EMSdevice::EMS_DEVICE_FLAG_IPM) { + write_command(0x33, 6, v ? 0xFF : 0x00, 0x33); + } else { + uint8_t wwc = device_id() - 0x28; + write_command(0x33B + wwc, 0, v ? 0x01 : 0x00, 0x33B + wwc); + } return true; } bool Mixer::set_wwCircMode(const char * value, const int8_t id) { - uint8_t wwc = device_id() - 0x28; uint8_t n; if (!Helpers::value2enum(value, n, FL_(enum_wwCircMode))) { return false; } - write_command(0x313 + wwc, 0, n, 0x313 + wwc); + if (flags() == EMSdevice::EMS_DEVICE_FLAG_IPM) { + write_command(0x33, 7, n, 0x33); + } else { + uint8_t wwc = device_id() - 0x28; + write_command(0x313 + wwc, 0, n, 0x313 + wwc); + } return true; } +bool Mixer::set_wwFlowTempOffset(const char * value, const int8_t id) { + int n; + if (!Helpers::value2number(value, n)) { + return false; + } + write_command(0x33, 5, n, 0x33); + return true; +} + +bool Mixer::set_wwHystOn(const char * value, const int8_t id) { + int n; + if (!Helpers::value2number(value, n)) { + return false; + } + write_command(0x33, 3, n, 0x33); + return true; +} + +bool Mixer::set_wwHystOff(const char * value, const int8_t id) { + int n; + if (!Helpers::value2number(value, n)) { + return false; + } + write_command(0x33, 4, n, 0x33); + return true; +} } // namespace emsesp diff --git a/src/devices/mixer.h b/src/devices/mixer.h index 8c8cf72ea..0a2c12039 100644 --- a/src/devices/mixer.h +++ b/src/devices/mixer.h @@ -43,8 +43,9 @@ class Mixer : public EMSdevice { void process_MMSetMessage(std::shared_ptr telegram); void process_HpPoolStatus(std::shared_ptr telegram); - void process_MonitorWW(std::shared_ptr telegram); - void process_HydrTemp(std::shared_ptr telegram); + void process_IPMMonitorWW(std::shared_ptr telegram); + void process_IPMHydrTemp(std::shared_ptr telegram); + void process_IPMParameterWW(std::shared_ptr telegram); bool set_flowSetTemp(const char * value, const int8_t id); bool set_pump(const char * value, const int8_t id); @@ -60,7 +61,9 @@ class Mixer : public EMSdevice { bool set_wwCircMode(const char * value, const int8_t id); bool set_wwSelTemp(const char * value, const int8_t id); - + bool set_wwFlowTempOffset(const char * value, const int8_t id); + bool set_wwHystOn(const char * value, const int8_t id); + bool set_wwHystOff(const char * value, const int8_t id); enum class Type { NONE, @@ -100,6 +103,9 @@ class Mixer : public EMSdevice { uint16_t wwCurTemp_1_; uint16_t wwCurTemp_2_; uint16_t HydrTemp_; + int8_t wwHystOn_; // Hyst on (default -5) + int8_t wwHystOff_; // Hyst off (default -1) + uint8_t wwFlowTempOffset_; // default 40 }; } // namespace emsesp diff --git a/src/locale_DE.h b/src/locale_DE.h index 894d55274..02c25e4e3 100644 --- a/src/locale_DE.h +++ b/src/locale_DE.h @@ -221,6 +221,12 @@ MAKE_PSTR(tag_wwc1, "wwc1") MAKE_PSTR(tag_wwc2, "wwc2") MAKE_PSTR(tag_wwc3, "wwc3") MAKE_PSTR(tag_wwc4, "wwc4") +MAKE_PSTR(tag_wwc5, "wwc5") +MAKE_PSTR(tag_wwc6, "wwc6") +MAKE_PSTR(tag_wwc7, "wwc7") +MAKE_PSTR(tag_wwc8, "wwc8") +MAKE_PSTR(tag_wwc9, "wwc9") +MAKE_PSTR(tag_wwc10, "wwc10") MAKE_PSTR(tag_hs1, "hs1") MAKE_PSTR(tag_hs2, "hs2") MAKE_PSTR(tag_hs3, "hs3") @@ -520,6 +526,16 @@ MAKE_PSTR_LIST(hpTl2, F("hptl2"), F("Außenlufttemperaturfühler (TL2)")) MAKE_PSTR_LIST(hpPl1, F("hppl1"), F("Niedrigdruckfühler (PL1)")) MAKE_PSTR_LIST(hpPh1, F("hpph1"), F("Hochdruckfühler (PH1)")) +// hybrid heatpump +MAKE_PSTR_LIST(enum_hybridStrategy, F("co2-optimized"), F("cost-optimized"), F("outside-temp-switched"), F("co2-cost-mix")) +MAKE_PSTR_LIST(hybridStrategy, F("hybridstrategy"), F("hybrid control strategy")) +MAKE_PSTR_LIST(switchOverTemp, F("switchovertemp"), F("outside switchover temperature")) +MAKE_PSTR_LIST(energyCostRatio, F("energycostratio"), F("energy cost ratio")) +MAKE_PSTR_LIST(fossileFactor, F("fossilefactor"), F("fossile energy factor")) +MAKE_PSTR_LIST(electricFactor, F("electricfactor"), F("electric energy factor")) +MAKE_PSTR_LIST(delayBoiler, F("delayboiler"), F("delay boiler support")) +MAKE_PSTR_LIST(tempDiffBoiler, F("tempdiffboiler"), F("tempediff boiler support")) + // the following are dhw for the boiler and automatically tagged with 'ww' MAKE_PSTR_LIST(wWSelTemp, F("wwseltemp"), F("gewählte Temperatur")) MAKE_PSTR_LIST(wwSelTempLow, F("wwseltemplow"), F("selected lower temperature")) @@ -562,6 +578,7 @@ MAKE_PSTR_LIST(wwMaxTemp, F("wwmaxtemp"), F("Maximale Temperatur")) MAKE_PSTR_LIST(wwOneTimeKey, F("wwonetimekey"), F("Einmalladungstaste")) // mqtt values / commands +MAKE_PSTR_LIST(switchtime, F("switchtime"), F("program switchtime")) MAKE_PSTR_LIST(switchtime1, F("switchtime1"), F("own1 program switchtime")) MAKE_PSTR_LIST(switchtime2, F("switchtime2"), F("own2 program switchtime")) MAKE_PSTR_LIST(wwswitchtime, F("wwswitchtime"), F("program switchtime")) @@ -671,6 +688,7 @@ MAKE_PSTR_LIST(poolSetTemp, F("poolsettemp"), F("pool set temperature")) MAKE_PSTR_LIST(poolTemp, F("pooltemp"), F("pool temperature")) MAKE_PSTR_LIST(poolShuntStatus, F("poolshuntstatus"), F("pool shunt status opening/closing")) MAKE_PSTR_LIST(poolShunt, F("poolshunt"), F("pool shunt open/close (0% = pool / 100% = heat)")) +MAKE_PSTR_LIST(hydrTemp, F("hydrTemp"), F("hydraulic header temperature")) // solar MAKE_PSTR_LIST(collectorTemp, F("collectortemp"), F("Kollektortemperatur (TS1)"))