Skip to content

Commit

Permalink
Added general "parameter" category 0 for temporary device-specific pa…
Browse files Browse the repository at this point in the history
…rameters generated by /QDB
  • Loading branch information
fredlcore committed Jan 5, 2025
1 parent 01fa749 commit 5b0c9b1
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 10 deletions.
49 changes: 40 additions & 9 deletions BSB_LAN/BSB_LAN.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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<CAT_UNKNOWN;cat++) {
printKat(cat, 0, false);
if (decodedTelegram.error != 258 && decodedTelegram.error != 263) {
Expand Down Expand Up @@ -5043,6 +5046,14 @@ void loop() {
printToWebClient("<table><tr><td>&nbsp;</td><td>&nbsp;</td></tr>\r\n");
float cat_min = -1, cat_max = -1;
for (int cat=0;cat<CAT_UNKNOWN;cat++) {
if (active_cmdtbl == heating_cmdtbl && cat < CAT_USER_DEFINED) {
if (cat == 0) {
printFmtToWebClient("<tr><td><a href='K0!%d'>", bus->getBusDest());
printToWebClient(CF_PROGLIST_TEXT "</a></td><td>0 - 9999</td></tr>\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) {
Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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]) {
Expand Down Expand Up @@ -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]) {
Expand Down
6 changes: 6 additions & 0 deletions BSB_LAN/include/print_telegram.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion docs/EN/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5b0c9b1

Please sign in to comment.