Skip to content

Commit

Permalink
my_dev_id renamed to my_dev_serial
Browse files Browse the repository at this point in the history
  • Loading branch information
fredlcore committed Nov 29, 2024
1 parent e66083d commit a2707b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions BSB_LAN/include/mqtt_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ void mqtt_callback(char* topic, byte* passed_payload, unsigned int length) {
uint8_t destAddr = bus->getBusDest();
uint8_t save_my_dev_fam = my_dev_fam;
uint8_t save_my_dev_var = my_dev_var;
uint32_t save_my_dev_id = my_dev_id;
uint32_t save_my_dev_serial = my_dev_serial;
uint8_t setmode = 0; // 0 = send INF, 1 = send SET, 2 = query
int topic_len = strlen(MQTTTopicPrefix);
parameter param;
Expand Down Expand Up @@ -358,7 +358,7 @@ void mqtt_callback(char* topic, byte* passed_payload, unsigned int length) {
bus->setBusType(bus->getBusType(), bus->getBusAddr(), destAddr);
my_dev_fam = save_my_dev_fam;
my_dev_var = save_my_dev_var;
my_dev_id = save_my_dev_id;
my_dev_serial = save_my_dev_serial;
}
token = strtok(NULL, ","); // next parameter
}
Expand Down Expand Up @@ -407,7 +407,7 @@ void mqtt_callback(char* topic, byte* passed_payload, unsigned int length) {
bus->setBusType(bus->getBusType(), bus->getBusAddr(), destAddr);
my_dev_fam = save_my_dev_fam;
my_dev_var = save_my_dev_var;
my_dev_id = save_my_dev_id;
my_dev_serial = save_my_dev_serial;
}

}
Expand Down Expand Up @@ -441,7 +441,7 @@ boolean mqtt_send_discovery(boolean create=true) {
loadPrognrElementsFromTable(line, i);
loadCategoryDescAddr();
appendStringBuffer(&sb_topic, "homeassistant/");
appendStringBuffer(&sb_payload, "{\"~\":\"%s/%d/%d/%g\",\"unique_id\":\"%g-%d-%d-%d\",\"state_topic\":\"~/status\",", MQTTTopicPrefix, bus->getBusDest(), decodedTelegram.cat, line, line, cmdtbl[i].dev_fam, cmdtbl[i].dev_var, my_dev_id);
appendStringBuffer(&sb_payload, "{\"~\":\"%s/%d/%d/%g\",\"unique_id\":\"%g-%d-%d-%d\",\"state_topic\":\"~/status\",", MQTTTopicPrefix, bus->getBusDest(), decodedTelegram.cat, line, line, cmdtbl[i].dev_fam, cmdtbl[i].dev_var, my_dev_serial);
if (decodedTelegram.isswitch) {
appendStringBuffer(&sb_payload, "\"icon\":\"mdi:toggle-switch\",");
} else if (!strcmp(decodedTelegram.unit, U_DEG) || !strcmp(decodedTelegram.unit, U_TEMP_PER_MIN) || !strcmp(decodedTelegram.unit, U_CEL_MIN)) {
Expand Down Expand Up @@ -516,7 +516,7 @@ boolean mqtt_send_discovery(boolean create=true) {
}
appendStringBuffer(&sb_payload, "\",\"device\":{\"name\":\"%s\",\"identifiers\":\"%s-%02X%02X%02X%02X%02X%02X\",\"manufacturer\":\"bsb-lan.de\",\"model\":\"" MAJOR "." MINOR "." PATCH "\"}}", MQTTTopicPrefix, MQTTTopicPrefix, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);

appendStringBuffer(&sb_topic, "BSB-LAN/%g-%d-%d-%d/config", line, cmdtbl[i].dev_fam, cmdtbl[i].dev_var, my_dev_id);
appendStringBuffer(&sb_topic, "BSB-LAN/%g-%d-%d-%d/config", line, cmdtbl[i].dev_fam, cmdtbl[i].dev_var, my_dev_serial);

if (!create) {
MQTTPayload[0] = '\0'; // If remove flag is set, send empty message to instruct auto discovery to remove the entry
Expand Down
6 changes: 3 additions & 3 deletions BSB_LAN/include/print_ipwe.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void Ipwe() {
uint8_t d_addr = destAddr;
uint8_t save_my_dev_fam = my_dev_fam;
uint8_t save_my_dev_var = my_dev_var;
uint32_t save_my_dev_id = my_dev_id;
uint32_t save_my_dev_serial = my_dev_serial;
printFmtToDebug("IPWE sensors: %d\r\n", numIPWESensors);
printHTTPheader(HTTP_OK, MIME_TYPE_TEXT_HTML, HTTP_ADD_CHARSET_TO_HEADER, HTTP_FILE_NOT_GZIPPED, HTTP_NO_DOWNLOAD, HTTP_DO_NOT_CACHE);
printToWebClient("\r\n<html><body><form><table border=1><tbody><tr><td>Sensortyp</td><td>Adresse</td><td>Beschreibung</td><td>Wert</td><td>Luftfeuchtigkeit</td><td>Windgeschwindigkeit</td><td>Regenmenge</td></tr>");
Expand All @@ -41,7 +41,7 @@ void Ipwe() {
return_to_default_destination(destAddr);
my_dev_fam = save_my_dev_fam;
my_dev_var = save_my_dev_var;
my_dev_id = save_my_dev_id;
my_dev_serial = save_my_dev_serial;
}
}
query(ipwe_parameters[i].number);
Expand All @@ -58,7 +58,7 @@ void Ipwe() {
return_to_default_destination(destAddr);
my_dev_fam = save_my_dev_fam;
my_dev_var = save_my_dev_var;
my_dev_id = save_my_dev_id;
my_dev_serial = save_my_dev_serial;
}

if (LoggingMode & CF_LOGMODE_24AVG) {
Expand Down

0 comments on commit a2707b1

Please sign in to comment.