Skip to content

Commit

Permalink
Presence detection: If HA minor id 40004 is detected, use uuid as name
Browse files Browse the repository at this point in the history
  • Loading branch information
technyon committed Jan 3, 2024
1 parent 8314a50 commit cb1e091
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Config.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion PresenceDetection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion PresenceDetection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cb1e091

Please sign in to comment.