ESPHome  2024.4.0
automation.h
Go to the documentation of this file.
1 #pragma once
2 
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:
18 };
19 
20 class ButtonPressTrigger : public Trigger<> {
21  public:
23  button->add_on_press_callback([this]() { this->trigger(); });
24  }
25 };
26 
27 } // namespace button
28 } // namespace esphome
uint16_t x
Definition: tt21100.cpp:17
Base class for all buttons.
Definition: button.h:29
void press()
Press this button.
Definition: button.cpp:9
PressAction(Button *button)
Definition: automation.h:12
void add_on_press_callback(std::function< void()> &&callback)
Set callback for state changes.
Definition: button.cpp:14
void play(Ts... x) override
Definition: automation.h:14
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7