ESPHome  2024.7.0
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 // Timing specific to YAC1FB9
45 const uint32_t GREE_YAC1FB9_HEADER_SPACE = 4500;
46 const uint32_t GREE_YAC1FB9_MESSAGE_SPACE = 19980;
47 
48 // State Frame size
49 const uint8_t GREE_STATE_FRAME_SIZE = 8;
50 
51 // Only available on YAN
52 // Vertical air directions. Note that these cannot be set on all heat pumps
53 const uint8_t GREE_VDIR_AUTO = 0x00;
54 const uint8_t GREE_VDIR_MANUAL = 0x00;
55 const uint8_t GREE_VDIR_SWING = 0x01;
56 const uint8_t GREE_VDIR_UP = 0x02;
57 const uint8_t GREE_VDIR_MUP = 0x03;
58 const uint8_t GREE_VDIR_MIDDLE = 0x04;
59 const uint8_t GREE_VDIR_MDOWN = 0x05;
60 const uint8_t GREE_VDIR_DOWN = 0x06;
61 
62 // Only available on YAC
63 // Horizontal air directions. Note that these cannot be set on all heat pumps
64 const uint8_t GREE_HDIR_AUTO = 0x00;
65 const uint8_t GREE_HDIR_MANUAL = 0x00;
66 const uint8_t GREE_HDIR_SWING = 0x01;
67 const uint8_t GREE_HDIR_LEFT = 0x02;
68 const uint8_t GREE_HDIR_MLEFT = 0x03;
69 const uint8_t GREE_HDIR_MIDDLE = 0x04;
70 const uint8_t GREE_HDIR_MRIGHT = 0x05;
71 const uint8_t GREE_HDIR_RIGHT = 0x06;
72 
73 // Model codes
75 
77  public:
79  : climate_ir::ClimateIR(GREE_TEMP_MIN, GREE_TEMP_MAX, 1.0f, true, true,
84 
85  void set_model(Model model);
86 
87  protected:
88  // Transmit via IR the state of this climate controller.
89  void transmit_state() override;
90 
91  uint8_t operation_mode_();
92  uint8_t fan_speed_();
93  uint8_t horizontal_swing_();
94  uint8_t vertical_swing_();
95  uint8_t temperature_();
96 
98 };
99 
100 } // namespace gree
101 } // namespace esphome
The fan mode is set to Low.
Definition: climate_mode.h:54
const uint8_t GREE_HDIR_LEFT
Definition: gree.h:67
const uint8_t GREE_HDIR_MRIGHT
Definition: gree.h:70
uint8_t operation_mode_()
Definition: gree.cpp:98
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:55
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:69
const uint8_t GREE_HDIR_SWING
Definition: gree.h:66
const uint8_t GREE_HDIR_RIGHT
Definition: gree.h:71
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:54
const uint8_t GREE_VDIR_MUP
Definition: gree.h:57
The fan mode is set to Auto.
Definition: climate_mode.h:52
const uint8_t GREE_HDIR_MANUAL
Definition: gree.h:65
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:58
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:150
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:64
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:60
const uint32_t GREE_IR_FREQUENCY
Definition: gree.h:31
const uint8_t GREE_VDIR_MDOWN
Definition: gree.h:59
const uint8_t GREE_VDIR_UP
Definition: gree.h:56
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
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
const uint8_t GREE_VDIR_AUTO
Definition: gree.h:53
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:49
const uint32_t GREE_YAC1FB9_MESSAGE_SPACE
Definition: gree.h:46
const uint32_t GREE_YAC1FB9_HEADER_SPACE
Definition: gree.h:45
const uint8_t GREE_TEMP_MIN
Definition: gree.h:10
uint8_t horizontal_swing_()
Definition: gree.cpp:140
const uint8_t GREE_HDIR_MLEFT
Definition: gree.h:68