From 40d48f4407f4c7866d092ed7e5e5c7d4ca6a789a Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Tue, 25 Mar 2025 18:07:57 +0100 Subject: [PATCH] add FLAG_HMC310, fix switchtimeWW --- CHANGELOG_LATEST.md | 3 ++- docs/Modbus-Entity-Registers.md | 8 ++++---- docs/dump_entities.csv | 2 +- src/core/emsdevice.h | 1 + src/core/emsesp.cpp | 2 +- src/core/locale_translations.h | 1 - src/core/modbus_entity_parameters.hpp | 2 +- src/devices/thermostat.cpp | 24 ++++++++++++++++-------- src/devices/thermostat.h | 4 ++-- src/version.h | 2 +- 10 files changed, 29 insertions(+), 20 deletions(-) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 661cdc59a..fffbdbcf8 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -7,10 +7,11 @@ For more details go to [docs.emsesp.org](https://docs.emsesp.org/). ## Added - analogsensor types: NTC and RGB-Led +- Flag for HMC310 ## Fixed -- +- dhw/switchtime [#2490](https://github.com/emsesp/EMS-ESP32/issues/2490) ## Changed diff --git a/docs/Modbus-Entity-Registers.md b/docs/Modbus-Entity-Registers.md index b0b4e6aa9..853e12ef9 100644 --- a/docs/Modbus-Entity-Registers.md +++ b/docs/Modbus-Entity-Registers.md @@ -4371,7 +4371,7 @@ | dhw.disinfecthour | disinfection hour | uint8 (>=0<=23) | | true | DHW | 14 | 1 | 1 | | dhw.maxtemp | maximum temperature | uint8 (>=0<=254) | C | true | DHW | 15 | 1 | 1 | | dhw.onetimekey | one time key function | boolean | | true | DHW | 16 | 1 | 1 | -| dhw.switchtimeWW | program switchtime warm water | string | | true | DHW | 17 | 11 | 1 | +| dhw.switchtime | program switchtime | string | | true | DHW | 17 | 11 | 1 | | dhw.circswitchtime | circulation program switchtime | string | | true | DHW | 28 | 8 | 1 | | dhw.holidays | holiday dates | string | | true | DHW | 36 | 13 | 1 | | dhw.vacations | vacation dates | string | | true | DHW | 49 | 13 | 1 | @@ -4437,7 +4437,7 @@ | dhw.disinfecthour | disinfection hour | uint8 (>=0<=23) | | true | DHW | 14 | 1 | 1 | | dhw.maxtemp | maximum temperature | uint8 (>=60<=80) | C | true | DHW | 15 | 1 | 1 | | dhw.onetimekey | one time key function | boolean | | true | DHW | 16 | 1 | 1 | -| dhw.switchtimeWW | program switchtime warm water | string | | true | DHW | 17 | 11 | 1 | +| dhw.switchtime | program switchtime | string | | true | DHW | 17 | 11 | 1 | | dhw.circswitchtime | circulation program switchtime | string | | true | DHW | 28 | 8 | 1 | | dhw.holidays | holiday dates | string | | true | DHW | 36 | 13 | 1 | | dhw.vacations | vacation dates | string | | true | DHW | 49 | 13 | 1 | @@ -5344,7 +5344,7 @@ | dhw.disinfecthour | disinfection hour | uint8 (>=0<=23) | | true | DHW | 14 | 1 | 1 | | dhw.maxtemp | maximum temperature | uint8 (>=0<=254) | C | true | DHW | 15 | 1 | 1 | | dhw.onetimekey | one time key function | boolean | | true | DHW | 16 | 1 | 1 | -| dhw.switchtimeWW | program switchtime warm water | string | | true | DHW | 17 | 11 | 1 | +| dhw.switchtime | program switchtime | string | | true | DHW | 17 | 11 | 1 | | dhw.circswitchtime | circulation program switchtime | string | | true | DHW | 28 | 8 | 1 | | dhw.holidays | holiday dates | string | | true | DHW | 36 | 13 | 1 | | dhw.vacations | vacation dates | string | | true | DHW | 49 | 13 | 1 | @@ -5410,7 +5410,7 @@ | dhw.disinfecthour | disinfection hour | uint8 (>=0<=23) | | true | DHW | 14 | 1 | 1 | | dhw.maxtemp | maximum temperature | uint8 (>=60<=80) | C | true | DHW | 15 | 1 | 1 | | dhw.onetimekey | one time key function | boolean | | true | DHW | 16 | 1 | 1 | -| dhw.switchtimeWW | program switchtime warm water | string | | true | DHW | 17 | 11 | 1 | +| dhw.switchtime | program switchtime | string | | true | DHW | 17 | 11 | 1 | | dhw.circswitchtime | circulation program switchtime | string | | true | DHW | 28 | 8 | 1 | | dhw.holidays | holiday dates | string | | true | DHW | 36 | 13 | 1 | | dhw.vacations | vacation dates | string | | true | DHW | 49 | 13 | 1 | diff --git a/docs/dump_entities.csv b/docs/dump_entities.csv index c2674c065..8b7cbc6d7 100644 --- a/docs/dump_entities.csv +++ b/docs/dump_entities.csv @@ -3753,7 +3753,7 @@ device name,device type,product id,shortname,fullname,type [options...] \| (min/ "RC30",thermostat,67,dhw.disinfecthour,disinfection hour,uint8 (>=0<=23), ,true,number.thermostat_dhw_disinfection_hour,number.thermostat_dhw_disinfecthour,6,9,1,14,1 "RC30",thermostat,67,dhw.maxtemp,maximum temperature,uint8 (>=0<=254),C,true,number.thermostat_dhw_maximum_temperature,number.thermostat_dhw_maxtemp,6,9,1,15,1 "RC30",thermostat,67,dhw.onetimekey,one time key function,boolean, ,true,switch.thermostat_dhw_one_time_key_function,switch.thermostat_dhw_onetimekey,6,9,1,16,1 -"RC30",thermostat,67,dhw.switchtimeWW,program switchtime warm water,string, ,true,sensor.thermostat_dhw_program_switchtime_warm_water,sensor.thermostat_dhw_switchtimeWW,6,9,1,17,11 +"RC30",thermostat,67,dhw.switchtime,program switchtime,string, ,true,sensor.thermostat_dhw_program_switchtime,sensor.thermostat_dhw_switchtime,6,9,1,17,11 "RC30",thermostat,67,dhw.circswitchtime,circulation program switchtime,string, ,true,sensor.thermostat_dhw_circulation_program_switchtime,sensor.thermostat_dhw_circswitchtime,6,9,1,28,8 "RC30",thermostat,67,dhw.holidays,holiday dates,string, ,true,sensor.thermostat_dhw_holiday_dates,sensor.thermostat_dhw_holidays,6,9,1,36,13 "RC30",thermostat,67,dhw.vacations,vacation dates,string, ,true,sensor.thermostat_dhw_vacation_dates,sensor.thermostat_dhw_vacations,6,9,1,49,13 diff --git a/src/core/emsdevice.h b/src/core/emsdevice.h index df7e72852..5824f44c1 100644 --- a/src/core/emsdevice.h +++ b/src/core/emsdevice.h @@ -468,6 +468,7 @@ class EMSdevice { static constexpr uint8_t EMS_DEVICE_FLAG_R3000 = 15; // Rego3000, same as RC300 with different wwmodes static constexpr uint8_t EMS_DEVICE_FLAG_CR120 = 16; // mostly like RC300, but some changes static constexpr uint8_t EMS_DEVICE_FLAG_CR11 = 17; // CRF200 only monitor + static constexpr uint8_t EMS_DEVICE_FLAG_HMC310 = 18; uint8_t count_entities(); uint8_t count_entities_fav(); diff --git a/src/core/emsesp.cpp b/src/core/emsesp.cpp index 2b071d536..3ef9c2a07 100644 --- a/src/core/emsesp.cpp +++ b/src/core/emsesp.cpp @@ -1315,7 +1315,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const default_name = "CR120"; } if (product_id == 158 && strncmp(version,"73",2) == 0) { - flags = DeviceFlags::EMS_DEVICE_FLAG_BC400; + flags = DeviceFlags::EMS_DEVICE_FLAG_HMC310; default_name = "HMC310"; } diff --git a/src/core/locale_translations.h b/src/core/locale_translations.h index 275d7bb34..87b45a9ad 100644 --- a/src/core/locale_translations.h +++ b/src/core/locale_translations.h @@ -652,7 +652,6 @@ MAKE_TRANSLATION(wwSolarTemp, "solartemp", "solar boiler temperature", "Solarkes MAKE_TRANSLATION(switchtime, "switchtime", "program switchtime", "Programmschaltzeit", "Programma schakeltijd", "Program Bytestid", "program czasowy", "programbyttetid", "heure commutation programme", "program değiştirme süresi", "ora commutazione programmata", "čas prepnutia programu", "čas přepnutí programu") MAKE_TRANSLATION(switchtime1, "switchtime1", "own1 program switchtime", "Programmschaltzeit Eigen 1", "Schakeltijd programma 1", "Program 1 Bytestid", "program przełączania 1", "byttetidprogram 1", "heure de commutation programme 1", "program1 değiştirme süresi", "ora commutazione programma 1", "vlastný 1 program prepnutia", "vlastní program 1 přepnutí") MAKE_TRANSLATION(switchtime2, "switchtime2", "own2 program switchtime", "Programmschaltzeit Eigen 2", "Schakeltijd programma 2", "Program 2 Bytestid", "program przełączania 2", "byttetid program 2", "heure de changement programme 2", "program1 değiştirme süresi", "ora commutazione programma 2", "vlastný 2 program prepnutia", "vlastní program 2 přepnutí") -MAKE_TRANSLATION(wwswitchtime, "switchtimeWW", "program switchtime warm water", "Programmschaltzeit Warmwasser", "Warm water programma schakeltijd", "Varmvattenprogram Bytestid", "program czasowy", "byttetid varmtvannsprogram", "heure commutation programme", "sıcak kullanıom suyu program değiştirme süresi", "Tempo di commutazione del programma", "čas prepnutia programu", "čas přepnutí program TUV") MAKE_TRANSLATION(wwcircswitchtime, "circswitchtime", "circulation program switchtime", "Zirculationsprogramm Schaltzeit", "Schakeltijd circulatieprogramma", "Cirkulationsprogram Bytestid", "program cyrkulacji", "byttetid sirkulasjonsprogram", "heure commutation programme circulation", "sirkülasyon program değiştirme süresi", "ora commutazione programma circolazione", "čas prepnutia cirkulačného programu", "čas přepnutí programu cirkulace") MAKE_TRANSLATION(dateTime, "datetime", "date/time", "Datum/Zeit", "Datum/Tijd", "Datum/Tid", "data i godzina", "dato/tid", "date/heure", "zaman/saat", "Data/Ora", "dátum/čas", "datum/čas") MAKE_TRANSLATION(errorCode, "errorcode", "error code", "Fehlercode", "Foutmeldingscode", "Felkod", "kod błędu", "feikode", "code erreur", "hata kodu", "codice errore", "error kód", "chybový kód") diff --git a/src/core/modbus_entity_parameters.hpp b/src/core/modbus_entity_parameters.hpp index 4d5c5c1db..707e15c3d 100644 --- a/src/core/modbus_entity_parameters.hpp +++ b/src/core/modbus_entity_parameters.hpp @@ -393,7 +393,7 @@ const std::initializer_list Modbus::modbus_register_ma REGISTER_MAPPING(dt::THERMOSTAT, TAG_TYPE_DHW, FL_(wwDisinfectHour), 14, 1), // disinfecthour REGISTER_MAPPING(dt::THERMOSTAT, TAG_TYPE_DHW, FL_(wwMaxTemp), 15, 1), // maxtemp REGISTER_MAPPING(dt::THERMOSTAT, TAG_TYPE_DHW, FL_(wwOneTimeKey), 16, 1), // onetimekey - REGISTER_MAPPING(dt::THERMOSTAT, TAG_TYPE_DHW, FL_(wwswitchtime), 17, 11), // switchtimeWW + REGISTER_MAPPING(dt::THERMOSTAT, TAG_TYPE_DHW, FL_(switchtime), 17, 11), // switchtime REGISTER_MAPPING(dt::THERMOSTAT, TAG_TYPE_DHW, FL_(wwcircswitchtime), 28, 8), // circswitchtime REGISTER_MAPPING(dt::THERMOSTAT, TAG_TYPE_DHW, FL_(holidays), 36, 13), // holidays REGISTER_MAPPING(dt::THERMOSTAT, TAG_TYPE_DHW, FL_(vacations), 49, 13), // vacations diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 1b617b302..6d7275a37 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -513,7 +513,8 @@ uint8_t Thermostat::HeatingCircuit::get_mode() const { } else if (mode_new == 2) { return HeatingCircuit::Mode::AUTO; } - } else if ((model == EMSdevice::EMS_DEVICE_FLAG_RC300) || (model == EMSdevice::EMS_DEVICE_FLAG_R3000) || (model == EMSdevice::EMS_DEVICE_FLAG_RC100)) { + } else if (model == EMSdevice::EMS_DEVICE_FLAG_RC300 || model == EMSdevice::EMS_DEVICE_FLAG_R3000 || model == EMSdevice::EMS_DEVICE_FLAG_RC100 + || model == EMSdevice::EMS_DEVICE_FLAG_HMC310) { if (mode == 0) { return HeatingCircuit::Mode::MANUAL; } else if (mode == 1) { @@ -565,7 +566,8 @@ uint8_t Thermostat::HeatingCircuit::get_mode_type() const { } else if (modetype == 1) { return HeatingCircuit::Mode::ON; } - } else if ((model == EMSdevice::EMS_DEVICE_FLAG_RC300) || (model == EMSdevice::EMS_DEVICE_FLAG_R3000) || (model == EMSdevice::EMS_DEVICE_FLAG_BC400)) { + } else if (model == EMSdevice::EMS_DEVICE_FLAG_RC300 || model == EMSdevice::EMS_DEVICE_FLAG_R3000 || model == EMSdevice::EMS_DEVICE_FLAG_BC400 + || model == EMSdevice::EMS_DEVICE_FLAG_HMC310) { if (modetype == 0) { return HeatingCircuit::Mode::ECO; } else if (modetype == 1) { @@ -1265,7 +1267,7 @@ void Thermostat::process_RC300WWmode(std::shared_ptr telegram) { // circulation pump see: https://github.com/Th3M3/buderus_ems-wiki/blob/master/Einstellungen%20der%20Bedieneinheit%20RC310.md has_update(telegram, dhw->wwCircPump_, 1); // FF=off, 0=on ? - if (model() == EMSdevice::EMS_DEVICE_FLAG_BC400) { + if (model() == EMSdevice::EMS_DEVICE_FLAG_BC400 || model() == EMSdevice::EMS_DEVICE_FLAG_HMC310) { const uint8_t modes[] = {0, 5, 1, 2, 4}; // off, eco+, eco, comfort, auto uint8_t wwmode = dhw->wwMode_ < sizeof(modes) ? modes[dhw->wwMode_] : EMS_VALUE_UINT8_NOTSET; telegram->read_value(wwmode, 2); @@ -2235,7 +2237,7 @@ bool Thermostat::set_wwmode(const char * value, const int8_t id) { return false; } write_command(0xB0, 2, set, 0xB0); - } else if (model() == EMSdevice::EMS_DEVICE_FLAG_BC400) { + } else if (model() == EMSdevice::EMS_DEVICE_FLAG_BC400 || model() == EMSdevice::EMS_DEVICE_FLAG_HMC310) { if (!Helpers::value2enum(value, set, FL_(enum_wwMode4))) { // off, eco+, eco, comfort, auto return false; } @@ -2946,6 +2948,7 @@ bool Thermostat::set_mode(const char * value, const int8_t id) { case EMSdevice::EMS_DEVICE_FLAG_RC300: case EMSdevice::EMS_DEVICE_FLAG_RC100: case EMSdevice::EMS_DEVICE_FLAG_R3000: + case EMSdevice::EMS_DEVICE_FLAG_HMC310: mode_list = FL_(enum_mode); break; case EMSdevice::EMS_DEVICE_FLAG_JUNKERS: @@ -3071,6 +3074,7 @@ bool Thermostat::set_mode_n(const uint8_t mode, const int8_t id) { case EMSdevice::EMS_DEVICE_FLAG_RC300: case EMSdevice::EMS_DEVICE_FLAG_RC100: case EMSdevice::EMS_DEVICE_FLAG_R3000: + case EMSdevice::EMS_DEVICE_FLAG_HMC310: offset = EMS_OFFSET_RCPLUSSet_mode; set_mode_value = set_mode_value == 2 ? 0xFF : 0; break; @@ -3105,7 +3109,8 @@ bool Thermostat::set_mode_n(const uint8_t mode, const int8_t id) { hc->mode = set_mode_value >> 1; } else if (model_ == EMSdevice::EMS_DEVICE_FLAG_BC400 || model_ == EMSdevice::EMS_DEVICE_FLAG_CR120) { hc->mode_new = set_mode_value; - } else if (model_ == EMSdevice::EMS_DEVICE_FLAG_RC300 || model_ == EMSdevice::EMS_DEVICE_FLAG_R3000 || model_ == EMSdevice::EMS_DEVICE_FLAG_RC100) { + } else if (model_ == EMSdevice::EMS_DEVICE_FLAG_RC300 || model_ == EMSdevice::EMS_DEVICE_FLAG_R3000 || model_ == EMSdevice::EMS_DEVICE_FLAG_HMC310 + || model_ == EMSdevice::EMS_DEVICE_FLAG_RC100) { hc->mode = set_mode_value == 0xFF ? 1 : 0; } else if (model_ == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) { hc->mode = set_mode_value - 1; @@ -4188,6 +4193,7 @@ void Thermostat::register_device_values() { case EMSdevice::EMS_DEVICE_FLAG_R3000: case EMSdevice::EMS_DEVICE_FLAG_BC400: case EMSdevice::EMS_DEVICE_FLAG_CR120: + case EMSdevice::EMS_DEVICE_FLAG_HMC310: register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &dateTime_, DeviceValueType::STRING, @@ -4619,6 +4625,7 @@ void Thermostat::register_device_values_hc(std::shared_ptrmode_new, DeviceValueType::ENUM, FL_(enum_mode2), FL_(mode), DeviceValueUOM::NONE, MAKE_CF_CB(set_mode)); } else { @@ -5058,7 +5065,8 @@ void Thermostat::register_device_values_dhw(std::shared_ptrwwMode_, DeviceValueType::ENUM, FL_(enum_wwMode4), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode)); } else if (model() == EMSdevice::EMS_DEVICE_FLAG_R3000) { register_device_value(tag, &dhw->wwMode_, DeviceValueType::ENUM, FL_(enum_wwMode5), FL_(wwMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwmode)); @@ -5134,7 +5142,7 @@ void Thermostat::register_device_values_dhw(std::shared_ptrwwMaxTemp_, DeviceValueType::UINT8, FL_(wwMaxTemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_wwMaxTemp)); register_device_value(tag, &dhw->wwOneTimeKey_, DeviceValueType::BOOL, FL_(wwOneTimeKey), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwOneTimeKey)); register_device_value( - tag, &dhw->wwSwitchTime_, DeviceValueType::STRING, FL_(tpl_switchtime), FL_(wwswitchtime), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwSwitchTime)); + tag, &dhw->wwSwitchTime_, DeviceValueType::STRING, FL_(tpl_switchtime), FL_(switchtime), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwSwitchTime)); register_device_value(tag, &dhw->wwCircSwitchTime_, DeviceValueType::STRING, @@ -5157,7 +5165,7 @@ void Thermostat::register_device_values_dhw(std::shared_ptrwwMaxTemp_, DeviceValueType::UINT8, FL_(wwMaxTemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_wwMaxTemp), 60, 80); register_device_value(tag, &dhw->wwOneTimeKey_, DeviceValueType::BOOL, FL_(wwOneTimeKey), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwOneTimeKey)); register_device_value( - tag, &dhw->wwSwitchTime_, DeviceValueType::STRING, FL_(tpl_switchtime), FL_(wwswitchtime), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwSwitchTime)); + tag, &dhw->wwSwitchTime_, DeviceValueType::STRING, FL_(tpl_switchtime), FL_(switchtime), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwSwitchTime)); register_device_value(tag, &dhw->wwCircSwitchTime_, DeviceValueType::STRING, diff --git a/src/devices/thermostat.h b/src/devices/thermostat.h index 843872f52..616e4759e 100644 --- a/src/devices/thermostat.h +++ b/src/devices/thermostat.h @@ -229,8 +229,8 @@ class Thermostat : public EMSdevice { // check to see if the thermostat is a hybrid of the R300 inline bool isRC300() const { - return ((model() == EMSdevice::EMS_DEVICE_FLAG_RC300) || (model() == EMSdevice::EMS_DEVICE_FLAG_R3000) || (model() == EMSdevice::EMS_DEVICE_FLAG_BC400) - || (model() == EMSdevice::EMS_DEVICE_FLAG_CR120)); + return (model() == EMSdevice::EMS_DEVICE_FLAG_RC300 || model() == EMSdevice::EMS_DEVICE_FLAG_R3000 || model() == EMSdevice::EMS_DEVICE_FLAG_BC400 + || model() == EMSdevice::EMS_DEVICE_FLAG_CR120 || model() == EMSdevice::EMS_DEVICE_FLAG_HMC310); } inline uint8_t id2dhw(const int8_t id) const { // returns telegram offset for TAG(id) diff --git a/src/version.h b/src/version.h index 90654f617..06be1ce7a 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.7.3-dev.1" +#define EMSESP_APP_VERSION "3.7.3-dev.2"