Presence detection: If HA minor id 40004 is detected, use uuid as name
This commit is contained in:
2
Config.h
2
Config.h
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#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_QOS_LEVEL 1
|
||||||
#define MQTT_CLEAN_SESSIONS false
|
#define MQTT_CLEAN_SESSIONS false
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ void PresenceDetection::buildCsv(const PdDevice &device)
|
|||||||
++_csvIndex;
|
++_csvIndex;
|
||||||
|
|
||||||
int i=0;
|
int i=0;
|
||||||
while(device.name[i] != 0x00 && i < 30)
|
while(device.name[i] != 0x00 && i < sizeof(device.name))
|
||||||
{
|
{
|
||||||
_csv[_csvIndex] = device.name[i];
|
_csv[_csvIndex] = device.name[i];
|
||||||
++_csvIndex;
|
++_csvIndex;
|
||||||
@@ -192,6 +192,7 @@ void PresenceDetection::onResult(NimBLEAdvertisedDevice *device)
|
|||||||
if(ENDIAN_CHANGE_U16(oBeacon.getMinor()) == 40004)
|
if(ENDIAN_CHANGE_U16(oBeacon.getMinor()) == 40004)
|
||||||
{
|
{
|
||||||
pdDevice.timestamp = millis();
|
pdDevice.timestamp = millis();
|
||||||
|
strcpy(pdDevice.name, oBeacon.getProximityUUID().toString().c_str());
|
||||||
_devices[addr] = pdDevice;
|
_devices[addr] = pdDevice;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
struct PdDevice
|
struct PdDevice
|
||||||
{
|
{
|
||||||
char address[18] = {0};
|
char address[18] = {0};
|
||||||
char name[30] = {0};
|
char name[37] = {0};
|
||||||
unsigned long timestamp = 0;
|
unsigned long timestamp = 0;
|
||||||
int rssi = 0;
|
int rssi = 0;
|
||||||
bool hasRssi = false;
|
bool hasRssi = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user