ESPHome
2024.11.1
esphome
esphome
components
event
automation.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/components/event/event.h
"
4
#include "
esphome/core/automation.h
"
5
#include "
esphome/core/component.h
"
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
esphome::event::EventTrigger::EventTrigger
EventTrigger(Event *event)
Definition:
automation.h:19
x
uint16_t x
Definition:
tt21100.cpp:17
automation.h
esphome::event::TriggerEventAction
Definition:
automation.h:10
esphome::Action
Definition:
automation.h:121
esphome::Parented< Event >::parent_
Event * parent_
Definition:
helpers.h:533
esphome::event::Event
Definition:
event.h:24
event.h
esphome::event::TriggerEventAction::TEMPLATABLE_VALUE
TEMPLATABLE_VALUE(std::string, event_type) void play(Ts... x) override
Definition:
automation.h:12
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
esphome::Trigger
Definition:
automation.h:92
component.h
esphome::event::EventTrigger
Definition:
automation.h:17
esphome::Action< Ts... >::play
virtual void play(Ts... x)=0
esphome::Parented
Helper class to easily give an object a parent of type T.
Definition:
helpers.h:522
Generated by
1.8.13