ESPHome  2024.3.2
gree.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 namespace esphome {
6 namespace gree {
7 
8 // Values for GREE IR Controllers
9 // Temperature
10 const uint8_t GREE_TEMP_MIN = 16; // Celsius
11 const uint8_t GREE_TEMP_MAX = 30; // Celsius
12 
13 // Modes
14 const uint8_t GREE_MODE_AUTO = 0x00;
15 const uint8_t GREE_MODE_COOL = 0x01;
16 const uint8_t GREE_MODE_HEAT = 0x04;
17 const uint8_t GREE_MODE_DRY = 0x02;
18 const uint8_t GREE_MODE_FAN = 0x03;
19 
20 const uint8_t GREE_MODE_OFF = 0x00;
21 const uint8_t GREE_MODE_ON = 0x08;
22 
23 // Fan Speed
24 const uint8_t GREE_FAN_AUTO = 0x00;
25 const uint8_t GREE_FAN_1 = 0x10;
26 const uint8_t GREE_FAN_2 = 0x20;
27 const uint8_t GREE_FAN_3 = 0x30;
28 const uint8_t GREE_FAN_TURBO = 0x80;
29 
30 // IR Transmission
31 const uint32_t GREE_IR_FREQUENCY = 38000;
32 const uint32_t GREE_HEADER_MARK = 9000;
33 const uint32_t GREE_HEADER_SPACE = 4000;
34 const uint32_t GREE_BIT_MARK = 620;
35 const uint32_t GREE_ONE_SPACE = 1600;
36 const uint32_t GREE_ZERO_SPACE = 540;
37 const uint32_t GREE_MESSAGE_SPACE = 19000;
38 
39 // Timing specific for YAC features (I-Feel mode)
40 const uint32_t GREE_YAC_HEADER_MARK = 6000;
41 const uint32_t GREE_YAC_HEADER_SPACE = 3000;
42 const uint32_t GREE_YAC_BIT_MARK = 650;
43 
44 // State Frame size
45 const uint8_t GREE_STATE_FRAME_SIZE = 8;
46 
47 // Only available on YAN
48 // Vertical air directions. Note that these cannot be set on all heat pumps
49 const uint8_t GREE_VDIR_AUTO = 0x00;
50 const uint8_t GREE_VDIR_MANUAL = 0x00;
51 const uint8_t GREE_VDIR_SWING = 0x01;
52 const uint8_t GREE_VDIR_UP = 0x02;
53 const uint8_t GREE_VDIR_MUP = 0x03;
54 const uint8_t GREE_VDIR_MIDDLE = 0x04;
55 const uint8_t GREE_VDIR_MDOWN = 0x05;
56 const uint8_t GREE_VDIR_DOWN = 0x06;
57 
58 // Only available on YAC
59 // Horizontal air directions. Note that these cannot be set on all heat pumps
60 const uint8_t GREE_HDIR_AUTO = 0x00;
61 const uint8_t GREE_HDIR_MANUAL = 0x00;
62 const uint8_t GREE_HDIR_SWING = 0x01;
63 const uint8_t GREE_HDIR_LEFT = 0x02;
64 const uint8_t GREE_HDIR_MLEFT = 0x03;
65 const uint8_t GREE_HDIR_MIDDLE = 0x04;
66 const uint8_t GREE_HDIR_MRIGHT = 0x05;
67 const uint8_t GREE_HDIR_RIGHT = 0x06;
68 
69 // Model codes
71 
73  public:
75  : climate_ir::ClimateIR(GREE_TEMP_MIN, GREE_TEMP_MAX, 1.0f, true, true,
80 
81  void set_model(Model model);
82 
83  protected:
84  // Transmit via IR the state of this climate controller.
85  void transmit_state() override;
86 
87  uint8_t operation_mode_();
88  uint8_t fan_speed_();
89  uint8_t horizontal_swing_();
90  uint8_t vertical_swing_();
91  uint8_t temperature_();
92 
94 };
95 
96 } // namespace gree
97 } // namespace esphome
The fan mode is set to Low.
Definition: climate_mode.h:54
const uint8_t GREE_HDIR_LEFT
Definition: gree.h:63
const uint8_t GREE_HDIR_MRIGHT
Definition: gree.h:66
uint8_t operation_mode_()
Definition: gree.cpp:90
const uint32_t GREE_HEADER_SPACE
Definition: gree.h:33
The fan mode is set to Both.
Definition: climate_mode.h:74
const uint32_t GREE_YAC_HEADER_MARK
Definition: gree.h:40
const uint32_t GREE_MESSAGE_SPACE
Definition: gree.h:37
const uint32_t GREE_BIT_MARK
Definition: gree.h:34
const uint8_t GREE_FAN_AUTO
Definition: gree.h:24
const uint8_t GREE_FAN_3
Definition: gree.h:27
const uint8_t GREE_VDIR_SWING
Definition: gree.h:51
const uint32_t GREE_ONE_SPACE
Definition: gree.h:35
const uint8_t GREE_MODE_FAN
Definition: gree.h:18
const uint8_t GREE_HDIR_MIDDLE
Definition: gree.h:65
const uint8_t GREE_HDIR_SWING
Definition: gree.h:62
const uint8_t GREE_HDIR_RIGHT
Definition: gree.h:67
const uint8_t GREE_MODE_OFF
Definition: gree.h:20
The fan mode is set to Horizontal.
Definition: climate_mode.h:78
const uint8_t GREE_VDIR_MANUAL
Definition: gree.h:50
const uint8_t GREE_VDIR_MUP
Definition: gree.h:53
The fan mode is set to Auto.
Definition: climate_mode.h:52
const uint8_t GREE_HDIR_MANUAL
Definition: gree.h:61
const uint8_t GREE_MODE_AUTO
Definition: gree.h:14
const uint8_t GREE_MODE_COOL
Definition: gree.h:15
ClimateIR(float minimum_temperature, float maximum_temperature, float temperature_step=1.0f, bool supports_dry=false, bool supports_fan_only=false, std::set< climate::ClimateFanMode > fan_modes={}, std::set< climate::ClimateSwingMode > swing_modes={}, std::set< climate::ClimatePreset > presets={})
Definition: climate_ir.h:26
const uint32_t GREE_HEADER_MARK
Definition: gree.h:32
const uint8_t GREE_VDIR_MIDDLE
Definition: gree.h:54
const uint8_t GREE_FAN_1
Definition: gree.h:25
The fan mode is set to Vertical.
Definition: climate_mode.h:76
void set_model(Model model)
Definition: gree.cpp:9
uint8_t vertical_swing_()
Definition: gree.cpp:142
const uint8_t GREE_MODE_ON
Definition: gree.h:21
const uint8_t GREE_MODE_DRY
Definition: gree.h:17
const uint8_t GREE_HDIR_AUTO
Definition: gree.h:60
const uint8_t GREE_FAN_TURBO
Definition: gree.h:28
The fan mode is set to High.
Definition: climate_mode.h:58
const uint32_t GREE_YAC_HEADER_SPACE
Definition: gree.h:41
The swing mode is set to Off.
Definition: climate_mode.h:72
const uint8_t GREE_MODE_HEAT
Definition: gree.h:16
const uint8_t GREE_VDIR_DOWN
Definition: gree.h:56
const uint32_t GREE_IR_FREQUENCY
Definition: gree.h:31
const uint8_t GREE_VDIR_MDOWN
Definition: gree.h:55
const uint8_t GREE_VDIR_UP
Definition: gree.h:52
void transmit_state() override
Definition: gree.cpp:11
const uint32_t GREE_ZERO_SPACE
Definition: gree.h:36
const uint32_t GREE_YAC_BIT_MARK
Definition: gree.h:42
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
const uint8_t GREE_VDIR_AUTO
Definition: gree.h:49
const uint8_t GREE_TEMP_MAX
Definition: gree.h:11
The fan mode is set to Medium.
Definition: climate_mode.h:56
const uint8_t GREE_FAN_2
Definition: gree.h:26
const uint8_t GREE_STATE_FRAME_SIZE
Definition: gree.h:45
const uint8_t GREE_TEMP_MIN
Definition: gree.h:10
uint8_t horizontal_swing_()
Definition: gree.cpp:132
const uint8_t GREE_HDIR_MLEFT
Definition: gree.h:64