diff --git a/src/core/emsdevice.cpp b/src/core/emsdevice.cpp index 20d338584..d5c18839d 100644 --- a/src/core/emsdevice.cpp +++ b/src/core/emsdevice.cpp @@ -368,7 +368,7 @@ void EMSdevice::fetch_values() { for (const auto & tf : telegram_functions_) { if (tf.fetch_) { - read_command(tf.telegram_type_id_); + read_command(tf.telegram_type_id_, 0, tf.length_); } } } @@ -547,8 +547,8 @@ void EMSdevice::show_mqtt_handlers(uuid::console::Shell & shell) const { } // register a callback function for a specific telegram type -void EMSdevice::register_telegram_type(const uint16_t telegram_type_id, const char * telegram_type_name, bool fetch, const process_function_p f) { - telegram_functions_.emplace_back(telegram_type_id, telegram_type_name, fetch, false, f); +void EMSdevice::register_telegram_type(const uint16_t telegram_type_id, const char * telegram_type_name, bool fetch, const process_function_p f, uint8_t length) { + telegram_functions_.emplace_back(telegram_type_id, telegram_type_name, fetch, false, length, f); } // add to device value library, also know now as a "device entity" diff --git a/src/core/emsdevice.h b/src/core/emsdevice.h index f584e9b58..366f76a2e 100644 --- a/src/core/emsdevice.h +++ b/src/core/emsdevice.h @@ -259,7 +259,7 @@ class EMSdevice { void setCustomizationEntity(const std::string & entity_id); void getCustomizationEntities(std::vector & entity_ids); - void register_telegram_type(const uint16_t telegram_type_id, const char * telegram_type_name, bool fetch, const process_function_p cb); + void register_telegram_type(const uint16_t telegram_type_id, const char * telegram_type_name, bool fetch, const process_function_p cb, uint8_t length = 0); bool handle_telegram(std::shared_ptr telegram); std::string get_value_uom(const std::string & shortname) const; @@ -555,13 +555,15 @@ class EMSdevice { const char * telegram_type_name_; // e.g. RC20Message bool fetch_; // if this type_id be queried automatically bool received_; + uint8_t length_; const process_function_p process_function_; - TelegramFunction(uint16_t telegram_type_id, const char * telegram_type_name, bool fetch, bool received, const process_function_p process_function) + TelegramFunction(uint16_t telegram_type_id, const char * telegram_type_name, bool fetch, bool received, uint8_t length, const process_function_p process_function) : telegram_type_id_(telegram_type_id) , telegram_type_name_(telegram_type_name) , fetch_(fetch) , received_(received) + , length_(length) , process_function_(process_function) { } }; diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 0f8e60970..66c9505d2 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -83,7 +83,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const register_telegram_type(0x492, "HpHeaterConfig", true, MAKE_PF_CB(process_HpHeaterConfig)); register_telegram_type(0x488, "HPValve", true, MAKE_PF_CB(process_HpValve)); - register_telegram_type(0x484, "HPSilentMode", true, MAKE_PF_CB(process_HpSilentMode)); + register_telegram_type(0x484, "HPSilentMode", true, MAKE_PF_CB(process_HpSilentMode), 65); register_telegram_type(0x48B, "HPPumps", true, MAKE_PF_CB(process_HpPumps)); register_telegram_type(0x491, "HPAdditionalHeater", true, MAKE_PF_CB(process_HpAdditionalHeater)); register_telegram_type(0x499, "HPDhwSettings", true, MAKE_PF_CB(process_HpDhwSettings));