ESPHome  2024.10.2
ac_automations.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef USE_ARDUINO
4 
6 #include "air_conditioner.h"
7 
8 namespace esphome {
9 namespace midea {
10 namespace ac {
11 
12 template<typename... Ts> class MideaActionBase : public Action<Ts...> {
13  public:
14  void set_parent(AirConditioner *parent) { this->parent_ = parent; }
15 
16  protected:
18 };
19 
20 template<typename... Ts> class FollowMeAction : public MideaActionBase<Ts...> {
21  TEMPLATABLE_VALUE(float, temperature)
22  TEMPLATABLE_VALUE(bool, beeper)
23 
24  void play(Ts... x) override {
25  this->parent_->do_follow_me(this->temperature_.value(x...), this->beeper_.value(x...));
26  }
27 };
28 
29 template<typename... Ts> class SwingStepAction : public MideaActionBase<Ts...> {
30  public:
31  void play(Ts... x) override { this->parent_->do_swing_step(); }
32 };
33 
34 template<typename... Ts> class DisplayToggleAction : public MideaActionBase<Ts...> {
35  public:
36  void play(Ts... x) override { this->parent_->do_display_toggle(); }
37 };
38 
39 template<typename... Ts> class BeeperOnAction : public MideaActionBase<Ts...> {
40  public:
41  void play(Ts... x) override { this->parent_->do_beeper_on(); }
42 };
43 
44 template<typename... Ts> class BeeperOffAction : public MideaActionBase<Ts...> {
45  public:
46  void play(Ts... x) override { this->parent_->do_beeper_off(); }
47 };
48 
49 template<typename... Ts> class PowerOnAction : public MideaActionBase<Ts...> {
50  public:
51  void play(Ts... x) override { this->parent_->do_power_on(); }
52 };
53 
54 template<typename... Ts> class PowerOffAction : public MideaActionBase<Ts...> {
55  public:
56  void play(Ts... x) override { this->parent_->do_power_off(); }
57 };
58 
59 template<typename... Ts> class PowerToggleAction : public MideaActionBase<Ts...> {
60  public:
61  void play(Ts... x) override { this->parent_->do_power_toggle(); }
62 };
63 
64 } // namespace ac
65 } // namespace midea
66 } // namespace esphome
67 
68 #endif // USE_ARDUINO
uint16_t x
Definition: tt21100.cpp:17
void do_follow_me(float temperature, bool beeper=false)
void play(Ts... x) override
uint16_t temperature
Definition: sun_gtil2.cpp:26
void set_parent(AirConditioner *parent)
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
virtual void play(Ts... x)=0