esphome/components/esp32_presense/esp32_presense.h
2023-12-10 13:07:05 +03:00

41 lines
1.5 KiB
C++

#pragma once
#include <ArduinoJson.h>
#include "esphome/core/component.h"
#include "esphome/components/mqtt/custom_mqtt_device.h"
#include "BleFingerprintCollection.h"
#include "defaults.h"
// #include "esphome/components/nimble_distance_custom/nimble_distance_custom.h"
namespace esphome
{
namespace esp32_presense
{
class ESP32Presense :
public Component,
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:
void setup() override;
void loop() override;
void reportLoop();
// void on_result(nimble_distance_custom::NimbleDistanceCustomResult&) override;
void set_room(std::string room);
bool reportBuffer(BleFingerprint *f);
bool reportDevice(BleFingerprint *f);
void set_max_distance(float maxDistance);
//void set_base_topic(std::string base_topic) { base_topic_ = base_topic; }
};
} // namespace esp32_nimble_tracker
} // namespace esphome