From cb1e09106ec14a399559ee688f8f4a810f886a07 Mon Sep 17 00:00:00 2001 From: technyon Date: Wed, 3 Jan 2024 12:35:30 +0100 Subject: [PATCH] Presence detection: If HA minor id 40004 is detected, use uuid as name --- Config.h | 2 +- PresenceDetection.cpp | 3 ++- PresenceDetection.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Config.h b/Config.h index aec09983..baea3ed3 100644 --- a/Config.h +++ b/Config.h @@ -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 diff --git a/PresenceDetection.cpp b/PresenceDetection.cpp index 6f702d59..d8d0e96d 100644 --- a/PresenceDetection.cpp +++ b/PresenceDetection.cpp @@ -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; } } diff --git a/PresenceDetection.h b/PresenceDetection.h index 049af9fd..c5d93c33 100644 --- a/PresenceDetection.h +++ b/PresenceDetection.h @@ -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;