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
button
button.cpp
Go to the documentation of this file.
1
#include "
button.h
"
2
#include "
esphome/core/log.h
"
3
4
namespace
esphome
{
5
namespace
button {
6
7
static
const
char
*
const
TAG =
"button"
;
8
9
void
Button::press
() {
10
ESP_LOGD(TAG,
"'%s' Pressed."
, this->
get_name
().c_str());
11
this->
press_action
();
12
this->
press_callback_
.call();
13
}
14
void
Button::add_on_press_callback
(std::function<
void
()> &&callback) { this->
press_callback_
.add(std::move(callback)); }
15
16
}
// namespace button
17
}
// namespace esphome
button.h
esphome::button::Button::press
void press()
Press this button.
Definition:
button.cpp:9
esphome::button::Button::add_on_press_callback
void add_on_press_callback(std::function< void()> &&callback)
Set callback for state changes.
Definition:
button.cpp:14
esphome::button::Button::press_action
virtual void press_action()=0
You should implement this virtual method if you want to create your own button.
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
log.h
esphome::button::Button::press_callback_
CallbackManager< void()> press_callback_
Definition:
button.h:48
esphome::EntityBase::get_name
const StringRef & get_name() const
Definition:
entity_base.cpp:10
Generated by
1.8.13