From 5cdffadbe6a54d9a46fdf2de37944036fab9d0b2 Mon Sep 17 00:00:00 2001 From: nicandris Date: Sat, 13 Mar 2021 12:41:42 +0100 Subject: [PATCH] Added SetOption124 (Zigbee) Hide bridge topic from zigbee topic (use with SetOption89) --- tasmota/settings.h | 2 +- tasmota/xdrv_23_zigbee_2a_devices_impl.ino | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tasmota/settings.h b/tasmota/settings.h index 25b0145da..347aca523 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -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 diff --git a/tasmota/xdrv_23_zigbee_2a_devices_impl.ino b/tasmota/xdrv_23_zigbee_2a_devices_impl.ino index 775621ffa..1c2b04b63 100644 --- a/tasmota/xdrv_23_zigbee_2a_devices_impl.ino +++ b/tasmota/xdrv_23_zigbee_2a_devices_impl.ino @@ -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()) {