diff --git a/BSB_LAN/include/mqtt_handler.h b/BSB_LAN/include/mqtt_handler.h index 3c802042..96aed27b 100644 --- a/BSB_LAN/include/mqtt_handler.h +++ b/BSB_LAN/include/mqtt_handler.h @@ -52,11 +52,8 @@ void mqtt_sendtoBroker(parameter param) { StringBuffer sb_topic; initStringBuffer(&sb_payload, MQTTPayload, sizeof(MQTTPayload)); initStringBuffer(&sb_topic, MQTTTopic, sizeof(MQTTTopic)); -#if defined(NO_MQTT_CATEGORY) appendStringBuffer(&sb_topic, "%s/%d/%g/status", MQTTTopicPrefix, (param.dest_addr==-1?bus->getBusDest():param.dest_addr), param.number); -#else appendStringBuffer(&sb_topic, "%s/%d/%d/%g/status", MQTTTopicPrefix, (param.dest_addr==-1?bus->getBusDest():param.dest_addr), decodedTelegram.cat, param.number); -#endif switch(mqtt_mode) { // ============================================= @@ -315,11 +312,8 @@ void mqtt_callback(char* topic, byte* passed_payload, unsigned int length) { // New get/set hierarchy topic: BSB-LAN////set|inf|poll // Optional payload will be used for set command -#if defined(NO_MQTT_HIERARCHY) if (sscanf(topic+topic_len, "/%d/%g/%s", &parsed_device, &parsed_parameter, parsed_command) == 3) { -#else if (sscanf(topic+topic_len, "/%d/%d/%g/%s", &parsed_device, &parsed_category, &parsed_parameter, parsed_command) == 4) { -#endif param.dest_addr = parsed_device; param.number = parsed_parameter; if (!strcmp(parsed_command, "poll")) { @@ -448,11 +442,8 @@ boolean mqtt_send_discovery(boolean create=true) { loadPrognrElementsFromTable(line, i); loadCategoryDescAddr(); appendStringBuffer(&sb_topic, "homeassistant/"); -#if defined(NO_MQTT_CATEGORY) appendStringBuffer(&sb_payload, "{\"~\":\"%s/%d/%g\",\"unique_id\":\"%g-%d-%d-%d\",\"state_topic\":\"~/status\",", MQTTTopicPrefix, bus->getBusDest(), line, line, cmdtbl[i].dev_fam, cmdtbl[i].dev_var, my_dev_serial); -#else 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); -#endif 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)) {