Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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