Presence detection: If HA minor id 40004 is detected, use uuid as name

This commit is contained in:
technyon
2024-01-03 12:35:30 +01:00
parent 8314a507fa
commit cb1e09106e
3 changed files with 4 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
#pragma once
#define NUKI_HUB_VERSION "8.29-pre-1"
#define NUKI_HUB_VERSION "8.29-pre-3"
#define MQTT_QOS_LEVEL 1
#define MQTT_CLEAN_SESSIONS false

View File

@@ -90,7 +90,7 @@ void PresenceDetection::buildCsv(const PdDevice &device)
++_csvIndex;
int i=0;
while(device.name[i] != 0x00 && i < 30)
while(device.name[i] != 0x00 && i < sizeof(device.name))
{
_csv[_csvIndex] = device.name[i];
++_csvIndex;
@@ -192,6 +192,7 @@ void PresenceDetection::onResult(NimBLEAdvertisedDevice *device)
if(ENDIAN_CHANGE_U16(oBeacon.getMinor()) == 40004)
{
pdDevice.timestamp = millis();
strcpy(pdDevice.name, oBeacon.getProximityUUID().toString().c_str());
_devices[addr] = pdDevice;
}
}

View File

@@ -7,7 +7,7 @@
struct PdDevice
{
char address[18] = {0};
char name[30] = {0};
char name[37] = {0};
unsigned long timestamp = 0;
int rssi = 0;
bool hasRssi = false;