ESPHome  2024.4.1
hon_packet.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cstdint>
4 
5 namespace esphome {
6 namespace haier {
7 namespace hon_protocol {
8 
9 enum class VerticalSwingMode : uint8_t {
10  HEALTH_UP = 0x01,
11  MAX_UP = 0x02,
12  HEALTH_DOWN = 0x03,
13  UP = 0x04,
14  CENTER = 0x06,
15  DOWN = 0x08,
16  AUTO = 0x0C
17 };
18 
19 enum class HorizontalSwingMode : uint8_t {
20  CENTER = 0x00,
21  MAX_LEFT = 0x03,
22  LEFT = 0x04,
23  RIGHT = 0x05,
24  MAX_RIGHT = 0x06,
25  AUTO = 0x07
26 };
27 
28 enum class ConditioningMode : uint8_t {
29  AUTO = 0x00,
30  COOL = 0x01,
31  DRY = 0x02,
32  HEALTHY_DRY = 0x03,
33  HEAT = 0x04,
34  ENERGY_SAVING = 0x05,
35  FAN = 0x06
36 };
37 
38 enum class DataParameters : uint8_t {
39  AC_POWER = 0x01,
40  SET_POINT = 0x02,
41  AC_MODE = 0x04,
42  FAN_MODE = 0x05,
43  USE_FAHRENHEIT = 0x07,
44  TEN_DEGREE = 0x0A,
45  HEALTH_MODE = 0x0B,
46  BEEPER_STATUS = 0x16,
47  LOCK_REMOTE = 0x17,
48  QUIET_MODE = 0x19,
49  FAST_MODE = 0x1A,
50 };
51 
52 enum class SpecialMode : uint8_t { NONE = 0x00, ELDERLY = 0x01, CHILDREN = 0x02, PREGNANT = 0x03 };
53 
54 enum class FanMode : uint8_t { FAN_HIGH = 0x01, FAN_MID = 0x02, FAN_LOW = 0x03, FAN_AUTO = 0x05 };
55 
57  // Control bytes starts here
58  // 1
59  uint8_t set_point; // Target temperature with 16°C offset (0x00 = 16°C)
60  // 2
61  uint8_t vertical_swing_mode : 4; // See enum VerticalSwingMode
62  uint8_t : 0;
63  // 3
64  uint8_t fan_mode : 3; // See enum FanMode
65  uint8_t special_mode : 2; // See enum SpecialMode
66  uint8_t ac_mode : 3; // See enum ConditioningMode
67  // 4
68  uint8_t : 8;
69  // 5
70  uint8_t ten_degree : 1; // 10 degree status
71  uint8_t display_status : 1; // If 0 disables AC's display
72  uint8_t half_degree : 1; // Use half degree
73  uint8_t intelligence_status : 1; // Intelligence status
74  uint8_t pmv_status : 1; // Comfort/PMV status
75  uint8_t use_fahrenheit : 1; // Use Fahrenheit instead of Celsius
76  uint8_t : 1;
77  uint8_t steri_clean : 1;
78  // 6
79  uint8_t ac_power : 1; // Is ac on or off
80  uint8_t health_mode : 1; // Health mode (negative ions) on or off
81  uint8_t electric_heating_status : 1; // Electric heating status
82  uint8_t fast_mode : 1; // Fast mode
83  uint8_t quiet_mode : 1; // Quiet mode
84  uint8_t sleep_mode : 1; // Sleep mode
85  uint8_t lock_remote : 1; // Disable remote
86  uint8_t beeper_status : 1; // If 1 disables AC's command feedback beeper (need to be set on every control command)
87  // 7
88  uint8_t target_humidity; // Target humidity (0=30% .. 3C=90%, step = 1%)
89  // 8
90  uint8_t horizontal_swing_mode : 3; // See enum HorizontalSwingMode
91  uint8_t : 3;
92  uint8_t human_sensing_status : 2; // Human sensing status
93  // 9
94  uint8_t change_filter : 1; // Filter need replacement
95  uint8_t : 0;
96  // 10
97  uint8_t fresh_air_status : 1; // Fresh air status
98  uint8_t humidification_status : 1; // Humidification status
99  uint8_t pm2p5_cleaning_status : 1; // PM2.5 cleaning status
100  uint8_t ch2o_cleaning_status : 1; // CH2O cleaning status
101  uint8_t self_cleaning_status : 1; // Self cleaning status
102  uint8_t light_status : 1; // Light status
103  uint8_t energy_saving_status : 1; // Energy saving status
104  uint8_t cleaning_time_status : 1; // Cleaning time (0 - accumulation, 1 - clear)
105 };
106 
108  // 11
109  uint8_t room_temperature; // 0.5°C step
110  // 12
111  uint8_t room_humidity; // 0%-100% with 1% step
112  // 13
113  uint8_t outdoor_temperature; // 1°C step, -64°C offset (0=-64°C)
114  // 14
115  uint8_t pm2p5_level : 2; // Indoor PM2.5 grade (00: Excellent, 01: good, 02: Medium, 03: Bad)
116  uint8_t air_quality : 2; // Air quality grade (00: Excellent, 01: good, 02: Medium, 03: Bad)
117  uint8_t human_sensing : 2; // Human presence result (00: N/A, 01: not detected, 02: One, 03: Multiple)
118  uint8_t : 1;
119  uint8_t ac_type : 1; // 00 - Heat and cool, 01 - Cool only)
120  // 15
121  uint8_t error_status; // See enum ErrorStatus
122  // 16
123  uint8_t operation_source : 2; // who is controlling AC (00: Other, 01: Remote control, 02: Button, 03: ESP)
124  uint8_t operation_mode_hk : 2; // Homekit only, operation mode (00: Cool, 01: Dry, 02: Heat, 03: Fan)
125  uint8_t : 3;
126  uint8_t err_confirmation : 1; // If 1 clear error status
127  // 17
128  uint16_t total_cleaning_time; // Cleaning cumulative time (1h step)
129  // 19
130  uint16_t indoor_pm2p5_value; // Indoor PM2.5 value (0 ug/m3 - 4095 ug/m3, 1 ug/m3 step)
131  // 21
132  uint16_t outdoor_pm2p5_value; // Outdoor PM2.5 value (0 ug/m3 - 4095 ug/m3, 1 ug/m3 step)
133  // 23
134  uint16_t ch2o_value; // Formaldehyde value (0 ug/m3 - 10000 ug/m3, 1 ug/m3 step)
135  // 25
136  uint16_t voc_value; // VOC value (Volatile Organic Compounds) (0 ug/m3 - 1023 ug/m3, 1 ug/m3 step)
137  // 27
138  uint16_t co2_value; // CO2 value (0 PPM - 10000 PPM, 1 PPM step)
139 };
140 
142  // 29
143  uint8_t power[2]; // AC power consumption (0W - 65535W, 1W step)
144  // 31
145  uint8_t indoor_coil_temperature; // 0.5°C step, -20°C offset (0=-20°C)
146  // 32
147  uint8_t outdoor_out_air_temperature; // 1°C step, -64°C offset (0=-64°C)
148  // 33
149  uint8_t outdoor_coil_temperature; // 1°C step, -64°C offset (0=-64°C)
150  // 34
151  uint8_t outdoor_in_air_temperature; // 1°C step, -64°C offset (0=-64°C)
152  // 35
153  uint8_t outdoor_defrost_temperature; // 1°C step, -64°C offset (0=-64°C)
154  // 36
155  uint8_t compressor_frequency; // 1Hz step, 0Hz - 127Hz
156  // 37
157  uint8_t compressor_current[2]; // 0.1A step, 0.0A - 51.1A (0x0000 - 0x01FF)
158  // 39
159  uint8_t outdoor_fan_status : 2; // 0 - off, 1 - on, 2 - information not available
160  uint8_t defrost_status : 2; // 0 - off, 1 - on, 2 - information not available
161  uint8_t : 0;
162  // 40
163  uint8_t compressor_status : 2; // 0 - off, 1 - on, 2 - information not available
164  uint8_t indoor_fan_status : 2; // 0 - off, 1 - on, 2 - information not available
165  uint8_t four_way_valve_status : 2; // 0 - off, 1 - on, 2 - information not available
166  uint8_t indoor_electric_heating_status : 2; // 0 - off, 1 - on, 2 - information not available
167  // 41
168  uint8_t expansion_valve_open_degree[2]; // 0 - 4095
169 };
170 
172  char protocol_version[8];
173  char software_version[8];
174  uint8_t encryption[3];
175  char hardware_version[8];
176  uint8_t : 8;
177  char device_name[8];
178  uint8_t functions[2];
179 };
180 
181 enum class SubcommandsControl : uint16_t {
182  GET_PARAMETERS = 0x4C01, // Request specific parameters (packet content: parameter ID1 + parameter ID2 + ...)
183  GET_USER_DATA = 0x4D01, // Request all user data from device (packet content: None)
184  GET_BIG_DATA = 0x4DFE, // Request big data information from device (packet content: None)
185  SET_PARAMETERS = 0x5C01, // Set parameters of the device and device return parameters (packet content: parameter ID1
186  // + parameter data1 + parameter ID2 + parameter data 2 + ...)
187  SET_SINGLE_PARAMETER = 0x5D00, // Set single parameter (0x5DXX second byte define parameter ID) and return all user
188  // data (packet content: ???)
189  SET_GROUP_PARAMETERS = 0x6001, // Set group parameters to device (0x60XX second byte define parameter is group ID,
190  // the only group mentioned in document is 1) and return all user data (packet
191  // content: all values like in status packet)
192 };
193 
194 const std::string HON_ALARM_MESSAGES[] = {
195  "Outdoor module failure",
196  "Outdoor defrost sensor failure",
197  "Outdoor compressor exhaust sensor failure",
198  "Outdoor EEPROM abnormality",
199  "Indoor coil sensor failure",
200  "Indoor-outdoor communication failure",
201  "Power supply overvoltage protection",
202  "Communication failure between panel and indoor unit",
203  "Outdoor compressor overheat protection",
204  "Outdoor environmental sensor abnormality",
205  "Full water protection",
206  "Indoor EEPROM failure",
207  "Outdoor out air sensor failure",
208  "CBD and module communication failure",
209  "Indoor DC fan failure",
210  "Outdoor DC fan failure",
211  "Door switch failure",
212  "Dust filter needs cleaning reminder",
213  "Water shortage protection",
214  "Humidity sensor failure",
215  "Indoor temperature sensor failure",
216  "Manipulator limit failure",
217  "Indoor PM2.5 sensor failure",
218  "Outdoor PM2.5 sensor failure",
219  "Indoor heating overload/high load alarm",
220  "Outdoor AC current protection",
221  "Outdoor compressor operation abnormality",
222  "Outdoor DC current protection",
223  "Outdoor no-load failure",
224  "CT current abnormality",
225  "Indoor cooling freeze protection",
226  "High and low pressure protection",
227  "Compressor out air temperature is too high",
228  "Outdoor evaporator sensor failure",
229  "Outdoor cooling overload",
230  "Water pump drainage failure",
231  "Three-phase power supply failure",
232  "Four-way valve failure",
233  "External alarm/scraper flow switch failure",
234  "Temperature cutoff protection alarm",
235  "Different mode operation failure",
236  "Electronic expansion valve failure",
237  "Dual heat source sensor Tw failure",
238  "Communication failure with the wired controller",
239  "Indoor unit address duplication failure",
240  "50Hz zero crossing failure",
241  "Outdoor unit failure",
242  "Formaldehyde sensor failure",
243  "VOC sensor failure",
244  "CO2 sensor failure",
245  "Firewall failure",
246 };
247 
248 constexpr size_t HON_ALARM_COUNT = sizeof(HON_ALARM_MESSAGES) / sizeof(HON_ALARM_MESSAGES[0]);
249 
250 } // namespace hon_protocol
251 } // namespace haier
252 } // namespace esphome
constexpr size_t HON_ALARM_COUNT
Definition: hon_packet.h:248
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 std::string HON_ALARM_MESSAGES[]
Definition: hon_packet.h:194