ESPHome  2024.9.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 
29 // IR Transmission
30 const uint32_t GREE_IR_FREQUENCY = 38000;
31 const uint32_t GREE_HEADER_MARK = 9000;
32 const uint32_t GREE_HEADER_SPACE = 4000;
33 const uint32_t GREE_BIT_MARK = 620;
34 const uint32_t GREE_ONE_SPACE = 1600;
35 const uint32_t GREE_ZERO_SPACE = 540;
36 const uint32_t GREE_MESSAGE_SPACE = 19000;
37 
38 // Timing specific for YAC features (I-Feel mode)
39 const uint32_t GREE_YAC_HEADER_MARK = 6000;
40 const uint32_t GREE_YAC_HEADER_SPACE = 3000;
41 const uint32_t GREE_YAC_BIT_MARK = 650;
42 
43 // Timing specific to YAC1FB9
44 const uint32_t GREE_YAC1FB9_HEADER_SPACE = 4500;
45 const uint32_t GREE_YAC1FB9_MESSAGE_SPACE = 19980;
46 
47 // State Frame size
48 const uint8_t GREE_STATE_FRAME_SIZE = 8;
49 
50 // Only available on YAN
51 // Vertical air directions. Note that these cannot be set on all heat pumps
52 const uint8_t GREE_VDIR_AUTO = 0x00;
53 const uint8_t GREE_VDIR_MANUAL = 0x00;
54 const uint8_t GREE_VDIR_SWING = 0x01;
55 const uint8_t GREE_VDIR_UP = 0x02;
56 const uint8_t GREE_VDIR_MUP = 0x03;
57 const uint8_t GREE_VDIR_MIDDLE = 0x04;
58 const uint8_t GREE_VDIR_MDOWN = 0x05;
59 const uint8_t GREE_VDIR_DOWN = 0x06;
60 
61 // Only available on YAC
62 // Horizontal air directions. Note that these cannot be set on all heat pumps
63 const uint8_t GREE_HDIR_AUTO = 0x00;
64 const uint8_t GREE_HDIR_MANUAL = 0x00;
65 const uint8_t GREE_HDIR_SWING = 0x01;
66 const uint8_t GREE_HDIR_LEFT = 0x02;
67 const uint8_t GREE_HDIR_MLEFT = 0x03;
68 const uint8_t GREE_HDIR_MIDDLE = 0x04;
69 const uint8_t GREE_HDIR_MRIGHT = 0x05;
70 const uint8_t GREE_HDIR_RIGHT = 0x06;
71 
72 // Only available on YX1FF
73 // Turbo (high) fan mode + sleep preset mode
74 const uint8_t GREE_FAN_TURBO = 0x80;
75 const uint8_t GREE_FAN_TURBO_BIT = 0x10;
76 const uint8_t GREE_PRESET_NONE = 0x00;
77 const uint8_t GREE_PRESET_SLEEP = 0x01;
78 const uint8_t GREE_PRESET_SLEEP_BIT = 0x80;
79 
80 // Model codes
82 
84  public:
86  : climate_ir::ClimateIR(GREE_TEMP_MIN, GREE_TEMP_MAX, 1.0f, true, true,
91 
92  void set_model(Model model);
93 
94  protected:
95  // Transmit via IR the state of this climate controller.
96  void transmit_state() override;
97 
98  uint8_t operation_mode_();
99  uint8_t fan_speed_();
100  uint8_t horizontal_swing_();
101  uint8_t vertical_swing_();
102  uint8_t temperature_();
103  uint8_t preset_();
104 
106 };
107 
108 } // namespace gree
109 } // namespace esphome
The fan mode is set to Low.
Definition: climate_mode.h:54
const uint8_t GREE_HDIR_LEFT
Definition: gree.h:66
const uint8_t GREE_HDIR_MRIGHT
Definition: gree.h:69
uint8_t operation_mode_()
Definition: gree.cpp:116
const uint32_t GREE_HEADER_SPACE
Definition: gree.h:32
The fan mode is set to Both.
Definition: climate_mode.h:74
const uint8_t GREE_PRESET_SLEEP_BIT
Definition: gree.h:78
const uint32_t GREE_YAC_HEADER_MARK
Definition: gree.h:39
const uint32_t GREE_MESSAGE_SPACE
Definition: gree.h:36
const uint8_t GREE_FAN_TURBO_BIT
Definition: gree.h:75
const uint32_t GREE_BIT_MARK
Definition: gree.h:33
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:54
const uint32_t GREE_ONE_SPACE
Definition: gree.h:34
const uint8_t GREE_MODE_FAN
Definition: gree.h:18
const uint8_t GREE_HDIR_MIDDLE
Definition: gree.h:68
const uint8_t GREE_HDIR_SWING
Definition: gree.h:65
const uint8_t GREE_HDIR_RIGHT
Definition: gree.h:70
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:53
const uint8_t GREE_VDIR_MUP
Definition: gree.h:56
The fan mode is set to Auto.
Definition: climate_mode.h:52
const uint8_t GREE_PRESET_NONE
Definition: gree.h:76
const uint8_t GREE_HDIR_MANUAL
Definition: gree.h:64
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:31
const uint8_t GREE_VDIR_MIDDLE
Definition: gree.h:57
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:185
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:63
const uint8_t GREE_PRESET_SLEEP
Definition: gree.h:77
const uint8_t GREE_FAN_TURBO
Definition: gree.h:74
The fan mode is set to High.
Definition: climate_mode.h:58
const uint32_t GREE_YAC_HEADER_SPACE
Definition: gree.h:40
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:59
const uint32_t GREE_IR_FREQUENCY
Definition: gree.h:30
const uint8_t GREE_VDIR_MDOWN
Definition: gree.h:58
const uint8_t GREE_VDIR_UP
Definition: gree.h:55
void transmit_state() override
Definition: gree.cpp:19
const uint32_t GREE_ZERO_SPACE
Definition: gree.h:35
const uint32_t GREE_YAC_BIT_MARK
Definition: gree.h:41
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
const uint8_t GREE_VDIR_AUTO
Definition: gree.h:52
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:48
const uint32_t GREE_YAC1FB9_MESSAGE_SPACE
Definition: gree.h:45
const uint32_t GREE_YAC1FB9_HEADER_SPACE
Definition: gree.h:44
const uint8_t GREE_TEMP_MIN
Definition: gree.h:10
uint8_t horizontal_swing_()
Definition: gree.cpp:175
const uint8_t GREE_HDIR_MLEFT
Definition: gree.h:67