Skip to content

Commit

Permalink
Improve Mi Flora data detection
Browse files Browse the repository at this point in the history
  • Loading branch information
mikakoivisto committed Jun 13, 2024
1 parent c501361 commit 95465c8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,14 @@ class App {
this.publishDiscovery(out);
}
self.mqtt.publish(config.xiomiTopic + "/" + mac, JSON.stringify(out), { retain: true});
} else if (measurement.data.indexOf("02010603029") !== -1) {
} else if (measurement.data.indexOf("020106") !== -1 && measurement.data.indexOf("95FE") !== -1) {
// mi flora
let data = hexToBytes(measurement.data)
let data = hexToBytes(measurement.data);
// Ensure that the data length is sufficient to contain the expected data types
if (data.length < 24) {
console.log("Data too short to contain valid Mi Flora information", measurement.data);
return;
}
var dataType = data[23];
var out = {
mac: measurement.mac,
Expand Down

0 comments on commit 95465c8

Please sign in to comment.