ESPHome 2025.9.0-dev
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};
33
34} // namespace ble_scanner
35} // namespace esphome
36
37#endif
bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override
Definition ble_scanner.h:17
void publish_state(const std::string &state)
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7