ESPHome 2025.5.0
Loading...
Searching...
No Matches
automation.h
Go to the documentation of this file.
1#pragma once
2
7
8namespace esphome {
9namespace output {
10
11template<typename... Ts> class TurnOffAction : public Action<Ts...> {
12 public:
13 TurnOffAction(BinaryOutput *output) : output_(output) {}
14
15 void play(Ts... x) override { this->output_->turn_off(); }
16
17 protected:
19};
20
21template<typename... Ts> class TurnOnAction : public Action<Ts...> {
22 public:
23 TurnOnAction(BinaryOutput *output) : output_(output) {}
24
25 void play(Ts... x) override { this->output_->turn_on(); }
26
27 protected:
29};
30
31template<typename... Ts> class SetLevelAction : public Action<Ts...> {
32 public:
33 SetLevelAction(FloatOutput *output) : output_(output) {}
34
35 TEMPLATABLE_VALUE(float, level)
36
37 void play(Ts... x) override { this->output_->set_level(this->level_.value(x...)); }
38
39 protected:
41};
42
43} // namespace output
44} // namespace esphome
virtual void play(Ts... x)=0
virtual void turn_off()
Disable this binary output.
virtual void turn_on()
Enable this binary output.
Base class for all output components that can output a variable level, like PWM.
void set_level(float state)
Set the level of this float output, this is called from the front-end.
SetLevelAction(FloatOutput *output)
Definition automation.h:33
TEMPLATABLE_VALUE(float, level) void play(Ts... x) override
Definition automation.h:35
TurnOffAction(BinaryOutput *output)
Definition automation.h:13
void play(Ts... x) override
Definition automation.h:15
TurnOnAction(BinaryOutput *output)
Definition automation.h:23
void play(Ts... x) override
Definition automation.h:25
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
uint16_t x
Definition tt21100.cpp:5