Added SetOption124 (Zigbee) Hide bridge topic from zigbee topic (use with SetOption89)

This commit is contained in:
nicandris 2021-03-13 12:41:42 +01:00
parent 130b690d24
commit 5cdffadbe6
2 changed files with 11 additions and 3 deletions

View File

@ -149,7 +149,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
uint32_t mqtt_state_retain : 1; // bit 7 (v9.3.0.1) - CMND_STATERETAIN
uint32_t mqtt_info_retain : 1; // bit 8 (v9.3.0.1) - CMND_INFORETAIN
uint32_t wiegand_hex_output : 1; // bit 9 (v9.3.1.1) - SetOption123 - (Wiegand) switch tag number output to hex format (1)
uint32_t spare10 : 1; // bit 10
uint32_t zigbee_hide_bridge_topic : 1; // bit 10 (v9.3.xxx) - SetOption124 - (Zigbee) Hide bridge topic from zigbee topic (use with SetOption89) (1)
uint32_t spare11 : 1; // bit 11
uint32_t spare12 : 1; // bit 12
uint32_t spare13 : 1; // bit 13

View File

@ -557,9 +557,17 @@ void Z_Device::jsonPublishAttrList(const char * json_prefix, const Z_attribute_l
char stemp[TOPSZ];
strlcpy(stemp, friendlyName, sizeof(stemp));
MakeValidMqtt(0, stemp);
snprintf_P(subtopic, sizeof(subtopic), PSTR("%s/%s"), TasmotaGlobal.mqtt_topic, stemp);
if (Settings.flag5.zigbee_hide_bridge_topic) {
snprintf_P(subtopic, sizeof(subtopic), PSTR("%s"), stemp);
} else {
snprintf_P(subtopic, sizeof(subtopic), PSTR("%s/%s"), TasmotaGlobal.mqtt_topic, stemp);
}
} else {
snprintf_P(subtopic, sizeof(subtopic), PSTR("%s/%04X"), TasmotaGlobal.mqtt_topic, shortaddr);
if (Settings.flag5.zigbee_hide_bridge_topic) {
snprintf_P(subtopic, sizeof(subtopic), PSTR("%04X"), shortaddr);
} else {
snprintf_P(subtopic, sizeof(subtopic), PSTR("%s/%04X"), TasmotaGlobal.mqtt_topic, shortaddr);
}
}
if (Settings.flag5.zb_topic_endpoint) {
if (attr_list.isValidSrcEp()) {