Removed availability reporting for non-local sensors ie bluetooth sensors (#1453)

* Fix availability reporting of remote sensors
This commit is contained in:
Northern Man authored and GitHub committed 2023-02-12 08:24:35 -06:00
1 parent 52a13c4826
commit c829152f29
1 file changed
+3 -9
+3 -9
View File
@@ -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;
}