Skip to content

Commit

Permalink
Removed availability reporting for non-local sensors ie bluetooth sen…
Browse files Browse the repository at this point in the history
…sors (#1453)

* Fix availability reporting of remote sensors
  • Loading branch information
NorthernMan54 authored Feb 12, 2023
1 parent 52a13c4 commit c829152
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions main/ZmqttDiscovery.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c829152

Please sign in to comment.