ESPHome 2025.5.0
Loading...
Searching...
No Matches
automation.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome {
8namespace button {
9
10template<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:
18};
19
20class ButtonPressTrigger : public Trigger<> {
21 public:
23 button->add_on_press_callback([this]() { this->trigger(); });
24 }
25};
26
27} // namespace button
28} // namespace esphome
void trigger(Ts... x)
Definition automation.h:96
Base class for all buttons.
Definition button.h:29
void add_on_press_callback(std::function< void()> &&callback)
Set callback for state changes.
Definition button.cpp:14
void press()
Press this button.
Definition button.cpp:9
PressAction(Button *button)
Definition automation.h:12
void play(Ts... x) override
Definition automation.h:14
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
uint16_t x
Definition tt21100.cpp:5