ESPHome
2026.11.0b6
Loading...
Searching...
No Matches
esphome
components
output
button
output_button.cpp
Go to the documentation of this file.
1
#include "
output_button.h
"
2
#include "
esphome/core/application.h
"
3
4
namespace
esphome::output
{
5
6
void
press_output_button
(
button::Button
*button,
BinaryOutput
*output,
uint32_t
duration
) {
7
output->
turn_on
();
8
// Keyed on the button, so a second press replaces the pending reset instead of stacking another
9
App
.
scheduler
.set_timeout(button,
duration
, [output]() { output->
turn_off
(); });
10
}
11
12
}
// namespace esphome::output
application.h
esphome::Application::scheduler
Scheduler scheduler
Definition
application.h:372
esphome::button::Button
Base class for all buttons.
Definition
button.h:25
esphome::output::BinaryOutput
Definition
binary_output.h:17
esphome::output::BinaryOutput::turn_off
virtual void turn_off()
Disable this binary output.
Definition
binary_output.h:50
esphome::output::BinaryOutput::turn_on
virtual void turn_on()
Enable this binary output.
Definition
binary_output.h:42
duration
uint8_t duration
Definition
msa3xx.h:0
esphome::output
Definition
binary_output.h:10
esphome::output::press_output_button
void press_output_button(button::Button *button, BinaryOutput *output, uint32_t duration)
Turn the output on and off again after duration ms; a second press restarts the wait.
Definition
output_button.cpp:6
esphome::App
Application App
Global storage of Application pointer - only one Application can exist.
output_button.h
uint32_t
static void uint32_t
Definition
crash_handler.cpp:153
Generated by
1.12.0