ESPHome
2025.2.2
Main Page
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
y
+
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
d
e
f
i
j
l
m
n
p
q
r
s
t
u
v
+
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
+
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
c
d
o
p
s
t
v
w
+
Enumerations
b
c
e
f
i
m
n
p
r
s
t
v
+
Enumerator
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Related Functions
+
Files
File List
+
Globals
+
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
y
+
Functions
_
a
l
m
o
s
t
u
+
Variables
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
y
Typedefs
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Modules
Pages
esphome
esphome
components
ble_scanner
ble_scanner.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <ctime>
4
#include <string>
5
6
#include "
esphome/core/component.h
"
7
#include "
esphome/components/esp32_ble_tracker/esp32_ble_tracker.h
"
8
#include "
esphome/components/text_sensor/text_sensor.h
"
9
10
#ifdef USE_ESP32
11
12
namespace
esphome
{
13
namespace
ble_scanner {
14
15
class
BLEScanner
:
public
text_sensor::TextSensor
,
public
esp32_ble_tracker::ESPBTDeviceListener
,
public
Component
{
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
esphome::setup_priority::DATA
const float DATA
For components that import data from directly connected sensors like DHT.
Definition:
component.cpp:19
esp32_ble_tracker.h
esphome::Component
Definition:
component.h:68
esphome::esp32_ble_tracker::ESPBTDevice::address_str
std::string address_str() const
Definition:
esp32_ble_tracker.cpp:668
esphome::text_sensor::TextSensor::publish_state
void publish_state(const std::string &state)
Definition:
text_sensor.cpp:9
esphome::esp32_ble_tracker::ESPBTDeviceListener
Definition:
esp32_ble_tracker.h:120
esphome::ble_scanner::BLEScanner::get_setup_priority
float get_setup_priority() const override
Definition:
ble_scanner.h:32
esphome::text_sensor::TextSensor
Definition:
text_sensor.h:34
esphome::ble_scanner::BLEScanner
Definition:
ble_scanner.h:15
esphome::esp32_ble_tracker::ESPBTDevice::get_rssi
int get_rssi() const
Definition:
esp32_ble_tracker.h:74
esphome::ble_scanner::BLEScanner::dump_config
void dump_config() override
Definition:
ble_scanner.cpp:11
esphome::to_string
std::string to_string(int value)
Definition:
helpers.cpp:83
esphome::esp32_ble_tracker::ESPBTDevice
Definition:
esp32_ble_tracker.h:63
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
component.h
esphome::esp32_ble_tracker::ESPBTDevice::get_name
const std::string & get_name() const
Definition:
esp32_ble_tracker.h:75
esphome::ble_scanner::BLEScanner::parse_device
bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override
Definition:
ble_scanner.h:17
text_sensor.h
Generated by
1.8.13