[BT] Device tracker presence detection (#1548)

Add device tracker detection and automatic creation following HA discovery convention
So as to trigger the away state, add an offline status to the identified BLE trackers
This commit is contained in:
Florian authored and GitHub committed 2023-03-20 07:31:00 -05:00
1 parent 7bae999435
commit 85650a6204
5 files changed
+107 -31

No files matched your search

+5
View File
@@ -89,6 +89,9 @@ extern int btQueueLengthCount;
#ifndef TimeBtwConnect
# define TimeBtwConnect 3600000 //define default time between BLE connection attempt (not used for immediate actions); in milliseconds
#endif
#ifndef PresenceAwayTimer
# define PresenceAwayTimer 120000 //define the time between Offline Status update for the sensors
#endif
#ifndef BLEScanDuplicateCacheSize
# define BLEScanDuplicateCacheSize 200
@@ -160,6 +163,7 @@ struct BTConfig_s {
bool pubAdvData; // Publish advertisement data
bool pubBeaconUuidForTopic; // Use iBeacon UUID as topic, instead of sender (random) MAC address
bool ignoreWBlist; // Disable Whitelist & Blacklist
unsigned long presenceAwayTimer; //Timer that trigger a tracker state as offline if not seen
};
// Global struct to store live BT configuration data
@@ -209,6 +213,7 @@ struct BLEdevice {
bool isBlkL;
bool connect;
int sensorModel_id;
unsigned long lastUpdate;
};
class BLEconectable {