Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
37989e25ae | |||
922dbf98b9 | |||
34089f1add | |||
4c710f7a0a | |||
b766c0ce04 | |||
32fe442cce | |||
61f58a5963 |
@@ -35,7 +35,7 @@ async def to_code(config):
|
|||||||
cg.add(var.set_room(config[CONF_ROOM_KEY]))
|
cg.add(var.set_room(config[CONF_ROOM_KEY]))
|
||||||
# cg.add(var.set_base_topic(config[CONF_BASE_TOPIC_KEY]))
|
# cg.add(var.set_base_topic(config[CONF_BASE_TOPIC_KEY]))
|
||||||
# cg.add(var.set_addresses(config[CONF_MAC_KEY]))
|
# cg.add(var.set_addresses(config[CONF_MAC_KEY]))
|
||||||
# cg.add(var.set_max_distance(config[CONF_MAX_DISTANCE]))
|
cg.add(var.set_max_distance(config[CONF_MAX_DISTANCE]))
|
||||||
|
|
||||||
add_idf_sdkconfig_option("CONFIG_BT_ENABLED", True)
|
add_idf_sdkconfig_option("CONFIG_BT_ENABLED", True)
|
||||||
add_idf_sdkconfig_option("CONFIG_BT_BLUEDROID_ENABLED", False)
|
add_idf_sdkconfig_option("CONFIG_BT_BLUEDROID_ENABLED", False)
|
||||||
|
@@ -69,11 +69,16 @@ namespace esphome
|
|||||||
_id = slugify(room);
|
_id = slugify(room);
|
||||||
roomsTopic = std::string(CHANNEL) + std::string("/rooms/") + _id;
|
roomsTopic = std::string(CHANNEL) + std::string("/rooms/") + _id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ESP32Presense::set_max_distance(float maxDistance) {
|
||||||
|
BleFingerprintCollection::maxDistance = maxDistance;
|
||||||
|
}
|
||||||
|
|
||||||
void ESP32Presense::setup()
|
void ESP32Presense::setup()
|
||||||
{
|
{
|
||||||
BleFingerprintCollection::Setup();
|
BleFingerprintCollection::Setup();
|
||||||
xTaskCreatePinnedToCore(scanTask, "scanTask", SCAN_TASK_STACK_SIZE, nullptr, 1, &scanTaskHandle, CONFIG_BT_NIMBLE_PINNED_TO_CORE);
|
xTaskCreatePinnedToCore(scanTask, "scanTask", SCAN_TASK_STACK_SIZE, nullptr, 1, &scanTaskHandle, CONFIG_BT_NIMBLE_PINNED_TO_CORE);
|
||||||
|
publishDevices = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESP32Presense::loop()
|
void ESP32Presense::loop()
|
||||||
@@ -108,13 +113,19 @@ namespace esphome
|
|||||||
totalFpSeen++;
|
totalFpSeen++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ESP_LOGD(TAG, "F %s", f->getAddress().toString().c_str());
|
||||||
|
|
||||||
if (f->hasReport()) {
|
if (f->hasReport()) {
|
||||||
if (reportBuffer(f))
|
ESP_LOGD(TAG, "hasReport");
|
||||||
|
if (reportBuffer(f)) {
|
||||||
|
ESP_LOGD(TAG, "reportBuffer");
|
||||||
f->clearReport();
|
f->clearReport();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this->reportDevice(f)) {
|
if (this->reportDevice(f)) {
|
||||||
|
ESP_LOGD(TAG, "reportDevice");
|
||||||
totalFpReported++;
|
totalFpReported++;
|
||||||
reported++;
|
reported++;
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,7 @@ namespace esphome
|
|||||||
void set_room(std::string room);
|
void set_room(std::string room);
|
||||||
bool reportBuffer(BleFingerprint *f);
|
bool reportBuffer(BleFingerprint *f);
|
||||||
bool reportDevice(BleFingerprint *f);
|
bool reportDevice(BleFingerprint *f);
|
||||||
|
void set_max_distance(float maxDistance);
|
||||||
//void set_base_topic(std::string base_topic) { base_topic_ = base_topic; }
|
//void set_base_topic(std::string base_topic) { base_topic_ = base_topic; }
|
||||||
};
|
};
|
||||||
} // namespace esp32_nimble_tracker
|
} // namespace esp32_nimble_tracker
|
||||||
|
Reference in New Issue
Block a user