ESPHome 2025.9.0-dev
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
43template<typename... Ts> class SetMinPowerAction : public Action<Ts...> {
44 public:
46
47 TEMPLATABLE_VALUE(float, min_power)
48
49 void play(Ts... x) override { this->output_->set_min_power(this->min_power_.value(x...)); }
50
51 protected:
53};
54
55template<typename... Ts> class SetMaxPowerAction : public Action<Ts...> {
56 public:
58
59 TEMPLATABLE_VALUE(float, max_power)
60
61 void play(Ts... x) override { this->output_->set_max_power(this->max_power_.value(x...)); }
62
63 protected:
65};
66
67} // namespace output
68} // 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.
void set_max_power(float max_power)
Set the maximum power output of this component.
void set_min_power(float min_power)
Set the minimum power output of this component.
SetLevelAction(FloatOutput *output)
Definition automation.h:33
TEMPLATABLE_VALUE(float, level) void play(Ts... x) override
Definition automation.h:35
SetMaxPowerAction(FloatOutput *output)
Definition automation.h:57
TEMPLATABLE_VALUE(float, max_power) void play(Ts... x) override
Definition automation.h:59
SetMinPowerAction(FloatOutput *output)
Definition automation.h:45
TEMPLATABLE_VALUE(float, min_power) void play(Ts... x) override
Definition automation.h:47
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