ESPHome  2024.10.2
automation.h
Go to the documentation of this file.
1 #pragma once
2 
7 
8 namespace esphome {
9 namespace output {
10 
11 template<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 
21 template<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 
31 template<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 turn_on()
Enable this binary output.
Definition: binary_output.h:43
void play(Ts... x) override
Definition: automation.h:25
TurnOffAction(BinaryOutput *output)
Definition: automation.h:13
SetLevelAction(FloatOutput *output)
Definition: automation.h:33
Base class for all output components that can output a variable level, like PWM.
Definition: float_output.h:31
virtual void turn_off()
Disable this binary output.
Definition: binary_output.h:51
uint16_t x
Definition: tt21100.cpp:17
void play(Ts... x) override
Definition: automation.h:15
TEMPLATABLE_VALUE(float, level) void play(Ts... x) override
Definition: automation.h:35
TurnOnAction(BinaryOutput *output)
Definition: automation.h:23
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7