[BT] Update PublishDeviceData to run presenceUseBeaconUuid check when device is close (#1915)
This commit is contained in:
1 parent
0929fa23a8
commit
30f8264878
1 file changed
+10
-12
+10
-12
@@ -1174,6 +1174,16 @@ void PublishDeviceData(JsonObject& BLEdata) {
|
|||||||
BLEdata.remove("cont");
|
BLEdata.remove("cont");
|
||||||
BLEdata.remove("track");
|
BLEdata.remove("track");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if distance available, check if presenceUseBeaconUuid is true, model_id is IBEACON then set id as uuid
|
||||||
|
if (BLEdata.containsKey("distance")) {
|
||||||
|
if (BTConfig.presenceUseBeaconUuid && BLEdata.containsKey("model_id") && BLEdata["model_id"].as<String>() == "IBEACON") {
|
||||||
|
BLEdata["mac"] = BLEdata["id"].as<std::string>();
|
||||||
|
BLEdata["id"] = BLEdata["uuid"].as<std::string>();
|
||||||
|
}
|
||||||
|
handleJsonEnqueue(BLEdata, QueueSemaphoreTimeOutTask);
|
||||||
|
}
|
||||||
|
|
||||||
// If the device is not a sensor and pubOnlySensors is true we don't publish this payload
|
// If the device is not a sensor and pubOnlySensors is true we don't publish this payload
|
||||||
if (!BTConfig.pubOnlySensors || BLEdata.containsKey("model")) { // Identified device
|
if (!BTConfig.pubOnlySensors || BLEdata.containsKey("model")) { // Identified device
|
||||||
buildTopicFromId(BLEdata, subjectBTtoMQTT);
|
buildTopicFromId(BLEdata, subjectBTtoMQTT);
|
||||||
@@ -1182,18 +1192,6 @@ void PublishDeviceData(JsonObject& BLEdata) {
|
|||||||
Log.notice(F("Not a sensor device filtered" CR));
|
Log.notice(F("Not a sensor device filtered" CR));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (BLEdata.containsKey("distance")) {
|
|
||||||
if (BLEdata.containsKey("servicedatauuid"))
|
|
||||||
BLEdata.remove("servicedatauuid");
|
|
||||||
if (BLEdata.containsKey("servicedata"))
|
|
||||||
BLEdata.remove("servicedata");
|
|
||||||
if (BLEdata.containsKey("manufacturerdata"))
|
|
||||||
BLEdata.remove("manufacturerdata");
|
|
||||||
if (BTConfig.presenceUseBeaconUuid && BLEdata.containsKey("model_id") && BLEdata["model_id"].as<String>() == "IBEACON") {
|
|
||||||
BLEdata["mac"] = BLEdata["id"];
|
|
||||||
BLEdata["id"] = BLEdata["uuid"];
|
|
||||||
}
|
|
||||||
handleJsonEnqueue(BLEdata, QueueSemaphoreTimeOutTask);
|
|
||||||
} else {
|
} else {
|
||||||
Log.notice(F("Low rssi, device filtered" CR));
|
Log.notice(F("Low rssi, device filtered" CR));
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in new issue
Block a user