ESPHome  2024.11.1
automation.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace event {
9 
10 template<typename... Ts> class TriggerEventAction : public Action<Ts...>, public Parented<Event> {
11  public:
12  TEMPLATABLE_VALUE(std::string, event_type)
13 
14  void play(Ts... x) override { this->parent_->trigger(this->event_type_.value(x...)); }
15 };
16 
17 class EventTrigger : public Trigger<std::string> {
18  public:
19  EventTrigger(Event *event) {
20  event->add_on_event_callback([this](const std::string &event_type) { this->trigger(event_type); });
21  }
22 };
23 
24 } // namespace event
25 } // namespace esphome
EventTrigger(Event *event)
Definition: automation.h:19
uint16_t x
Definition: tt21100.cpp:17
TEMPLATABLE_VALUE(std::string, event_type) void play(Ts... x) override
Definition: automation.h:12
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
virtual void play(Ts... x)=0
Helper class to easily give an object a parent of type T.
Definition: helpers.h:522