From ffdcbac1e084c3e400898cb9fefdab0404fac235 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Thu, 10 Oct 2024 16:19:59 +0200 Subject: [PATCH 1/4] add PV max compressor power --- src/devices/boiler.cpp | 17 +++++++++++++++++ src/devices/boiler.h | 2 ++ src/locale_translations.h | 1 + 3 files changed, 20 insertions(+) diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 72dc39a69..d625ca4e2 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -546,6 +546,13 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const FL_(hpMaxPower), DeviceValueUOM::PERCENT, MAKE_CF_CB(set_hpMaxPower)); + register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, + &pvMaxComp_, + DeviceValueType::UINT8, + DeviceValueNumOp::DV_NUMOP_DIV10, + FL_(pvMaxComp), + DeviceValueUOM::KW, + MAKE_CF_CB(set_pvMaxComp)); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &hpSetDiffPress_, DeviceValueType::UINT8, @@ -1929,6 +1936,7 @@ void Boiler::process_HpSilentMode(std::shared_ptr telegram) { has_update(telegram, hpMaxPower_, 31); has_update(telegram, silentFrom_, 52); // in steps of 15 min has_update(telegram, silentTo_, 53); // in steps of 15 min + has_update(telegram, pvMaxComp_, 54); // #2062 has_update(telegram, hpshutdown_, 58); // 1 powers off } @@ -3104,6 +3112,15 @@ bool Boiler::set_hpMaxPower(const char * value, const int8_t id) { return false; } +bool Boiler::set_pvMaxComp(const char * value, const int8_t id) { + float v; + if (Helpers::value2float(value, v)) { + write_command(0x484, 54, (uint8_t)(v * 10), 0x484); + return true; + } + return false; +} + bool Boiler::set_hpDiffPress(const char * value, const int8_t id) { int v; if (Helpers::value2number(value, v)) { diff --git a/src/devices/boiler.h b/src/devices/boiler.h index 3a276985f..70cad801a 100644 --- a/src/devices/boiler.h +++ b/src/devices/boiler.h @@ -254,6 +254,7 @@ class Boiler : public EMSdevice { uint8_t maxHeatHeat_; uint8_t maxHeatDhw_; uint8_t hpMaxPower_; + uint8_t pvMaxComp_; uint8_t pvCooling_; uint8_t manDefrost_; @@ -476,6 +477,7 @@ class Boiler : public EMSdevice { bool set_hpCircPumpWw(const char * value, const int8_t id); bool set_hpPumpMode(const char * value, const int8_t id); bool set_hpMaxPower(const char * value, const int8_t id); + bool set_pvMaxComp(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); diff --git a/src/locale_translations.h b/src/locale_translations.h index 55a49b86c..08622aba7 100644 --- a/src/locale_translations.h +++ b/src/locale_translations.h @@ -409,6 +409,7 @@ MAKE_TRANSLATION(hpSwitchValve, "hpswitchvalve", "switch valve", "Schaltventil", MAKE_TRANSLATION(hpActivity, "hpactivity", "compressor activity", "Kompressoraktivität", "Compressoractiviteit", "Kompressoraktivitet", "pompa ciepła, aktywność sprężarki", "kompressoraktivitet", "", "hp ısı pompası", "attività compressore", "činnosť kompresora") // TODO translate MAKE_TRANSLATION(hpMaxPower, "hpmaxpower", "compressor max power", "max. Kompressorleistung", "", "", "maksymalna wydajność sprężarki", "", "", "", "", "max výkon kompresora") // TODO translate +MAKE_TRANSLATION(pvMaxComp, "pvmaxcomp", "pv compressor max power", "PV max. Kompressorleistung", "", "", "maksymalna wydajność sprężarki", "", "", "", "", "pv max výkon kompresora") // TODO translate MAKE_TRANSLATION(hpPower, "hppower", "compressor power output", "Kompressorleistung", "Compressorvermogen", "Kompressoreffekt", "moc wyjściowa sprężarki", "kompressoreffekt", "puissance de sortie compresseur", "ısı pompası güç çıkışı", "potenza uscita compressore", "výkon kompresora") MAKE_TRANSLATION(hpTc0, "hptc0", "heat carrier return (TC0)", "Kältemittelrücklauf (TC0)", "Koudemiddel retour (TC0)", "Värmebärare Retur (TC0)", "temperatura nośnika ciepła na powrocie (TC0)", "kjølemiddel retur (TC0)", "retour caloporteur (TC0)", "sıcak su dönüşü (TC0)", "ritorno del refrigerante (TC0)", "návrat nosiča tepla (TC0)") MAKE_TRANSLATION(hpTc1, "hptc1", "heat carrier forward (TC1)", "Kältemittelvorlauf (TC1)", "Koudemiddel aanvoer (TC1)", "Värmebärare Framledning (TC1)", "temperatura nośnika ciepła pierwotna (TC1)", "kjølemiddel tur (TC1)", "avance caloporteur (TC1)", "sıcak su çıkışı (TC1)", "flusso di refrigerante (TC1)", "nosič tepla vpred (TC1)") From 9304cc6e47f3182ba08dccfa3c3fec599ed567fd Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Fri, 11 Oct 2024 15:44:05 +0200 Subject: [PATCH 2/4] dhw circuit number only per offset --- src/devices/thermostat.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index d967dfc49..f78bf2f60 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -1195,8 +1195,8 @@ void Thermostat::process_RC300WWtemp(std::shared_ptr telegram) { // RC300WWmode(0x2F6), data: 02 FF 04 00 00 00 08 05 00 08 04 00 00 00 00 00 00 00 00 00 01 void Thermostat::process_RC300WWmode(std::shared_ptr telegram) { uint8_t circuit = 0; - telegram->read_value(circuit, 0); - auto dhw = dhw_circuit(telegram->type_id - 0x2F5, circuit, circuit != 0); + telegram->read_value(circuit, 0); // 00-no circuit, 01-boiler, 02-mixer + auto dhw = dhw_circuit(telegram->type_id - 0x2F5, 255, circuit != 0); if (dhw == nullptr) { return; } From 57f337ce22318a636be0c6a230f4c530122a10c6 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Fri, 11 Oct 2024 15:50:45 +0200 Subject: [PATCH 3/4] fix board_build.extra_flags, (for serial USB) #2082 --- platformio.ini | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/platformio.ini b/platformio.ini index 45f4bc6ab..eebfa7aab 100644 --- a/platformio.ini +++ b/platformio.ini @@ -109,7 +109,10 @@ extra_scripts = scripts/rename_fw.py board = esp32dev board_upload.flash_size = 16MB board_build.partitions = esp32_partition_16M.csv -board_build.extra_flags = -DBOARD_HAS_PSRAM +board_build.extra_flags = + -DARDUINO_ESP32_DEV + -DBOARD_HAS_PSRAM + [env:ci_s3_16M_P] ; 16MB ESP32-S3 - with PSRAM - like BBQKees S3 @@ -119,7 +122,6 @@ board = lolin_s3 board_build.f_cpu = 240000000L board_upload.flash_size = 16MB board_build.partitions = esp32_partition_16M.csv -board_build.extra_flags = -DBOARD_HAS_PSRAM ; ; Direct builds @@ -144,14 +146,15 @@ extends = espressif32_base board = esp32dev board_upload.flash_size = 16MB board_build.partitions = esp32_partition_16M.csv -board_build.extra_flags = -DBOARD_HAS_PSRAM +board_build.extra_flags = + -DARDUINO_ESP32_DEV + -DBOARD_HAS_PSRAM [env:c3_mini_4M] extends = espressif32_base_tasmota board = lolin_c3_mini board_upload.flash_size = 4MB board_build.partitions = esp32_partition_4M.csv -board_build.extra_flags = '-DEMSESP_DEFAULT_BOARD_PROFILE="C3MINI"' ; lolin C3 mini v1 needs special wifi init. ; https://www.wemos.cc/en/latest/c3/c3_mini_1_0_0.html#about-wifi @@ -160,14 +163,15 @@ extends = espressif32_base_tasmota board = lolin_c3_mini board_upload.flash_size = 4MB board_build.partitions = esp32_partition_4M.csv -board_build.extra_flags = -DBOARD_C3_MINI_V1 '-DEMSESP_DEFAULT_BOARD_PROFILE="C3MINI"' +build_flags = + ${common.build_flags} + -DBOARD_C3_MINI_V1 [env:s2_4M] extends = espressif32_base_tasmota board = lolin_s2_mini board_upload.flash_size = 4MB board_build.partitions = esp32_partition_4M.csv -board_build.extra_flags = '-DEMSESP_DEFAULT_BOARD_PROFILE="S2MINI"' ; https://github.com/platformio/platform-espressif32/blob/master/boards/lolin_s3.json [env:s3_16M_P] @@ -177,7 +181,6 @@ board_upload.use_1200bps_touch = false board_upload.wait_for_upload_port = false board_upload.flash_size = 16MB board_build.partitions = esp32_partition_16M.csv -board_build.extra_flags = -DBOARD_HAS_PSRAM [env:s3_32M_P] extends = espressif32_base @@ -186,7 +189,6 @@ board_build.arduino.memory_type: opi_opi board_build.flash_mode = opi board_upload.flash_size = 32MB board_build.partitions = esp32_partition_32M.csv -board_build.extra_flags = -DBOARD_HAS_PSRAM ; ; Building and testing natively, standalone without an ESP32. From f0a2f4082cc68ce30f65321370101854424fd13a Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Sat, 12 Oct 2024 17:42:31 +0200 Subject: [PATCH 4/4] thermostat dhw circuits use offset only --- src/devices/thermostat.cpp | 46 +++++++++++++++++++------------------- src/devices/thermostat.h | 23 +++++++++---------- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index f78bf2f60..71b6ccad7 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -557,10 +557,10 @@ uint8_t Thermostat::HeatingCircuit::get_mode_type() const { return HeatingCircuit::Mode::DAY; } -std::shared_ptr Thermostat::dhw_circuit(const uint8_t offset, const uint8_t dhw_num, const bool create) { +std::shared_ptr Thermostat::dhw_circuit(const uint8_t offset, const bool create) { // check for existing circuit for (const auto & dhw_circuit : dhw_circuits_) { - if (dhw_circuit->dhw() == dhw_num - 1 || dhw_circuit->offset() == offset) { + if (dhw_circuit->offset() == offset) { return dhw_circuit; } } @@ -568,7 +568,7 @@ std::shared_ptr Thermostat::dhw_circuit(const uint8_t of return nullptr; } // create a new circuit object and add to the list - auto new_dhw = std::make_shared(offset, dhw_num == 255 ? offset + 1 : dhw_num); + auto new_dhw = std::make_shared(offset); dhw_circuits_.push_back(new_dhw); // register the device values register_device_values_dhw(new_dhw); @@ -600,7 +600,7 @@ void Thermostat::process_RC10Set(std::shared_ptr telegram) { if (hc == nullptr) { return; } - auto dhw = dhw_circuit(0, 1, true); + auto dhw = dhw_circuit(0, true); has_update(telegram, ibaCalIntTemperature_, 0); has_update(telegram, backlight_, 1); has_update(telegram, dhw->wwMode_, 2); @@ -867,7 +867,7 @@ void Thermostat::process_IBASettings(std::shared_ptr telegram) { // Settings WW 0x37 - RC35 void Thermostat::process_RC35wwSettings(std::shared_ptr telegram) { - auto dhw = dhw_circuit(0, 1, true); + auto dhw = dhw_circuit(0, true); has_update(telegram, dhw->wwProgMode_, 0); // 0-like hc, 0xFF own prog has_update(telegram, dhw->wwCircProg_, 1); // 0-like hc, 0xFF own prog has_update(telegram, dhw->wwMode_, 2); // 0-off, 1-on, 2-auto @@ -881,7 +881,7 @@ void Thermostat::process_RC35wwSettings(std::shared_ptr telegram // Settings WW 0x3A - RC30 void Thermostat::process_RC30wwSettings(std::shared_ptr telegram) { - auto dhw = dhw_circuit(0, 1, true); + auto dhw = dhw_circuit(0, true); has_update(telegram, dhw->wwMode_, 0); // 0-on, 1-off, 2-auto has_update(telegram, dhw->wwWhenModeOff_, 1); // 0-off, 0xFF on has_update(telegram, dhw->wwDisinfecting_, 2); // 0-off, 0xFF on @@ -891,7 +891,7 @@ void Thermostat::process_RC30wwSettings(std::shared_ptr telegram // type 0x38 (ww) and 0x39 (circ) void Thermostat::process_RC35wwTimer(std::shared_ptr telegram) { - auto dhw = dhw_circuit(0, 1, true); + auto dhw = dhw_circuit(0, true); if ((telegram->message_length == 2 && telegram->offset < 83 && !(telegram->offset & 1)) || (!telegram->offset && telegram->type_id == 0x38 && !strlen(dhw->wwSwitchTime_) && telegram->message_length > 1) || (!telegram->offset && telegram->type_id == 0x39 && !strlen(dhw->wwCircSwitchTime_) && telegram->message_length > 1)) { @@ -1004,7 +1004,7 @@ void Thermostat::process_JunkersSetMixer(std::shared_ptr telegra } void Thermostat::process_JunkersWW(std::shared_ptr telegram) { - auto dhw = dhw_circuit(0, 1, true); + auto dhw = dhw_circuit(0, true); has_bitupdate(telegram, dhw->wwCharge_, 0, 3); } @@ -1185,7 +1185,7 @@ void Thermostat::process_RC300Curve(std::shared_ptr telegram) { // types 0x31B void Thermostat::process_RC300WWtemp(std::shared_ptr telegram) { - auto dhw = dhw_circuit(0, 1, true); + auto dhw = dhw_circuit(0, true); has_update(telegram, dhw->wwSetTemp_, 0); has_update(telegram, dhw->wwSetTempLow_, 1); } @@ -1196,7 +1196,7 @@ void Thermostat::process_RC300WWtemp(std::shared_ptr telegram) { void Thermostat::process_RC300WWmode(std::shared_ptr telegram) { uint8_t circuit = 0; telegram->read_value(circuit, 0); // 00-no circuit, 01-boiler, 02-mixer - auto dhw = dhw_circuit(telegram->type_id - 0x2F5, 255, circuit != 0); + auto dhw = dhw_circuit(telegram->type_id - 0x2F5, circuit != 0); if (dhw == nullptr) { return; } @@ -2105,7 +2105,7 @@ bool Thermostat::set_roomsensor(const char * value, const int8_t id) { // sets the thermostat ww working mode, where mode is a string, ems and ems+ bool Thermostat::set_wwmode(const char * value, const int8_t id) { - auto dhw = dhw_circuit(255, id2dhw(id)); + auto dhw = dhw_circuit(id2dhw(id)); if (dhw == nullptr) { return false; } @@ -2192,7 +2192,7 @@ bool Thermostat::set_wwtemplow(const char * value, const int8_t id) { // Set ww charge RC300, ems+ bool Thermostat::set_wwcharge(const char * value, const int8_t id) { - auto dhw = dhw_circuit(255, id2dhw(id)); + auto dhw = dhw_circuit(id2dhw(id)); if (dhw == nullptr) { return false; } @@ -2212,7 +2212,7 @@ bool Thermostat::set_wwcharge(const char * value, const int8_t id) { // Set ww charge duration in steps of 15 min, ems+ bool Thermostat::set_wwchargeduration(const char * value, const int8_t id) { - auto dhw = dhw_circuit(255, id2dhw(id)); + auto dhw = dhw_circuit(id2dhw(id)); if (dhw == nullptr) { return false; } @@ -2305,7 +2305,7 @@ bool Thermostat::set_switchProgMode(const char * value, const int8_t id) { // sets the thermostat ww circulation working mode, where mode is a string bool Thermostat::set_wwcircmode(const char * value, const int8_t id) { - auto dhw = dhw_circuit(255, id2dhw(id)); + auto dhw = dhw_circuit(id2dhw(id)); if (dhw == nullptr) { return false; } @@ -2328,7 +2328,7 @@ bool Thermostat::set_wwcircmode(const char * value, const int8_t id) { } bool Thermostat::set_wwDailyHeating(const char * value, const int8_t id) { - auto dhw = dhw_circuit(255, id2dhw(id)); + auto dhw = dhw_circuit(id2dhw(id)); if (dhw == nullptr) { return false; } @@ -2342,7 +2342,7 @@ bool Thermostat::set_wwDailyHeating(const char * value, const int8_t id) { } bool Thermostat::set_wwDailyHeatTime(const char * value, const int8_t id) { - auto dhw = dhw_circuit(255, id2dhw(id)); + auto dhw = dhw_circuit(id2dhw(id)); if (dhw == nullptr) { return false; } @@ -2363,7 +2363,7 @@ bool Thermostat::set_wwDailyHeatTime(const char * value, const int8_t id) { } bool Thermostat::set_wwDisinfect(const char * value, const int8_t id) { - auto dhw = dhw_circuit(255, id2dhw(id)); + auto dhw = dhw_circuit(id2dhw(id)); if (dhw == nullptr) { return false; } @@ -2384,7 +2384,7 @@ bool Thermostat::set_wwDisinfect(const char * value, const int8_t id) { } bool Thermostat::set_wwDisinfectDay(const char * value, const int8_t id) { - auto dhw = dhw_circuit(255, id2dhw(id)); + auto dhw = dhw_circuit(id2dhw(id)); if (dhw == nullptr) { return false; } @@ -2405,7 +2405,7 @@ bool Thermostat::set_wwDisinfectDay(const char * value, const int8_t id) { } bool Thermostat::set_wwDisinfectHour(const char * value, const int8_t id) { - auto dhw = dhw_circuit(255, id2dhw(id)); + auto dhw = dhw_circuit( id2dhw(id)); if (dhw == nullptr) { return false; } @@ -3428,7 +3428,7 @@ bool Thermostat::set_switchtime2(const char * value, const int8_t id) { } // sets a single switchtime in the thermostat dhw program for RC35 bool Thermostat::set_wwCircSwitchTime(const char * value, const int8_t id) { - auto dhw = dhw_circuit(255, id2dhw(id)); + auto dhw = dhw_circuit(id2dhw(id)); if (dhw == nullptr) { return false; } @@ -3445,7 +3445,7 @@ bool Thermostat::set_wwCircSwitchTime(const char * value, const int8_t id) { // sets a single switchtime in the thermostat circulation program for RC35 bool Thermostat::set_wwSwitchTime(const char * value, const int8_t id) { - auto dhw = dhw_circuit(255, id2dhw(id)); + auto dhw = dhw_circuit(id2dhw(id)); if (dhw != nullptr) { return false; } @@ -4393,7 +4393,7 @@ void Thermostat::register_device_values() { register_device_values_hc(new_hc); // also a dhw circuit... - auto new_dhw = std::make_shared(0, 1); // offset 0, dhw num 1 + auto new_dhw = std::make_shared(0); // offset 0, dhw num 1 dhw_circuits_.push_back(new_dhw); register_device_values_dhw(new_dhw); #endif @@ -4863,7 +4863,7 @@ void Thermostat::register_device_values_hc(std::shared_ptr dhw) { - int8_t tag = DeviceValueTAG::TAG_DHW1 + dhw->dhw(); + int8_t tag = dhw->id(); switch (this->model()) { case EMSdevice::EMS_DEVICE_FLAG_RC100: case EMSdevice::EMS_DEVICE_FLAG_RC300: diff --git a/src/devices/thermostat.h b/src/devices/thermostat.h index 3643d61b7..0b01687a9 100644 --- a/src/devices/thermostat.h +++ b/src/devices/thermostat.h @@ -173,9 +173,8 @@ class Thermostat : public EMSdevice { class DhwCircuit { public: - DhwCircuit(const uint8_t offset, const uint8_t dhw_num) - : offset_(offset) - , dhw_num_(dhw_num) { + DhwCircuit(const uint8_t offset) + : dhw_num_(offset) { } ~DhwCircuit() = default; uint8_t wwExtra_; @@ -201,16 +200,16 @@ class Thermostat : public EMSdevice { char wwHoliday_[22]; char wwVacation_[22]; - uint8_t dhw() const { - return dhw_num_ - 1; + uint8_t id() const { // returns TAG(id) + return DeviceValueTAG::TAG_DHW1 + dhw_num_; } - uint8_t offset() const { - return offset_; + + uint8_t offset() const { // returns telegram offset + return dhw_num_; } private: - uint8_t offset_; // telegram offset to base telegram - uint8_t dhw_num_; // dhw circuit number 1..10 + uint8_t dhw_num_; // dhw circuit number 0..10 }; private: @@ -230,8 +229,8 @@ class Thermostat : public EMSdevice { || (model() == EMSdevice::EMS_DEVICE_FLAG_CR120)); } - inline uint8_t id2dhw(const int8_t id) const { - return id - DeviceValueTAG::TAG_DHW1 + 1; + inline uint8_t id2dhw(const int8_t id) const { // returns telegram offset for TAG(id) + return id - DeviceValueTAG::TAG_DHW1; } // each thermostat has a list of heating controller type IDs for reading and writing @@ -394,7 +393,7 @@ class Thermostat : public EMSdevice { std::shared_ptr heating_circuit(std::shared_ptr telegram); std::shared_ptr heating_circuit(const int8_t id); - std::shared_ptr dhw_circuit(const uint8_t offset = 0, const uint8_t dhw_num = 255, const bool create = false); + std::shared_ptr dhw_circuit(const uint8_t offset, const bool create = false); void register_device_values_hc(std::shared_ptr hc); void register_device_values_dhw(std::shared_ptr dhw);