2023-12-07 23:51:43 +03:00
|
|
|
#pragma once
|
|
|
|
|
2023-12-10 12:57:27 +03:00
|
|
|
#include <ArduinoJson.h>
|
2023-12-07 23:51:43 +03:00
|
|
|
#include "esphome/core/component.h"
|
|
|
|
#include "esphome/components/mqtt/custom_mqtt_device.h"
|
|
|
|
#include "BleFingerprintCollection.h"
|
2023-12-10 12:57:27 +03:00
|
|
|
#include "defaults.h"
|
2023-12-07 23:51:43 +03:00
|
|
|
// #include "esphome/components/nimble_distance_custom/nimble_distance_custom.h"
|
|
|
|
|
|
|
|
namespace esphome
|
|
|
|
{
|
2023-12-10 09:08:23 +03:00
|
|
|
namespace esp32_presense
|
2023-12-07 23:51:43 +03:00
|
|
|
{
|
2023-12-10 11:49:23 +03:00
|
|
|
class ESP32Presense :
|
|
|
|
public Component,
|
2023-12-07 23:51:43 +03:00
|
|
|
public mqtt::CustomMQTTDevice
|
|
|
|
// public nimble_distance_custom::NimbleDistanceCustomComponent
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
BleFingerprint *ble_fingerprint = NULL;
|
|
|
|
|
|
|
|
bool sendTelemetry(
|
|
|
|
unsigned int totalSeen,
|
|
|
|
unsigned int totalFpSeen,
|
|
|
|
unsigned int totalFpQueried,
|
|
|
|
unsigned int totalFpReported,
|
|
|
|
unsigned int count
|
|
|
|
);
|
|
|
|
public:
|
2023-12-10 11:49:23 +03:00
|
|
|
void setup() override;
|
|
|
|
void loop() override;
|
2023-12-07 23:51:43 +03:00
|
|
|
void reportLoop();
|
|
|
|
// void on_result(nimble_distance_custom::NimbleDistanceCustomResult&) override;
|
2023-12-10 12:57:27 +03:00
|
|
|
void set_room(std::string room);
|
|
|
|
bool reportBuffer(BleFingerprint *f);
|
|
|
|
bool reportDevice(BleFingerprint *f);
|
2023-12-10 13:07:05 +03:00
|
|
|
void set_max_distance(float maxDistance);
|
2023-12-07 23:51:43 +03:00
|
|
|
//void set_base_topic(std::string base_topic) { base_topic_ = base_topic; }
|
|
|
|
};
|
|
|
|
} // namespace esp32_nimble_tracker
|
|
|
|
} // namespace esphome
|