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 event {
9
10template<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
17class EventTrigger : public Trigger<std::string> {
18 public:
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
virtual void play(Ts... x)=0
Helper class to easily give an object a parent of type T.
Definition helpers.h:538
TEMPLATABLE_VALUE(std::string, event_type) void play(Ts... x) override
Definition automation.h:12
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
uint16_t x
Definition tt21100.cpp:5