From c829152f29c165f2421a2b894f8d793a01d9248e Mon Sep 17 00:00:00 2001 From: Northern Man <19808920+NorthernMan54@users.noreply.github.com> Date: Sun, 12 Feb 2023 09:24:35 -0500 Subject: [PATCH] Removed availability reporting for non-local sensors ie bluetooth sensors (#1453) * Fix availability reporting of remote sensors --- main/ZmqttDiscovery.ino | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/main/ZmqttDiscovery.ino b/main/ZmqttDiscovery.ino index 2faad36..0b8ddc7 100644 --- a/main/ZmqttDiscovery.ino +++ b/main/ZmqttDiscovery.ino @@ -249,16 +249,10 @@ void createDiscovery(const char* sensor_type, sensor["stat_t"] = state_topic; } - if (availability_topic[0]) { + if (availability_topic[0] && gateway_entity) { char avty_topic[mqtt_topic_max_size]; - // If not an entity belonging to the gateway we put wild card for the location and gateway name - // allowing to have the entity detected by several gateways and a consistent discovery topic among the gateways - if (gateway_entity) { - strcpy(avty_topic, mqtt_topic); - strcat(avty_topic, gateway_name); - } else { - strcpy(avty_topic, "+/+"); - } + strcpy(avty_topic, mqtt_topic); + strcat(avty_topic, gateway_name); strcat(avty_topic, availability_topic); sensor["avty_t"] = avty_topic; }