ESPHome
2025.3.3
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
z
+
Functions
_
a
b
c
d
l
m
o
p
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
z
Typedefs
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Modules
Pages
esphome
esphome
components
output
button
output_button.cpp
Go to the documentation of this file.
1
#include "
output_button.h
"
2
#include "
esphome/core/log.h
"
3
4
namespace
esphome
{
5
namespace
output {
6
7
static
const
char
*
const
TAG =
"output.button"
;
8
9
void
OutputButton::dump_config
() {
10
LOG_BUTTON(
""
,
"Output Button"
,
this
);
11
ESP_LOGCONFIG(TAG,
" Duration: %.1fs"
, this->
duration_
/ 1e3f);
12
}
13
void
OutputButton::press_action
() {
14
this->
output_
->
turn_on
();
15
16
// Use a named timeout so that it's automatically cancelled if button is pressed again before it's reset
17
this->
set_timeout
(
"reset"
, this->
duration_
, [
this
]() { this->
output_
->
turn_off
(); });
18
}
19
20
}
// namespace output
21
}
// namespace esphome
esphome::output::BinaryOutput::turn_on
virtual void turn_on()
Enable this binary output.
Definition:
binary_output.h:43
esphome::output::OutputButton::press_action
void press_action() override
Definition:
output_button.cpp:13
esphome::output::BinaryOutput::turn_off
virtual void turn_off()
Disable this binary output.
Definition:
binary_output.h:51
esphome::Component::set_timeout
void set_timeout(const std::string &name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a unique name.
Definition:
component.cpp:69
output_button.h
esphome::output::OutputButton::dump_config
void dump_config() override
Definition:
output_button.cpp:9
esphome::output::OutputButton::output_
output::BinaryOutput * output_
Definition:
output_button.h:20
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
log.h
esphome::output::OutputButton::duration_
uint32_t duration_
Definition:
output_button.h:21
Generated by
1.8.13