Skip to content

Commit

Permalink
[BT] presence publishing fix independent of pubOnlySensors
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiH committed Jan 26, 2024
1 parent a7f43ed commit 61836d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main/ZgatewayBT.ino
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,8 @@ void procBLETask(void* pvParameters) {
BLEdata["rssi"] = (int)advertisedDevice->getRSSI();
if (advertisedDevice->haveTXPower())
BLEdata["txpower"] = (int8_t)advertisedDevice->getTXPower();
if (advertisedDevice->haveRSSI() && !BTConfig.pubOnlySensors && BTConfig.presenceEnable) {
hass_presence(BLEdata); // this device has an rssi and we don't want only sensors so in consequence we can use it for home assistant room presence component
if (advertisedDevice->haveRSSI() && BTConfig.presenceEnable) {
hass_presence(BLEdata); // this device has an rssi and with either only sensors or not we can use it for home assistant room presence component
}
if (advertisedDevice->haveServiceData()) {
int serviceDataCount = advertisedDevice->getServiceDataCount();
Expand Down Expand Up @@ -1149,7 +1149,7 @@ void PublishDeviceData(JsonObject& BLEdata) {
BLEdata.remove("track");
}
// If the device is not a sensor and pubOnlySensors is true we don't publish this payload
if (!BTConfig.pubOnlySensors || BLEdata.containsKey("model") || BLEdata.containsKey("distance")) { // Identified device
if (!BTConfig.pubOnlySensors || BLEdata.containsKey("model")) { // Identified device
buildTopicFromId(BLEdata, subjectBTtoMQTT);
handleJsonEnqueue(BLEdata, QueueSemaphoreTimeOutTask);
} else {
Expand Down

0 comments on commit 61836d1

Please sign in to comment.