ESPHome
2024.10.2
esphome
esphome
components
button
automation.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/components/button/button.h
"
4
#include "
esphome/core/automation.h
"
5
#include "
esphome/core/component.h
"
6
7
namespace
esphome
{
8
namespace
button {
9
10
template
<
typename
... Ts>
class
PressAction
:
public
Action
<Ts...> {
11
public
:
12
explicit
PressAction
(
Button
*button) :
button_
(button) {}
13
14
void
play
(Ts...
x
)
override
{ this->
button_
->
press
(); }
15
16
protected
:
17
Button
*
button_
;
18
};
19
20
class
ButtonPressTrigger
:
public
Trigger
<> {
21
public
:
22
ButtonPressTrigger
(
Button
*button) {
23
button->
add_on_press_callback
([
this
]() { this->trigger(); });
24
}
25
};
26
27
}
// namespace button
28
}
// namespace esphome
esphome::button::PressAction::button_
Button * button_
Definition:
automation.h:17
x
uint16_t x
Definition:
tt21100.cpp:17
esphome::button::Button
Base class for all buttons.
Definition:
button.h:29
automation.h
esphome::button::ButtonPressTrigger::ButtonPressTrigger
ButtonPressTrigger(Button *button)
Definition:
automation.h:22
button.h
esphome::button::ButtonPressTrigger
Definition:
automation.h:20
esphome::button::PressAction
Definition:
automation.h:10
esphome::Action
Definition:
automation.h:121
esphome::button::Button::press
void press()
Press this button.
Definition:
button.cpp:9
esphome::button::PressAction::PressAction
PressAction(Button *button)
Definition:
automation.h:12
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::PressAction::play
void play(Ts... x) override
Definition:
automation.h:14
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
esphome::Trigger
Definition:
automation.h:92
component.h
Generated by
1.8.13