Skip to content

Commit

Permalink
Publish discovery when detecting first data only
Browse files Browse the repository at this point in the history
  • Loading branch information
mikakoivisto committed Jun 13, 2024
1 parent 34b7105 commit 3dc4c2e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ class App {

console.log(JSON.stringify(out));
logDebug(`Publishing to ${config.xiomiTopic}/${mac}/${type} data: ${JSON.stringify(out)}`);
if (!self.discoveredTags[mac + type]) {
self.discoveredTags[mac + type] = true;
if (!self.discoveredTags[mac]) {
self.discoveredTags[mac] = true;
this.publishDiscovery(out);
}
self.mqtt.publish(config.xiomiTopic + "/" + mac + "/" + type, JSON.stringify(out), { retain: true});
Expand Down

0 comments on commit 3dc4c2e

Please sign in to comment.