From 5b0c9b1219e185147bb01496735da046ccdf027c Mon Sep 17 00:00:00 2001 From: fredlcore Date: Sun, 5 Jan 2025 16:13:39 +0800 Subject: [PATCH] Added general "parameter" category 0 for temporary device-specific parameters generated by /QDB --- BSB_LAN/BSB_LAN.ino | 49 ++++++++++++++++++++++++++------ BSB_LAN/include/print_telegram.h | 6 ++++ docs/EN/CHANGELOG.md | 2 +- 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/BSB_LAN/BSB_LAN.ino b/BSB_LAN/BSB_LAN.ino index 64b68092..dabb3c4a 100644 --- a/BSB_LAN/BSB_LAN.ino +++ b/BSB_LAN/BSB_LAN.ino @@ -896,6 +896,9 @@ void listEnumValues(uint_farptr_t enumstr, uint16_t enumstr_len, const char *pre inline uint8_t get_cmdtbl_category(int i) { int cat_min = 0; int cat_max = 0; + if (active_cmdtbl == heating_cmdtbl && active_cmdtbl[i].line >= 0 && active_cmdtbl[i].line < 10000) { + return 0; // For temporary heating_cmdtbl, there is only one category 0 for all parameters below 10000 + } for (uint cat=0;cat  \r\n"); float cat_min = -1, cat_max = -1; for (int cat=0;cat", bus->getBusDest()); + printToWebClient(CF_PROGLIST_TEXT "0 - 9999\r\n"); + writelnToDebug(); + } + continue; + } if ((bus->getBusType() != BUS_PPS) || (bus->getBusType() == BUS_PPS && (cat == CAT_PPS || cat == CAT_USERSENSORS))) { printKat(cat,1); if (decodedTelegram.error != 258 && decodedTelegram.error != 263) { @@ -5830,12 +5841,21 @@ next_parameter: uint16_t cat_dev_fam_var = printKat(cat,1); uint8_t cat_dev_fam = cat_dev_fam_var >> 8; uint8_t cat_dev_var = cat_dev_fam_var & 0xFF; + cat_min = ENUM_CAT_NR[cat*2]; + cat_max = ENUM_CAT_NR[cat*2+1]; writelnToDebug(); if ((bus->getBusType() != BUS_PPS && decodedTelegram.error != 258) || (bus->getBusType() == BUS_PPS && (cat == CAT_PPS || cat == CAT_USERSENSORS))) { + if (active_cmdtbl == heating_cmdtbl && cat < CAT_USER_DEFINED) { + if (cat == 0) { + cat_min = 0; + cat_max = 9999; + decodedTelegram.enumdescaddr = CF_PROGLIST_TXT; + } else { + continue; + } + } if (notfirst) {printToWebClient(",\r\n");} else {notfirst = true;} printFmtToWebClient("\"%d\": { \"name\": \"", cat); - cat_min = ENUM_CAT_NR[cat*2]; - cat_max = ENUM_CAT_NR[cat*2+1]; uint8_t cat_dev_id = 0; char* cat_dev_name = NULL; for (uint x=0; x < sizeof(dev_lookup)/sizeof(dev_lookup[0]); x++) { @@ -5866,8 +5886,14 @@ next_parameter: if(search_cat > sizeof(ENUM_CAT_NR)/sizeof(ENUM_CAT_NR[0])) { search_cat = 0; // if we got an invalid category, just use 0 } - cat_min = ENUM_CAT_NR[search_cat]; - cat_max = ENUM_CAT_NR[search_cat+1]; + if (active_cmdtbl == heating_cmdtbl && search_cat < CAT_USER_DEFINED) { + search_cat = 0; + cat_min = 0; + cat_max = 9999; + } else { + cat_min = ENUM_CAT_NR[search_cat]; + cat_max = ENUM_CAT_NR[search_cat+1]; + } /* if (search_cat+2 < sizeof(ENUM_CAT_NR)/sizeof(*ENUM_CAT_NR)) { // only perform category boundary check if there is a higher category present if (cat_max > ENUM_CAT_NR[search_cat+2]) { @@ -6519,18 +6545,23 @@ next_parameter: uint8_t destAddr = bus->getBusDest(); if (range[0]=='K') { //Here will be parsing category number not parameter - parameter param = parsingStringToParameter(range+1); - if (param.dest_addr > -1) { - set_temp_destination(param.dest_addr); + parameter category = parsingStringToParameter(range+1); + if (category.dest_addr > -1) { + set_temp_destination(category.dest_addr); } - printKat(param.number,1); + printKat(category.number,1); writelnToDebug(); - uint cat = param.number * 2; // * 2 - two columns in ENUM_CAT_NR table + uint cat = category.number * 2; // * 2 - two columns in ENUM_CAT_NR table if (cat >= sizeof(ENUM_CAT_NR)/sizeof(*ENUM_CAT_NR)) { // set category to highest category if selected category is out of range cat = (sizeof(ENUM_CAT_NR)/sizeof(*ENUM_CAT_NR))-2; } start = ENUM_CAT_NR[cat]; end = ENUM_CAT_NR[cat+1]; + if (active_cmdtbl == heating_cmdtbl && category.number < (float)CAT_USER_DEFINED) { + cat = 0; + start = 0; + end = 9999; + } /* if (cat+2 < sizeof(ENUM_CAT_NR)/sizeof(*ENUM_CAT_NR)) { // only perform category boundary check if there is a higher category present if (end > ENUM_CAT_NR[cat+2]) { diff --git a/BSB_LAN/include/print_telegram.h b/BSB_LAN/include/print_telegram.h index 10fb84b8..0a463f25 100644 --- a/BSB_LAN/include/print_telegram.h +++ b/BSB_LAN/include/print_telegram.h @@ -380,6 +380,12 @@ void printENUM(uint_farptr_t enumstr,uint16_t enumstr_len,uint16_t search_val, i } uint16_t printKat(uint8_t cat, int print_val, boolean debug_output) { + + if (active_cmdtbl == heating_cmdtbl && cat < CAT_USER_DEFINED) { + decodedTelegram.enumdescaddr = CF_PROGLIST_TXT; + return (my_dev_fam << 8) + my_dev_var; + } + const char* enumstr = ENUM_CAT; const uint16_t enumstr_len = sizeof(ENUM_CAT); uint8_t val = 0; diff --git a/docs/EN/CHANGELOG.md b/docs/EN/CHANGELOG.md index 50e074bf..476315fe 100644 --- a/docs/EN/CHANGELOG.md +++ b/docs/EN/CHANGELOG.md @@ -7,7 +7,7 @@ - **ATTENTION: BREAKING CHANGE** The acknowledgement message sent by BSB-LAN to the `MQTT` topic has been removed. Instead, QoS for publishing messages has been set to level 1. - **ATTENTION: BREAKING CHANGE:** Log configuration values have changed. However, only users that have logged to UDP are affected and will have to adjust their settings. - **ATTENTION:** `/JK=ALL` now lists all categories of all devices in LPB systems with more than one device. Use `dev_fam` (device family), `dev_var` (device variant), `dev_id` (destination device ID) and `dev_name` (device model) elements to sort and identify which category applies to the current destination device. -- Added new URL command /QDB - this queries the heating system for device-specific parameters and activates these until reboot. Categories do not apply, you have know the parameter numbers you want to query and access them directy (e.g. /0-9999). +- Added new URL command /QDB - this queries BSB/LPB heating systems for device-specific parameters (for safety reasons, only read-only parameters are added) and activates these until reboot. All these parameters are in category 0, generically named "Parameters". Likewise, the name of all parameters is "Parameter". You have to identify their meaning by their parameter number. This is not a replacement for generating a proper device-specific parameter list as it only contains few parameter types which we know for certain how they work and no harm can be done (mostly read-only status temperatures). However, these can be helpful for heating technicians which want to monitor on the spot the behavior of a random heating system without the need to create a device-specific parameter list. - Added setting to only publish log parameters to MQTT. Forcing MQTT updates via /poll topic are still possible. - Added state_class for non cumulative sensors in MQTT auto-discovery