ESPHome 2025.5.0
Loading...
Searching...
No Matches
ble_scanner.h
Go to the documentation of this file.
1#pragma once
2
3#include <ctime>
4#include <string>
5
9
10#ifdef USE_ESP32
11
12namespace esphome {
13namespace ble_scanner {
14
16 public:
17 bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override {
18 this->publish_state("{\"timestamp\":" + to_string(::time(nullptr)) +
19 ","
20 "\"address\":\"" +
21 device.address_str() +
22 "\","
23 "\"rssi\":" +
24 to_string(device.get_rssi()) +
25 ","
26 "\"name\":\"" +
27 device.get_name() + "\"}");
28
29 return true;
30 }
31 void dump_config() override;
32 float get_setup_priority() const override { return setup_priority::DATA; }
33};
34
35} // namespace ble_scanner
36} // namespace esphome
37
38#endif
float get_setup_priority() const override
Definition ble_scanner.h:32
bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override
Definition ble_scanner.h:17
void publish_state(const std::string &state)
const float DATA
For components that import data from directly connected sensors like DHT.
Definition component.cpp:19
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
std::string to_string(int value)
Definition helpers.cpp:82